queryresult

package
v1.6.5-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: AGPL-3.0 Imports: 2 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnDef

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

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

func (*ColumnDef) IsScalar

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[T TimingContainer] struct {
	RowChan chan *RowResult
	Cols    []*ColumnDef
	Timing  T
}

func NewResult

func NewResult[T TimingContainer](cols []*ColumnDef, emptyTiming T) *Result[T]

func (*Result[T]) Close

func (r *Result[T]) Close()

Close closes the row channel

func (*Result[T]) IsExportSourceData

func (*Result[T]) IsExportSourceData()

IsExportSourceData implements ExportSourceData

func (*Result[T]) StreamError

func (r *Result[T]) StreamError(err error)

func (*Result[T]) StreamRow

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

type ResultStreamer

type ResultStreamer[T TimingContainer] struct {
	Results chan *Result[T]
	// contains filtered or unexported fields
}

func NewResultStreamer

func NewResultStreamer[T TimingContainer]() *ResultStreamer[T]

func (*ResultStreamer[T]) AllResultsRead

func (q *ResultStreamer[T]) AllResultsRead()

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

func (*ResultStreamer[T]) Close

func (q *ResultStreamer[T]) Close()

Close closes the result stream

func (*ResultStreamer[T]) StreamResult

func (q *ResultStreamer[T]) StreamResult(result *Result[T])

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

type RowResult

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

type SyncQueryResult

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

type TimingContainer added in v1.6.0

type TimingContainer interface {
	GetTiming() any
}

TimingContainer is an interface that allows us to parameterize the Result struct it must handle case of a query returning a stream of timing data OR a timing data struct directly the GetTiming func is used to populate the timing data in the JSON output (as we cannot serialise a stream!)

type TimingMetadata

type TimingMetadata struct {
	Duration time.Duration
}

Jump to

Keyboard shortcuts

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