queryexec

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 17 Imported by: 0 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

Overview

Package queryexec executes immutable document-query plans.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bindings

type Bindings map[string][]Value

Bindings supplies named values to an entry query.

type Cell

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

Cell is one immutable projected value sequence.

func (Cell) Origin

func (c Cell) Origin() provenance.Origin

Origin returns the selected model element behind the cell.

func (Cell) Values

func (c Cell) Values() []Value

Values returns an independent copy of the cell values.

type Column

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

Column describes one ordered projected property.

func (Column) Name

func (c Column) Name() string

Name returns the projected property name.

func (Column) Origin

func (c Column) Origin() provenance.Origin

Origin returns the query expression that projected the column.

type Context

type Context struct {
	Index    *symbols.Index
	Resolver *resolve.Resolver
	Model    *semantics.Model
}

Context provides the semantic workspace used by one execution.

type Error

type Error struct {
	Kind      ErrorKind
	Query     string
	Operation queryplan.Operation
	Parameter string
	Property  string
	Target    string
	Path      []string
	Expected  string
	Actual    string
	Origin    provenance.Origin
	// Cause is the evaluator's reason an unevaluable feature could not be read.
	Cause error
}

Error is a typed query-execution failure with plan provenance.

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap added in v0.6.0

func (e *Error) Unwrap() error

type ErrorKind

type ErrorKind string

ErrorKind classifies a document-query execution failure.

const (
	ErrorInvalidContext        ErrorKind = "invalid-context"
	ErrorUnknownBinding        ErrorKind = "unknown-binding"
	ErrorMissingBinding        ErrorKind = "missing-binding"
	ErrorBindingType           ErrorKind = "binding-type"
	ErrorBindingMultiplicity   ErrorKind = "binding-multiplicity"
	ErrorMissingElement        ErrorKind = "missing-element"
	ErrorUnsupportedOperation  ErrorKind = "unsupported-operation"
	ErrorInvalidArgument       ErrorKind = "invalid-argument"
	ErrorInvalidOperator       ErrorKind = "invalid-operator"
	ErrorInvalidOrder          ErrorKind = "invalid-order"
	ErrorUnknownProperty       ErrorKind = "unknown-property"
	ErrorUnknownClassification ErrorKind = "unknown-classification"
	ErrorUnknownRelationship   ErrorKind = "unknown-relationship"
	ErrorUnevaluableFeature    ErrorKind = "unevaluable-feature"
	ErrorUnknownInvocation     ErrorKind = "unknown-invocation"
	ErrorInvocationCycle       ErrorKind = "invocation-cycle"
	ErrorInvocationDepth       ErrorKind = "invocation-depth"
	ErrorInvocationBudget      ErrorKind = "invocation-budget"
	ErrorVisitBudget           ErrorKind = "visit-budget"
	ErrorResultType            ErrorKind = "result-type"
	ErrorResultMultiplicity    ErrorKind = "result-multiplicity"
	ErrorColumnOperand         ErrorKind = "column-operand"
	ErrorColumnOperandType     ErrorKind = "column-operand-type"
	ErrorColumnDivisionByZero  ErrorKind = "column-division-by-zero"
	ErrorColumnIncommensurable ErrorKind = "column-incommensurable"
	ErrorColumnArithmetic      ErrorKind = "column-arithmetic"
	ErrorColumnAbsent          ErrorKind = "column-absent"
	ErrorColumnCardinality     ErrorKind = "column-cardinality"
)

type Options

type Options struct {
	VisitBudget      int
	InvocationDepth  int
	InvocationBudget int
}

Options controls bounded query execution.

type Row

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

Row retains the selected element and its ordered projected cells.

func (Row) Cells

func (r Row) Cells() []Cell

Cells returns an independent copy of the row's projected cells.

func (Row) Element

func (r Row) Element() Value

Element returns the selected element.

func (Row) Origin

func (r Row) Origin() provenance.Origin

Origin returns the selected element's declaration provenance.

type RowSet

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

RowSet is an immutable ordered query result.

func Execute

func Execute(program *queryplan.Program, context Context, bindings Bindings, options Options) (*RowSet, error)

Execute evaluates a compiled entry query into an immutable ordered row set.

func (*RowSet) Columns

func (r *RowSet) Columns() []Column

Columns returns an independent copy of the projected columns.

func (*RowSet) Origin

func (r *RowSet) Origin() provenance.Origin

Origin returns the entry query declaration.

func (*RowSet) Rows

func (r *RowSet) Rows() []Row

Rows returns an independent copy of the result rows.

type Value

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

Value is one immutable scalar carried through query execution.

func BooleanValue

func BooleanValue(value bool) Value

BooleanValue constructs a Boolean value.

func ElementValue

func ElementValue(sym *symbols.Symbol) Value

ElementValue constructs an element value with declaration provenance.

func IntegerValue

func IntegerValue(value int64) Value

IntegerValue constructs an integer value.

func QuantityValue added in v0.6.0

func QuantityValue(quantity semantics.Quantity) Value

QuantityValue constructs a quantity value from a magnitude in a unit; the quantity is deep-copied, so the value stays immutable.

func RealValue

func RealValue(value float64) Value

RealValue constructs a real value.

func StringValue

func StringValue(value string) Value

StringValue constructs a string value.

func (Value) Boolean

func (v Value) Boolean() (bool, bool)

Boolean returns the value's Boolean and whether it is a Boolean value.

func (Value) Element

func (v Value) Element() (*symbols.Symbol, bool)

Element returns the value's element and whether it is an element value.

func (Value) Integer

func (v Value) Integer() (int64, bool)

Integer returns the value's integer and whether it is an integer value.

func (Value) Kind

func (v Value) Kind() ValueKind

Kind returns the value's scalar kind.

func (Value) Magnitude added in v0.6.0

func (v Value) Magnitude() (Value, bool)

Magnitude returns a quantity value's magnitude as the bare integer or real value it is, and whether the value is a quantity.

func (Value) Origin

func (v Value) Origin() provenance.Origin

Origin returns the source declaration behind the value.

func (Value) Quantity added in v0.6.0

func (v Value) Quantity() (semantics.Quantity, bool)

Quantity returns an independent copy of the value's quantity and whether it is a quantity value.

func (Value) Real

func (v Value) Real() (float64, bool)

Real returns the value's real and whether it is a real value.

func (Value) String

func (v Value) String() (string, bool)

String returns the value's string and whether it is a string value.

type ValueKind

type ValueKind string

ValueKind classifies one scalar query value.

const (
	ValueElement  ValueKind = "element"
	ValueString   ValueKind = "string"
	ValueInteger  ValueKind = "integer"
	ValueReal     ValueKind = "real"
	ValueBoolean  ValueKind = "boolean"
	ValueInfinity ValueKind = "infinity"
	// ValueQuantity is a magnitude in a measurement unit, `2290000 [kg]`.
	ValueQuantity ValueKind = "quantity"
)

Jump to

Keyboard shortcuts

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