queryctx

package
v1.10.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package queryctx manages per-operation deadlines and result lifetimes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MutationColumns

func MutationColumns(fields []*schema.Field, model any, omitZero bool) []string

MutationColumns reports the model fields included in a mutation. The result is non-nil even when every field is omitted, so hooks can distinguish an empty update from a caller that supplied no column metadata.

func Rows

func Rows(rows driver.Rows, cancel context.CancelFunc) driver.Rows

Rows keeps the deadline alive while results are consumed and releases its timer when the caller drains or closes the result set.

func WithTimeout

WithTimeout applies the configured query timeout without extending an earlier caller deadline. Non-positive timeouts leave the caller in control.

Types

type Row

type Row struct {
	// contains filtered or unexported fields
}

Row preserves result column metadata for struct scans while retaining the driver's no-rows sentinel and ending telemetry only when Scan or Close runs.

func NewRow

func NewRow(rows driver.Rows, err, noRows error, op *observability.Op, cancel context.CancelFunc) *Row

NewRow takes ownership of rows and cancel, including when err is non-nil.

func (*Row) Close

func (r *Row) Close() error

Close allows schema validation failures to release an unscanned row too.

func (*Row) Columns

func (r *Row) Columns() ([]string, error)

Columns exposes the actual result order to the schema-aware scanner.

func (*Row) Scan

func (r *Row) Scan(dest ...any) (err error)

Scan copies the first result into dest and releases the remaining rows.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL