query

package
v0.81.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DocsIDCol   = "id"
	DocsDataCol = "data"

	DocsSchema = MustNewSchema(
		ColumnDesc{Name: DocsIDCol, Type: DataTypeSeqID},
		ColumnDesc{Name: DocsDataCol, Type: DataTypeDocument},
	)
	AggsSchema = MustNewSchema(
		ColumnDesc{Name: "token", Type: DataTypeString},
		ColumnDesc{Name: "min", Type: DataTypeFloat64},
		ColumnDesc{Name: "max", Type: DataTypeFloat64},
		ColumnDesc{Name: "sum", Type: DataTypeFloat64},
		ColumnDesc{Name: "total", Type: DataTypeUint64},
		ColumnDesc{Name: "not_exists", Type: DataTypeUint64},
		ColumnDesc{Name: "ts", Type: DataTypeUint64},
		ColumnDesc{Name: "samples", Type: DataTypeFloat64Array},
		ColumnDesc{Name: "values", Type: DataTypeStringArray},
	)
	AggResultSchema = MustNewSchema(
		ColumnDesc{Name: "token", Type: DataTypeString},
		ColumnDesc{Name: "value", Type: DataTypeFloat64},
		ColumnDesc{Name: "ts", Type: DataTypeUint64},
		ColumnDesc{Name: "quantiles", Type: DataTypeFloat64Array},
	)
)

We still get hardcoded schemas at the edges of the pipeline.

Functions

This section is empty.

Types

type Column added in v0.81.0

type Column[T any] struct {
	// contains filtered or unexported fields
}

func BytesColumn added in v0.81.0

func BytesColumn(idx int) Column[[]byte]

func DocColumn added in v0.81.0

func DocColumn(idx int) Column[*insaneJSON.Root]

func Float64ArrayColumn added in v0.81.0

func Float64ArrayColumn(idx int) Column[[]float64]

func Float64Column added in v0.81.0

func Float64Column(idx int) Column[float64]

func Int32Column added in v0.81.0

func Int32Column(idx int) Column[int32]

func Int64Column added in v0.81.0

func Int64Column(idx int) Column[int64]

func SeqIDColumn added in v0.81.0

func SeqIDColumn(idx int) Column[seq.ID]

func StringArrayColumn added in v0.81.0

func StringArrayColumn(idx int) Column[[]string]

func StringColumn added in v0.81.0

func StringColumn(idx int) Column[string]

func Uint32Column added in v0.81.0

func Uint32Column(idx int) Column[uint32]

func Uint64Column added in v0.81.0

func Uint64Column(idx int) Column[uint64]

func (Column[T]) Cmp added in v0.81.0

func (c Column[T]) Cmp() func(T, T) int

func (Column[T]) DataType added in v0.81.0

func (c Column[T]) DataType() DataType

func (Column[T]) Idx added in v0.81.0

func (c Column[T]) Idx() int

func (Column[T]) RawData added in v0.81.0

func (c Column[T]) RawData(r *Record) []byte

RawData returns raw data of r's column at c.idx index

func (Column[T]) Val added in v0.81.0

func (c Column[T]) Val(r *Record) T

Val returns value of r's column at c.idx index

type ColumnDesc added in v0.81.0

type ColumnDesc struct {
	Name string
	Type DataType
}

type DataType

type DataType byte
const (
	DataTypeBytes DataType = iota
	DataTypeSeqID
	DataTypeDocument
	DataTypeString
	DataTypeUint32
	DataTypeUint64
	DataTypeInt32
	DataTypeInt64
	DataTypeFloat64
	DataTypeFloat64Array
	DataTypeStringArray
)

func (DataType) String added in v0.81.0

func (t DataType) String() string

type Record

type Record struct {
	Vals []*RecordVals
}

executors make use of val's index, executor's parameters has colIdx field

func NewRecord

func NewRecord(vals []*RecordVals) *Record

func (*Record) Release

func (r *Record) Release()

type RecordProducer

type RecordProducer interface {
	// Next returns the next record, or nil when the stream is exhausted. Errors
	// that occur during production are not returned here; they are accumulated
	// internally and reported via Finalize.
	Next() *Record
	// Finalize releases resources held by the producer and returns the final
	// summary gathered during the stream. It must be called exactly once after the
	// producer is exhausted.
	Finalize() *Summary
}

type RecordVals

type RecordVals struct {
	Type DataType
	// contains filtered or unexported fields
}

func NewBytesVals added in v0.81.0

func NewBytesVals(data []byte) *RecordVals

func NewDocVals added in v0.81.0

