queryresult

package
v0.23.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: AGPL-3.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnDef added in v0.17.0

type ColumnDef struct {
	Name     string `json:"name"`
	DataType string `json:"data_type"`
	// contains filtered or unexported fields
}

ColumnDef is a struct used to store column information from query results

func (*ColumnDef) IsScalar added in v0.19.0

func (c *ColumnDef) IsScalar(v any) bool

IsScalar checks if the given value is a scalar value it also mutates the containing ColumnDef so that it doesn't have to reflect for all values in a column

type Result

type Result struct {
	RowChan      *chan *RowResult
	Cols         []*ColumnDef
	TimingResult chan *TimingResult
}

func NewResult added in v0.17.0

func NewResult(cols []*ColumnDef) *Result

func (*Result) Close

func (r *Result) Close()

Close closes the row channel

func (*Result) IsExportSourceData added in v0.17.0

func (*Result) IsExportSourceData()

IsExportSourceData implements ExportSourceData

func (*Result) StreamError

func (r *Result) StreamError(err error)

func (*Result) StreamRow

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

type ResultStreamer

type ResultStreamer struct {
	Results chan *Result
	// contains filtered or unexported fields
}

func NewResultStreamer

func NewResultStreamer() *ResultStreamer

func (*ResultStreamer) AllResultsRead

func (q *ResultStreamer) AllResultsRead()

AllResultsRead is a signal that indicates the all results have been read from the stream

func (*ResultStreamer) Close

func (q *ResultStreamer) Close()

Close closes the result stream

func (*ResultStreamer) StreamResult

func (q *ResultStreamer) StreamResult(result *Result)

StreamResult streams result on the Results channel, then waits for them to be read

type RowResult

type RowResult struct {
	Data  []interface{}
	Error error
}

type ScanMetadataRow added in v0.23.0

type ScanMetadataRow struct {
	// the fields of this struct need to be public since these are populated by pgx using RowsToStruct
	Id           int64                    `db:"id" json:"-"`
	Connection   string                   `db:"connection" 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"`
	Duration     float64                  `db:"duration" json:"duration"`
	Columns      []string                 `db:"columns" json:"columns"`
	Limit        *int64                   `db:"limit" json:"limit"`
	Quals        []*grpc.SerializableQual `db:"quals" json:"quals"`
}

type SyncQueryResult

type SyncQueryResult struct {
	Rows         []interface{}
	Cols         []*ColumnDef
	TimingResult *TimingResult
}

type TimingResult

type TimingResult struct {
	Duration time.Duration
	Scans    []*ScanMetadataRow `json:"scans"`

	RowsReturned int64 `json:"rows_returned"`
	RowsFetched  int64 `json:"rows_fetched"`
	HydrateCalls int64 `json:"hydrate_calls"`
}

Jump to

Keyboard shortcuts

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