queryplan

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: Apache-2.0 Imports: 9 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 queryplan compiles native SysML document queries into immutable plans.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsQueryDefinition

func IsQueryDefinition(index *symbols.Index, model *semantics.Model, sym *symbols.Symbol) bool

IsQueryDefinition reports whether sym specializes DocumentQueries::Query.

Types

type Argument

type Argument struct {
	Name  string
	Named bool
	Value Expression
}

Argument is one normalized invocation argument.

type Definition

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

Definition is one reusable query definition in a compiled program.

func (Definition) Dependencies

func (d Definition) Dependencies() []string

Dependencies returns the invoked query definitions in encounter order.

func (Definition) Expression

func (d Definition) Expression() Expression

Expression returns an independent copy of the compiled result expression.

func (Definition) Name

func (d Definition) Name() string

Name returns the definition's fully qualified name.

func (Definition) Origin

func (d Definition) Origin() provenance.Origin

Origin returns the definition's declaration location.

func (Definition) Parameters

func (d Definition) Parameters() []Parameter

Parameters returns the definition's ordered effective inputs.

func (Definition) Result

func (d Definition) Result() Parameter

Result returns the definition's typed result parameter.

type Error

type Error struct {
	Kind      ErrorKind
	Query     string
	Target    string
	Parameter string
	Path      []string
	Expected  string
	Actual    string
	Origin    provenance.Origin
}

Error is a typed query-planning failure with its source location.

func (*Error) Error

func (e *Error) Error() string

type ErrorKind

type ErrorKind string

ErrorKind classifies a query-planning failure.

const (
	ErrorInvalidContext         ErrorKind = "invalid-context"
	ErrorLibraryUnavailable     ErrorKind = "library-unavailable"
	ErrorNotQueryDefinition     ErrorKind = "not-query-definition"
	ErrorMissingResultParameter ErrorKind = "missing-result-parameter"
	ErrorInvalidParameter       ErrorKind = "invalid-parameter"
	ErrorMissingResult          ErrorKind = "missing-result"
	ErrorConflictingResult      ErrorKind = "conflicting-result"
	ErrorUnsupportedResult      ErrorKind = "unsupported-result"
	ErrorUnknownInvocation      ErrorKind = "unknown-invocation"
	ErrorPositionalQueryArgs    ErrorKind = "positional-query-arguments"
	ErrorDuplicateArgument      ErrorKind = "duplicate-argument"
	ErrorUnknownArgument        ErrorKind = "unknown-argument"
	ErrorMissingArgument        ErrorKind = "missing-argument"
	ErrorArgumentCount          ErrorKind = "argument-count"
	ErrorArgumentType           ErrorKind = "argument-type"
	ErrorArgumentMultiplicity   ErrorKind = "argument-multiplicity"
	ErrorCompositionCycle       ErrorKind = "composition-cycle"
	ErrorUnknownParameter       ErrorKind = "unknown-parameter"
	ErrorUnsupportedExpression  ErrorKind = "unsupported-expression"
	ErrorInvalidColumn          ErrorKind = "invalid-column"
	ErrorColumnName             ErrorKind = "column-name"
	ErrorUnknownColumnProperty  ErrorKind = "unknown-column-property"
	ErrorColumnOperator         ErrorKind = "column-operator"
	ErrorColumnType             ErrorKind = "column-type"
	ErrorDuplicateColumn        ErrorKind = "duplicate-column"
	ErrorEmptyProjection        ErrorKind = "empty-projection"
)

type Expression

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

Expression is one immutable node of a compiled query plan.

func (Expression) Arguments

func (e Expression) Arguments() []Argument

Arguments returns an independent copy of the expression's arguments.

func (Expression) Literal

func (e Expression) Literal() (LiteralKind, string)

Literal returns the kind and source value of a literal expression.

func (Expression) Operation

func (e Expression) Operation() Operation

Operation returns the operation this expression performs.

func (Expression) Origin

func (e Expression) Origin() provenance.Origin

Origin returns the source expression that produced this plan node.

func (Expression) Target

func (e Expression) Target() string

Target returns the parameter or query definition named by the expression.

type LiteralKind

type LiteralKind string

LiteralKind classifies a literal retained in a query plan.

const (
	LiteralString   LiteralKind = "string"
	LiteralInteger  LiteralKind = "integer"
	LiteralReal     LiteralKind = "real"
	LiteralBoolean  LiteralKind = "boolean"
	LiteralInfinity LiteralKind = "infinity"
	LiteralNull     LiteralKind = "null"
)

type Multiplicity

type Multiplicity struct {
	Lower         int64
	Upper         int64
	UpperInfinite bool
	Known         bool
}

Multiplicity is a query parameter's effective cardinality.

type Operation

type Operation string

Operation is one closed document-query planning operation.

const (
	OperationParameter       Operation = "parameter"
	OperationLiteral         Operation = "literal"
	OperationSequence        Operation = "sequence"
	OperationInvoke          Operation = "invoke"
	OperationOwnedElements   Operation = "owned-elements"
	OperationDescendants     Operation = "descendants"
	OperationAncestors       Operation = "ancestors"
	OperationRelatedElements Operation = "related-elements"
	OperationWhereType       Operation = "where-type"
	OperationWhereMetadata   Operation = "where-metadata"
	OperationWhereName       Operation = "where-name"
	OperationWhereFeature    Operation = "where-feature"
	OperationOrderBy         Operation = "order-by"
	OperationProject         Operation = "project"
	OperationColumn          Operation = "column"
	OperationRowProperty     Operation = "row-property"
	OperationColumnOperator  Operation = "column-operator"
)

type Parameter

type Parameter struct {
	Name         string
	Type         string
	Multiplicity Multiplicity
	HasDefault   bool
	Origin       provenance.Origin
}

Parameter is one typed query input or result.

type Program

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

Program is an immutable dependency-ordered query plan.

func Compile

func Compile(index *symbols.Index, model *semantics.Model, resolver *resolve.Resolver, entry *symbols.Symbol) (*Program, error)

Compile compiles entry and every query it invokes into dependency order.

func (*Program) Definitions

func (p *Program) Definitions() []Definition

Definitions returns dependencies before their consumers, each exactly once.

func (*Program) Entry

func (p *Program) Entry() string

Entry returns the fully qualified entry query name.

Jump to

Keyboard shortcuts

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