Documentation
¶
Overview ¶
Package queryplan compiles native SysML document queries into immutable plans.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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.
type ErrorKind ¶
type ErrorKind string
ErrorKind classifies a query-planning failure.
const ( ErrorInvalidContext ErrorKind = "invalid-context" 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" )
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 ¶
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" )
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.