func NewDocVals(payload []byte) *RecordVals

NewDocVals aliases payload — no copy. The payload must stay unmodified until the val is decoded (decoding is lazy: AsDoc may run in a downstream executor long after this call) — so pooled or reused buffers are unsafe here.

func NewFloat64ArrayVals added in v0.81.0

func NewFloat64ArrayVals(v []float64) *RecordVals

func NewFloat64Vals added in v0.81.0

func NewFloat64Vals(v float64) *RecordVals

func NewInt32Vals added in v0.81.0

func NewInt32Vals(v int32) *RecordVals

func NewInt64Vals added in v0.81.0

func NewInt64Vals(v int64) *RecordVals

func NewRecordVals

func NewRecordVals(dataType DataType, rawData []byte) *RecordVals

func NewSeqIDVals added in v0.81.0

func NewSeqIDVals(id seq.ID) *RecordVals

func NewStringArrayVals added in v0.81.0

func NewStringArrayVals(v []string) *RecordVals

func NewStringVals added in v0.81.0

func NewStringVals(s string) *RecordVals

NewStringVals aliases s — no copy, so s must outlive the val.

func NewUint32Vals added in v0.81.0

func NewUint32Vals(v uint32) *RecordVals

func NewUint64Vals added in v0.81.0

func NewUint64Vals(v uint64) *RecordVals

func (*RecordVals) AsBytes added in v0.81.0

func (rv *RecordVals) AsBytes() []byte

func (*RecordVals) AsDoc added in v0.81.0

func (rv *RecordVals) AsDoc() *insaneJSON.Root

func (*RecordVals) AsFloat64 added in v0.81.0

func (rv *RecordVals) AsFloat64() float64

func (*RecordVals) AsFloat64Array added in v0.81.0

func (rv *RecordVals) AsFloat64Array() []float64

func (*RecordVals) AsInt32 added in v0.81.0

func (rv *RecordVals) AsInt32() int32

func (*RecordVals) AsInt64 added in v0.81.0

func (rv *RecordVals) AsInt64() int64

func (*RecordVals) AsSeqID added in v0.81.0

func (rv *RecordVals) AsSeqID() seq.ID

func (*RecordVals) AsString added in v0.81.0

func (rv *RecordVals) AsString() string

func (*RecordVals) AsStringArray added in v0.81.0

func (rv *RecordVals) AsStringArray() []string

func (*RecordVals) AsUint32 added in v0.81.0

func (rv *RecordVals) AsUint32() uint32

func (*RecordVals) AsUint64 added in v0.81.0

func (rv *RecordVals) AsUint64() uint64

func (*RecordVals) RawData

func (rv *RecordVals) RawData() []byte

func (*RecordVals) Release

func (rv *RecordVals) Release()

Release returns the insaneJSON root allocated in AsDoc back to the library's internal pool and invalidates the cache. It is idempotent: after the first call the cache is cleared, so repeated calls are a no-op. Calling it on a non-document val or a not-yet-decoded val is also a no-op. Safe to invoke from every executor that has touched the val — the first caller wins.

type Schema added in v0.81.0

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

Schema is an immutable ordered list of column descriptors.

func MustNewSchema added in v0.81.0

func MustNewSchema(cols ...ColumnDesc) *Schema

func NewSchema added in v0.81.0

func NewSchema(cols ...ColumnDesc) (*Schema, error)

func (*Schema) Cols added in v0.81.0

func (s *Schema) Cols() []ColumnDesc

Cols returns the column descriptors in schema order.

func (*Schema) Column added in v0.81.0

func (s *Schema) Column[T any](name string) (Column[T], error)

Column resolves the column by name. It fails when the column is absent or its declared type is incompatible with T.

func (*Schema) Equal added in v0.81.0

func (s *Schema) Equal(other *Schema) bool

Equal reports whether both schemas list identical (name, type) pairs in the same order.

func (*Schema) Extend added in v0.81.0

func (s *Schema) Extend(cols ...ColumnDesc) *Schema

Extend returns a new schema with the given columns appended. The original schema is untouched. Panics on duplicate names.

func (*Schema) Index added in v0.81.0

func (s *Schema) Index(name string) (int, error)

Index returns the index of the named column, or error if the column is absent.

func (*Schema) Len added in v0.81.0

func (s *Schema) Len() int

Len returns the number of columns.

func (*Schema) MustColumn added in v0.81.0

func (s *Schema) MustColumn[T any](name string) Column[T]

MustColumn resolves the column by name. Panics instead of returning an error.

type Summary

type Summary struct {
	Err   error
	Total uint64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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