queryresult

package
v2.3.6 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: AGPL-3.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type QueryRowSummary

type QueryRowSummary struct {
	UncachedRowsFetched int64 `db:"uncached_rows_fetched" json:"uncached_rows_fetched"`
	CachedRowsFetched   int64 `db:"cached_rows_fetched" json:"cached_rows_fetched"`
	HydrateCalls        int64 `db:"hydrate_calls" json:"hydrate_calls"`
	ScanCount           int64 `db:"scan_count" json:"scan_count"`
	ConnectionCount     int64 `db:"connection_count" json:"connection_count"`
	// contains filtered or unexported fields
}

func NewQueryRowSummary

func NewQueryRowSummary() *QueryRowSummary

func (*QueryRowSummary) AsResultRow

func (s *QueryRowSummary) AsResultRow() map[string]any

func (*QueryRowSummary) Update

func (s *QueryRowSummary) Update(m ScanMetadataRow)

type Result

type Result struct {
	*queryresult.Result[TimingResultStream]
	// contains filtered or unexported fields
}

Result wraps queryresult.Result[TimingResultStream] with idempotent Close() and synchronization to prevent race between StreamRow and Close

func NewResult

func NewResult(cols []*queryresult.ColumnDef) *Result

func WrapResult added in v2.3.3

WrapResult wraps a pipe-fittings Result with our wrapper that has idempotent Close

func (*Result) Close added in v2.3.3

func (r *Result) Close()

Close closes the row channel in an idempotent manner

func (*Result) StreamRow added in v2.3.3

func (r *Result) StreamRow(row []interface{})

StreamRow wraps the underlying StreamRow with synchronization

type ResultStreamer

ResultStreamer is a type alias for queryresult.ResultStreamer[TimingResultStream]

func NewResultStreamer

func NewResultStreamer() *ResultStreamer

type ScanMetadataRow

type ScanMetadataRow struct {
	// the fields of this struct need to be public since these are populated by pgx using RowsToStruct
	Connection   string                  `db:"connection,optional" json:"connection"`
	Table        string                  `db:"table"  json:"table"`
	CacheHit     bool                    `db:"cache_hit"  json:"cache_hit"`
	RowsFetched  int64                   `db:"rows_fetched" json:"rows_fetched"`
	HydrateCalls int64                   `db:"hydrate_calls" json:"hydrate_calls"`
	StartTime    time.Time               `db:"start_time" json:"start_time"`
	DurationMs   int64                   `db:"duration_ms" json:"duration_ms"`
	Columns      []string                `db:"columns" json:"columns"`
	Limit        *int64                  `db:"limit" json:"limit,omitempty"`
	Quals        []grpc.SerializableQual `db:"quals" json:"quals,omitempty"`
}

func NewScanMetadataRow

func NewScanMetadataRow(connection string, table string, columns []string, quals map[string]*proto.Quals, startTime time.Time, diration time.Duration, limit int64, m *proto.QueryMetadata) ScanMetadataRow

func (ScanMetadataRow) AsResultRow

func (m ScanMetadataRow) AsResultRow() map[string]any

AsResultRow returns the ScanMetadata as a map[string]interface which can be returned as a query result

type TimingResult

type TimingResult struct {
	DurationMs          int64              `json:"duration_ms"`
	Scans               []*ScanMetadataRow `json:"scans"`
	ScanCount           int64              `json:"scan_count,omitempty"`
	RowsReturned        int64              `json:"rows_returned"`
	UncachedRowsFetched int64              `json:"uncached_rows_fetched"`
	CachedRowsFetched   int64              `json:"cached_rows_fetched"`
	HydrateCalls        int64              `json:"hydrate_calls"`
	ConnectionCount     int64              `json:"connection_count"`
}

func (TimingResult) GetTiming

func (t TimingResult) GetTiming() any

GetTiming implements TimingContainer

func (*TimingResult) Initialise

func (r *TimingResult) Initialise(summary *QueryRowSummary, scans []*ScanMetadataRow)

type TimingResultStream

type TimingResultStream struct {
	Stream chan *TimingResult
}

func NewTimingResultStream

func NewTimingResultStream() TimingResultStream

func (TimingResultStream) GetTiming

func (t TimingResultStream) GetTiming() any

GetTiming implements TimingContainer

func (TimingResultStream) SetTiming

func (t TimingResultStream) SetTiming(result *TimingResult)

Jump to

Keyboard shortcuts

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