rules package reference
Package path: github.com/cpcf/gess/rules
Constants
Section titled “Constants”const ( FieldConstraintOpUnknown FieldConstraintOperator = "" FieldConstraintOpExists FieldConstraintOperator = "exists" FieldConstraintOpEqual FieldConstraintOperator = "eq" FieldConstraintOpNotEqual FieldConstraintOperator = "neq" FieldConstraintOpLessThan FieldConstraintOperator = "lt" FieldConstraintOpLessOrEqual FieldConstraintOperator = "lte" FieldConstraintOpGreaterThan FieldConstraintOperator = "gt" FieldConstraintOpGreaterOrEqual FieldConstraintOperator = "gte"
FieldConstraintExists = FieldConstraintOpExists FieldConstraintEqual = FieldConstraintOpEqual FieldConstraintNotEqual = FieldConstraintOpNotEqual FieldConstraintLessThan = FieldConstraintOpLessThan FieldConstraintLessOrEqual = FieldConstraintOpLessOrEqual FieldConstraintGreaterThan = FieldConstraintOpGreaterThan FieldConstraintGreaterOrEqual = FieldConstraintOpGreaterOrEqual)Variables
Section titled “Variables”var ( ErrInvalidRuleset = errors.New("gess: invalid ruleset") ErrIncompatibleRuleset = errors.New("gess: incompatible ruleset") ErrClosedSession = errors.New("gess: closed session") ErrConcurrencyMisuse = errors.New("gess: concurrency misuse") ErrActionFailed = errors.New("gess: action failed") ErrValidation = errors.New("gess: validation failed") ErrFactNotFound = errors.New("gess: fact not found") ErrStaleFactID = errors.New("gess: stale fact id") ErrDuplicateFact = errors.New("gess: duplicate fact") ErrMatcher = errors.New("gess: matcher error") ErrUnsupportedRuntime = errors.New("gess: unsupported runtime") ErrInvalidPath = errors.New("gess: invalid path") ErrInvalidListPattern = errors.New("gess: invalid list pattern") ErrInvalidHigherOrderCondition = errors.New("gess: invalid higher-order condition") ErrAggregateValidation = errors.New("gess: aggregate validation failed") ErrAggregateEvaluation = errors.New("gess: aggregate evaluation failed") ErrFunctionValidation = errors.New("gess: function validation failed") ErrFunctionEvaluation = errors.New("gess: function evaluation failed") ErrQueryNotFound = errors.New("gess: query not found") ErrQueryArgument = errors.New("gess: query argument failed") ErrQueryValidation = errors.New("gess: query validation failed") ErrQueryExecution = errors.New("gess: query execution failed") ErrLogicalSupportUnavailable = errors.New("gess: logical support unavailable") ErrLogicalOnlyRetract = errors.New("gess: cannot retract logical-only fact") ErrLogicalFactModify = errors.New("gess: cannot modify fact with logical support") ErrDivideByZero = errors.New("gess: divide by zero") ErrBuiltinArgument = errors.New("gess: built-in function argument error") ErrExplainLogUnavailable = errors.New("gess: explain log unavailable") ErrRuleNotFound = errors.New("gess: rule not found") ErrDemandCascadeLimit = errors.New("gess: backchain demand cascade limit exceeded") ErrFactLimit = errors.New("gess: session fact limit exceeded") ErrUnsupportedValue = errors.New("gess: unsupported value") ErrInvalidCheckpoint = errors.New("gess: invalid checkpoint") ErrUnsupportedCheckpointVersion = errors.New("gess: unsupported checkpoint version") ErrInvalidMutationLog = errors.New("gess: invalid mutation log") ErrUnsupportedMutationLogVersion = errors.New("gess: unsupported mutation log version"))AccumulateCondition
Section titled “AccumulateCondition”AccumulateCondition maintains aggregate results over matching input facts.
type AccumulateCondition struct { Input ConditionSpec Specs []AggregateSpec Source SourceSpan}Accumulate
Section titled “Accumulate”Accumulate builds an AccumulateCondition.
func Accumulate(input ConditionSpec, specs ...AggregateSpec) AccumulateConditionCloneAccumulateCondition
Section titled “CloneAccumulateCondition”CloneAccumulateCondition returns a defensive copy of s.
func CloneAccumulateCondition(s AccumulateCondition) AccumulateConditionAction
Section titled “Action”Action is a compiled, inspectable action reference on a rule or query.
type Action struct { NameValue string Order int GessSourceText string AssertTemplateValuesAction *AssertTemplateValuesActionSpec}CloneAction
Section titled “CloneAction”CloneAction returns a defensive copy of a.
func CloneAction(a Action) ActionAction.AssertTemplateValues
Section titled “Action.AssertTemplateValues”func (a Action) AssertTemplateValues() (*AssertTemplateValuesActionSpec, bool)Action.DeclarationOrder
Section titled “Action.DeclarationOrder”func (a Action) DeclarationOrder() intAction.GessSource
Section titled “Action.GessSource”func (a Action) GessSource() stringAction.Name
Section titled “Action.Name”func (a Action) Name() stringActionBindingReadSetSpec
Section titled “ActionBindingReadSetSpec”ActionBindingReadSetSpec declares which bindings an action reads.
type ActionBindingReadSetSpec struct { Reads []ActionBindingReadSpec}CloneActionBindingReadSetSpec
Section titled “CloneActionBindingReadSetSpec”CloneActionBindingReadSetSpec returns a defensive copy of s.
func CloneActionBindingReadSetSpec(s *ActionBindingReadSetSpec) *ActionBindingReadSetSpecActionBindingReadSpec
Section titled “ActionBindingReadSpec”ActionBindingReadSpec declares one binding an action reads.
type ActionBindingReadSpec struct { Binding string Field string Path PathSpec}CloneActionBindingReadSpec
Section titled “CloneActionBindingReadSpec”CloneActionBindingReadSpec returns a defensive copy of s.
func CloneActionBindingReadSpec(s ActionBindingReadSpec) ActionBindingReadSpecActionCallSpec
Section titled “ActionCallSpec”ActionCallSpec is a host-function call action.
type ActionCallSpec struct { Name string Fn DSLCallFunc Args []ExpressionSpec}CloneActionCallSpec
Section titled “CloneActionCallSpec”CloneActionCallSpec returns a defensive copy of s.
func CloneActionCallSpec(s *ActionCallSpec) *ActionCallSpecActionContext
Section titled “ActionContext”ActionContext is passed to an ActionFunc. It exposes the activation’s identity and generation, read access to bound facts and values, and the mutation API.
type ActionContext struct { // contains filtered or unexported fields}NewActionContext
Section titled “NewActionContext”NewActionContext returns an ActionContext backed by handle.
func NewActionContext(handle ActionContextHandle) ActionContextActionContext.ActivationID
Section titled “ActionContext.ActivationID”func (c ActionContext) ActivationID() ActivationIDActionContext.Assert
Section titled “ActionContext.Assert”func (c ActionContext) Assert(templateKey TemplateKey, fields Fields) (AssertResult, error)ActionContext.AssertLogical
Section titled “ActionContext.AssertLogical”func (c ActionContext) AssertLogical(templateKey TemplateKey, fields Fields) (AssertResult, error)ActionContext.AssertTemplateValues
Section titled “ActionContext.AssertTemplateValues”func (c ActionContext) AssertTemplateValues(templateKey TemplateKey, values ...Value) errorActionContext.Binding
Section titled “ActionContext.Binding”func (c ActionContext) Binding(name string) (FactSnapshot, bool)ActionContext.BindingID
Section titled “ActionContext.BindingID”func (c ActionContext) BindingID(name string) (FactID, bool)ActionContext.BindingScalarValue
Section titled “ActionContext.BindingScalarValue”func (c ActionContext) BindingScalarValue(name, field string) (Value, bool)ActionContext.BindingValue
Section titled “ActionContext.BindingValue”func (c ActionContext) BindingValue(name string) (Value, bool)ActionContext.BoundFacts
Section titled “ActionContext.BoundFacts”func (c ActionContext) BoundFacts() []FactSnapshotActionContext.ClearFocusStack
Section titled “ActionContext.ClearFocusStack”func (c ActionContext) ClearFocusStack() errorActionContext.Context
Section titled “ActionContext.Context”func (c ActionContext) Context() context.ContextActionContext.Emit
Section titled “ActionContext.Emit”func (c ActionContext) Emit(values ...Value) errorActionContext.Generation
Section titled “ActionContext.Generation”func (c ActionContext) Generation() GenerationActionContext.Global
Section titled “ActionContext.Global”func (c ActionContext) Global(name string) (Value, bool)ActionContext.Halt
Section titled “ActionContext.Halt”func (c ActionContext) Halt() errorActionContext.Modify
Section titled “ActionContext.Modify”func (c ActionContext) Modify(id FactID, patch FactPatch) (ModifyResult, error)ActionContext.PopFocus
Section titled “ActionContext.PopFocus”func (c ActionContext) PopFocus() (ModuleName, error)ActionContext.PushFocus
Section titled “ActionContext.PushFocus”func (c ActionContext) PushFocus(module ModuleName) errorActionContext.RHSBind
Section titled “ActionContext.RHSBind”func (c ActionContext) RHSBind(name string) (Value, bool)ActionContext.Retract
Section titled “ActionContext.Retract”func (c ActionContext) Retract(id FactID) (RetractResult, error)ActionContext.RuleID
Section titled “ActionContext.RuleID”func (c ActionContext) RuleID() RuleIDActionContext.RuleRevisionID
Section titled “ActionContext.RuleRevisionID”func (c ActionContext) RuleRevisionID() RuleRevisionIDActionContext.RulesetID
Section titled “ActionContext.RulesetID”func (c ActionContext) RulesetID() RulesetIDActionContext.SessionID
Section titled “ActionContext.SessionID”func (c ActionContext) SessionID() SessionIDActionContext.SetFocus
Section titled “ActionContext.SetFocus”func (c ActionContext) SetFocus(module ModuleName) errorActionContext.SetRHSBind
Section titled “ActionContext.SetRHSBind”func (c ActionContext) SetRHSBind(name string, value Value)ActionContextHandle
Section titled “ActionContextHandle”ActionContextHandle is the runtime implementation behind ActionContext.
type ActionContextHandle interface { SetRHSBind(name string, value Value) RHSBind(name string) (Value, bool) Context() context.Context SessionID() SessionID RulesetID() RulesetID ActivationID() ActivationID RuleID() RuleID RuleRevisionID() RuleRevisionID Generation() Generation BoundFacts() []FactSnapshot Binding(name string) (FactSnapshot, bool) BindingID(name string) (FactID, bool) BindingValue(name string) (Value, bool) BindingScalarValue(name, field string) (Value, bool) Global(name string) (Value, bool) Assert(templateKey TemplateKey, fields Fields) (AssertResult, error) AssertLogical(templateKey TemplateKey, fields Fields) (AssertResult, error) AssertTemplateValues(templateKey TemplateKey, values ...Value) error Modify(id FactID, patch FactPatch) (ModifyResult, error) Retract(id FactID) (RetractResult, error) Halt() error Emit(values ...Value) error PushFocus(module ModuleName) error SetFocus(module ModuleName) error PopFocus() (ModuleName, error) ClearFocusStack() error}ActionContextHandleOf
Section titled “ActionContextHandleOf”ActionContextHandleOf returns the engine-owned implementation behind c.
func ActionContextHandleOf(c ActionContext) ActionContextHandleActionEffectKind
Section titled “ActionEffectKind”ActionEffectKind identifies the mutation an ActionEffectSpec performs.
type ActionEffectKind uint8ActionEffectAssert, ActionEffectAssertLogical, ActionEffectModify, ActionEffectRetract, ActionEffectEmit, ActionEffectBind, ActionEffectPushFocus, ActionEffectPopFocus, ActionEffectClearFocus, ActionEffectHalt
Section titled “ActionEffectAssert, ActionEffectAssertLogical, ActionEffectModify, ActionEffectRetract, ActionEffectEmit, ActionEffectBind, ActionEffectPushFocus, ActionEffectPopFocus, ActionEffectClearFocus, ActionEffectHalt”const ( ActionEffectAssert ActionEffectKind = iota ActionEffectAssertLogical ActionEffectModify ActionEffectRetract ActionEffectEmit ActionEffectBind ActionEffectPushFocus ActionEffectPopFocus ActionEffectClearFocus ActionEffectHalt)ActionEffectSpec
Section titled “ActionEffectSpec”ActionEffectSpec is a declarative, expression-backed rule action.
type ActionEffectSpec struct { Kind ActionEffectKind // Target is the fact-binding name for modify/retract, or the local name // for bind. Unused by emit. Target string // TemplateKey/FactName identify the asserted template for assert/-logical. TemplateKey TemplateKey FactName string // Fields names the slots set by assert/modify, parallel to Values. Fields []string // Unset names the slots cleared by modify. Unset []string // Values are the expression-valued operands. Values []ExpressionSpec}CloneActionEffectSpec
Section titled “CloneActionEffectSpec”CloneActionEffectSpec returns a defensive copy of s.
func CloneActionEffectSpec(s *ActionEffectSpec) *ActionEffectSpecActionFunc
Section titled “ActionFunc”ActionFunc is the Go implementation of a rule or query action.
type ActionFunc func(ActionContext) errorActionSpec
Section titled “ActionSpec”ActionSpec names one action implementation registered on a workspace.
type ActionSpec struct { Name string Fn ActionFunc AssertTemplateValues *AssertTemplateValuesActionSpec Effect *ActionEffectSpec Call *ActionCallSpec BindingReads *ActionBindingReadSetSpec GessSource string // NonEscaping allows the engine to skip freezing unread bindings after a // rule fires. Set it only when Fn does not retain ActionContext or any // binding-derived data that depends on post-return defensive snapshots. NonEscaping bool}CloneActionSpec
Section titled “CloneActionSpec”CloneActionSpec returns a defensive copy of s.
func CloneActionSpec(s ActionSpec) ActionSpecActivationID
Section titled “ActivationID”ActivationID identifies one activation: a rule paired with the specific facts that matched it.
type ActivationID stringActivationID.IsZero
Section titled “ActivationID.IsZero”func (id ActivationID) IsZero() boolActivationID.String
Section titled “ActivationID.String”func (id ActivationID) String() stringAggregateKind
Section titled “AggregateKind”AggregateKind identifies which aggregate an AggregateSpec computes.
type AggregateKind stringAggregateCount, AggregateSum, AggregateMin, AggregateMax, AggregateCollect
Section titled “AggregateCount, AggregateSum, AggregateMin, AggregateMax, AggregateCollect”const ( AggregateCount AggregateKind = "count" AggregateSum AggregateKind = "sum" AggregateMin AggregateKind = "min" AggregateMax AggregateKind = "max" AggregateCollect AggregateKind = "collect")AggregateSpec
Section titled “AggregateSpec”AggregateSpec is one aggregate computed over facts matching an accumulate input.
type AggregateSpec struct { KindValue AggregateKind ExpressionSpec ExpressionSpec BindingName string}CloneAggregateSpec
Section titled “CloneAggregateSpec”CloneAggregateSpec returns a defensive copy of s.
func CloneAggregateSpec(s AggregateSpec) AggregateSpecCollect
Section titled “Collect”Collect aggregates expression’s value from every matching fact into a list.
func Collect(expression ExpressionSpec) AggregateSpecCount aggregates to the number of matching facts.
func Count() AggregateSpecMax aggregates to the running maximum of expression over the group.
func Max(expression ExpressionSpec) AggregateSpecMin aggregates to the running minimum of expression over the group.
func Min(expression ExpressionSpec) AggregateSpecSum aggregates to the running sum of expression over the group.
func Sum(expression ExpressionSpec) AggregateSpecAggregateSpec.As
Section titled “AggregateSpec.As”func (s AggregateSpec) As(binding string) AggregateSpecAggregateSpec.Binding
Section titled “AggregateSpec.Binding”func (s AggregateSpec) Binding() stringAggregateSpec.Expression
Section titled “AggregateSpec.Expression”func (s AggregateSpec) Expression() ExpressionSpecAggregateSpec.Kind
Section titled “AggregateSpec.Kind”func (s AggregateSpec) Kind() AggregateKindAnd groups condition tree nodes into a conjunction.
type And struct { Conditions []ConditionSpec Source SourceSpan}ApplyRulesetStatus
Section titled “ApplyRulesetStatus”ApplyRulesetStatus is the outcome of applying a ruleset to a session.
type ApplyRulesetStatus stringApplyRulesetApplied, ApplyRulesetUnchanged, ApplyRulesetIncompatible, ApplyRulesetClosed, ApplyRulesetConcurrencyMisuse
Section titled “ApplyRulesetApplied, ApplyRulesetUnchanged, ApplyRulesetIncompatible, ApplyRulesetClosed, ApplyRulesetConcurrencyMisuse”const ( ApplyRulesetApplied ApplyRulesetStatus = "applied" ApplyRulesetUnchanged ApplyRulesetStatus = "unchanged" ApplyRulesetIncompatible ApplyRulesetStatus = "incompatible" ApplyRulesetClosed ApplyRulesetStatus = "closed" ApplyRulesetConcurrencyMisuse ApplyRulesetStatus = "concurrency_misuse")AssertResult
Section titled “AssertResult”AssertResult reports the outcome of an assert.
type AssertResult struct { Status AssertStatus Fact FactSnapshot DuplicateKey DuplicateKey Delta *MutationDelta}CloneAssertResult
Section titled “CloneAssertResult”CloneAssertResult returns a defensive copy of result.
func CloneAssertResult(result AssertResult) AssertResultAssertResult.Inserted
Section titled “AssertResult.Inserted”Inserted reports whether the assert inserted a new fact.
func (r AssertResult) Inserted() boolAssertStatus
Section titled “AssertStatus”AssertStatus is the outcome of an assert.
type AssertStatus stringAssertInserted, AssertExisting, AssertReplaced, AssertValidationFailure, AssertClosed, AssertConcurrencyMisuse
Section titled “AssertInserted, AssertExisting, AssertReplaced, AssertValidationFailure, AssertClosed, AssertConcurrencyMisuse”const ( AssertInserted AssertStatus = "inserted" AssertExisting AssertStatus = "existing" AssertReplaced AssertStatus = "replaced" AssertValidationFailure AssertStatus = "validation_failure" AssertClosed AssertStatus = "closed" AssertConcurrencyMisuse AssertStatus = "concurrency_misuse")AssertTemplateValuesActionSpec
Section titled “AssertTemplateValuesActionSpec”AssertTemplateValuesActionSpec describes a generated rule action that emits values in template field order.
type AssertTemplateValuesActionSpec struct { TemplateKey TemplateKey Values []ExpressionSpec}CloneAssertTemplateValuesActionSpec
Section titled “CloneAssertTemplateValuesActionSpec”CloneAssertTemplateValuesActionSpec returns a defensive copy of s.
func CloneAssertTemplateValuesActionSpec(s *AssertTemplateValuesActionSpec) *AssertTemplateValuesActionSpecBindingFieldExpr
Section titled “BindingFieldExpr”BindingFieldExpr references a field, or nested path, of an earlier condition’s binding.
type BindingFieldExpr struct { Binding string Field string Path PathSpec}BindingPath
Section titled “BindingPath”BindingPath builds a BindingFieldExpr referencing an earlier condition’s binding through path.
func BindingPath(binding string, path PathSpec) BindingFieldExprBindingValueExpr
Section titled “BindingValueExpr”BindingValueExpr references a value binding, such as an aggregate result, from an earlier condition.
type BindingValueExpr struct { Binding string}BooleanExpr
Section titled “BooleanExpr”BooleanExpr combines Operands with Operator.
type BooleanExpr struct { Operator ExpressionBooleanOperator Operands []ExpressionSpec}CallExpr
Section titled “CallExpr”CallExpr invokes a registered pure function by name with Args.
type CallExpr struct { Name string Args []ExpressionSpec}Call builds a CallExpr invoking the registered pure function name with args.
func Call(name string, args ...ExpressionSpec) CallExprCompareExpr
Section titled “CompareExpr”CompareExpr compares Left and Right with Operator.
type CompareExpr struct { Operator ExpressionComparisonOperator Left ExpressionSpec Right ExpressionSpec}ConditionID
Section titled “ConditionID”ConditionID is a compiled rule or query condition’s stable identity.
type ConditionID stringConditionID.IsZero
Section titled “ConditionID.IsZero”func (id ConditionID) IsZero() boolConditionID.String
Section titled “ConditionID.String”func (id ConditionID) String() stringConditionSpec
Section titled “ConditionSpec”ConditionSpec is a rule or query left-hand-side condition tree node.
type ConditionSpec interface { // contains filtered or unexported methods}CloneConditionSpec
Section titled “CloneConditionSpec”CloneConditionSpec returns a defensive copy of spec.
func CloneConditionSpec(spec ConditionSpec) ConditionSpecConditionTreeKind
Section titled “ConditionTreeKind”ConditionTreeKind identifies the shape of a RuleConditionTree node.
type ConditionTreeKind stringConditionTreeKindUnknown, ConditionTreeKindAnd, ConditionTreeKindMatch, ConditionTreeKindTest, ConditionTreeKindNot, ConditionTreeKindOr, ConditionTreeKindExists, ConditionTreeKindForall, ConditionTreeKindAccumulate
Section titled “ConditionTreeKindUnknown, ConditionTreeKindAnd, ConditionTreeKindMatch, ConditionTreeKindTest, ConditionTreeKindNot, ConditionTreeKindOr, ConditionTreeKindExists, ConditionTreeKindForall, ConditionTreeKindAccumulate”const ( ConditionTreeKindUnknown ConditionTreeKind = "" ConditionTreeKindAnd ConditionTreeKind = "and" ConditionTreeKindMatch ConditionTreeKind = "match" ConditionTreeKindTest ConditionTreeKind = "test" ConditionTreeKindNot ConditionTreeKind = "not" ConditionTreeKindOr ConditionTreeKind = "or" ConditionTreeKindExists ConditionTreeKind = "exists" ConditionTreeKindForall ConditionTreeKind = "forall" ConditionTreeKindAccumulate ConditionTreeKind = "accumulate")ConstExpr
Section titled “ConstExpr”ConstExpr is a literal value in an expression tree.
type ConstExpr struct { Value any}CurrentFieldExpr
Section titled “CurrentFieldExpr”CurrentFieldExpr references a field, or nested path, of the fact matched by the current condition.
type CurrentFieldExpr struct { Field string Path PathSpec}CurrentPath
Section titled “CurrentPath”CurrentPath builds a CurrentFieldExpr referencing the current condition’s fact through path.
func CurrentPath(path PathSpec) CurrentFieldExprDSLCallFunc
Section titled “DSLCallFunc”DSLCallFunc is a host-provided action call implementation.
type DSLCallFunc func(ActionContext, []Value) errorDemandCascadeLimitError
Section titled “DemandCascadeLimitError”DemandCascadeLimitError reports that a session stopped a backward-chaining demand cascade before processing another demand request.
type DemandCascadeLimitError struct { Limit int Steps int}*DemandCascadeLimitError.Error
Section titled “*DemandCascadeLimitError.Error”func (e *DemandCascadeLimitError) Error() string*DemandCascadeLimitError.Is
Section titled “*DemandCascadeLimitError.Is”func (e *DemandCascadeLimitError) Is(target error) bool*DemandCascadeLimitError.Unwrap
Section titled “*DemandCascadeLimitError.Unwrap”func (e *DemandCascadeLimitError) Unwrap() errorDuplicateKey
Section titled “DuplicateKey”DuplicateKey is the computed duplicate-detection key for a fact.
type DuplicateKey stringDuplicatePolicy
Section titled “DuplicatePolicy”DuplicatePolicy controls how a template deduplicates facts.
type DuplicatePolicy intDuplicateStructural, DuplicateAllow, DuplicateUniqueKey
Section titled “DuplicateStructural, DuplicateAllow, DuplicateUniqueKey”const ( DuplicateStructural DuplicatePolicy = iota DuplicateAllow DuplicateUniqueKey)ExistsCondition
Section titled “ExistsCondition”ExistsCondition tests whether at least one tuple matching Condition exists.
type ExistsCondition struct { Condition ConditionSpec Source SourceSpan}Exists
Section titled “Exists”Exists builds an ExistsCondition.
func Exists(condition ConditionSpec) ExistsConditionExplicit
Section titled “Explicit”Explicit marks a positive match as ineligible for backward-chaining demand generation while keeping ordinary match behavior unchanged.
type Explicit struct { Condition ConditionSpec Source SourceSpan}ExpressionBooleanOperator
Section titled “ExpressionBooleanOperator”ExpressionBooleanOperator is the operator in a BooleanExpr.
type ExpressionBooleanOperator stringExpressionBoolUnknown, ExpressionBoolAnd, ExpressionBoolOr, ExpressionBoolNot
Section titled “ExpressionBoolUnknown, ExpressionBoolAnd, ExpressionBoolOr, ExpressionBoolNot”const ( ExpressionBoolUnknown ExpressionBooleanOperator = "" ExpressionBoolAnd ExpressionBooleanOperator = "and" ExpressionBoolOr ExpressionBooleanOperator = "or" ExpressionBoolNot ExpressionBooleanOperator = "not")ExpressionComparisonOperator
Section titled “ExpressionComparisonOperator”ExpressionComparisonOperator is the operator in a CompareExpr.
type ExpressionComparisonOperator stringExpressionCompareUnknown, ExpressionCompareEqual, ExpressionCompareNotEqual, ExpressionCompareLessThan, ExpressionCompareLessOrEqual, ExpressionCompareGreaterThan, ExpressionCompareGreaterOrEqual
Section titled “ExpressionCompareUnknown, ExpressionCompareEqual, ExpressionCompareNotEqual, ExpressionCompareLessThan, ExpressionCompareLessOrEqual, ExpressionCompareGreaterThan, ExpressionCompareGreaterOrEqual”const ( ExpressionCompareUnknown ExpressionComparisonOperator = "" ExpressionCompareEqual ExpressionComparisonOperator = "eq" ExpressionCompareNotEqual ExpressionComparisonOperator = "neq" ExpressionCompareLessThan ExpressionComparisonOperator = "lt" ExpressionCompareLessOrEqual ExpressionComparisonOperator = "lte" ExpressionCompareGreaterThan ExpressionComparisonOperator = "gt" ExpressionCompareGreaterOrEqual ExpressionComparisonOperator = "gte")ExpressionFunctionParamSpec
Section titled “ExpressionFunctionParamSpec”ExpressionFunctionParamSpec declares one named, typed parameter of an expression-backed function.
type ExpressionFunctionParamSpec struct { Name string Kind ValueKind}ExpressionFunctionSpec
Section titled “ExpressionFunctionSpec”ExpressionFunctionSpec defines a pure function whose body is an expression.
type ExpressionFunctionSpec struct { Name string Params []ExpressionFunctionParamSpec Return ValueKind Expression ExpressionSpec Description string Source SourceSpan}CloneExpressionFunctionSpec
Section titled “CloneExpressionFunctionSpec”CloneExpressionFunctionSpec returns a defensive copy of s.
func CloneExpressionFunctionSpec(s ExpressionFunctionSpec) ExpressionFunctionSpecExpressionPredicate
Section titled “ExpressionPredicate”ExpressionPredicate wraps a compiled predicate for inspection.
type ExpressionPredicate struct { ExpressionSpec ExpressionSpec PlacementValue ExpressionPredicatePlacement Order int SourceSpan SourceSpan}CloneExpressionPredicate
Section titled “CloneExpressionPredicate”CloneExpressionPredicate returns a defensive copy of p.
func CloneExpressionPredicate(p ExpressionPredicate) ExpressionPredicateCloneExpressionPredicates
Section titled “CloneExpressionPredicates”CloneExpressionPredicates returns a defensive copy of predicates.
func CloneExpressionPredicates(predicates []ExpressionPredicate) []ExpressionPredicateExpressionPredicate.DeclarationOrder
Section titled “ExpressionPredicate.DeclarationOrder”func (p ExpressionPredicate) DeclarationOrder() intExpressionPredicate.Expression
Section titled “ExpressionPredicate.Expression”func (p ExpressionPredicate) Expression() ExpressionSpecExpressionPredicate.Placement
Section titled “ExpressionPredicate.Placement”func (p ExpressionPredicate) Placement() ExpressionPredicatePlacementExpressionPredicate.Source
Section titled “ExpressionPredicate.Source”func (p ExpressionPredicate) Source() SourceSpanExpressionPredicatePlacement
Section titled “ExpressionPredicatePlacement”ExpressionPredicatePlacement reports where the compiler placed a predicate.
type ExpressionPredicatePlacement stringExpressionPredicatePlacementUnknown, ExpressionPredicatePlacementAlpha, ExpressionPredicatePlacementBetaResidual, ExpressionPredicatePlacementUnsupported
Section titled “ExpressionPredicatePlacementUnknown, ExpressionPredicatePlacementAlpha, ExpressionPredicatePlacementBetaResidual, ExpressionPredicatePlacementUnsupported”const ( ExpressionPredicatePlacementUnknown ExpressionPredicatePlacement = "" ExpressionPredicatePlacementAlpha ExpressionPredicatePlacement = "alpha" ExpressionPredicatePlacementBetaResidual ExpressionPredicatePlacement = "beta-residual" ExpressionPredicatePlacementUnsupported ExpressionPredicatePlacement = "unsupported")ExpressionSpec
Section titled “ExpressionSpec”ExpressionSpec is a deterministic rule predicate expression tree node.
type ExpressionSpec interface { // contains filtered or unexported methods}CloneExpressionSpec
Section titled “CloneExpressionSpec”CloneExpressionSpec returns a defensive copy of spec when it is one of the built-in expression spec nodes.
func CloneExpressionSpec(spec ExpressionSpec) ExpressionSpecFactID
Section titled “FactID”FactID identifies a fact, stable across modifies within a generation.
type FactID struct { // contains filtered or unexported fields}NewFactID
Section titled “NewFactID”NewFactID constructs a FactID for engine-owned fact allocation and tests.
func NewFactID(generation Generation, sequence uint64) FactIDFactID.Generation
Section titled “FactID.Generation”func (id FactID) Generation() GenerationFactID.IsZero
Section titled “FactID.IsZero”func (id FactID) IsZero() boolFactID.Sequence
Section titled “FactID.Sequence”func (id FactID) Sequence() uint64FactID.String
Section titled “FactID.String”func (id FactID) String() stringFactLimitError
Section titled “FactLimitError”FactLimitError reports that a session refused to retain another fact.
type FactLimitError struct { Limit int Facts int}*FactLimitError.Error
Section titled “*FactLimitError.Error”func (e *FactLimitError) Error() string*FactLimitError.Is
Section titled “*FactLimitError.Is”func (e *FactLimitError) Is(target error) bool*FactLimitError.Unwrap
Section titled “*FactLimitError.Unwrap”func (e *FactLimitError) Unwrap() errorFactPatch
Section titled “FactPatch”FactPatch describes a fact modification: Set overwrites the named fields and Unset clears the named fields, restoring their template defaults.
type FactPatch struct { Set Fields Unset []string}FactSnapshot
Section titled “FactSnapshot”FactSnapshot is an immutable, detached view of one fact’s identity, fields, and support state.
type FactSnapshot struct { IDValue FactID NameValue string TemplateKeyValue TemplateKey VersionValue FactVersion RecencyValue Recency GenerationValue Generation FieldValues Fields FieldPresenceValues map[string]FieldPresence SupportValue FactSupportProvenance}CloneFactSnapshot
Section titled “CloneFactSnapshot”CloneFactSnapshot returns a defensive copy of f.
func CloneFactSnapshot(f FactSnapshot) FactSnapshotCloneFactSnapshotPtr
Section titled “CloneFactSnapshotPtr”CloneFactSnapshotPtr returns a defensive copy of f when non-nil.
func CloneFactSnapshotPtr(f *FactSnapshot) *FactSnapshotCloneFactSnapshots
Section titled “CloneFactSnapshots”CloneFactSnapshots returns a defensive copy of facts.
func CloneFactSnapshots(facts []FactSnapshot) []FactSnapshotFactSnapshot.Field
Section titled “FactSnapshot.Field”Field returns one field value by name.
func (f FactSnapshot) Field(name string) (Value, bool)FactSnapshot.FieldPresence
Section titled “FactSnapshot.FieldPresence”FieldPresence returns whether a template field was defaulted, explicit, or omitted.
func (f FactSnapshot) FieldPresence(field string) (FieldPresence, bool)FactSnapshot.FieldPresenceMap
Section titled “FactSnapshot.FieldPresenceMap”FieldPresenceMap returns template field-presence metadata keyed by field name.
func (f FactSnapshot) FieldPresenceMap() map[string]FieldPresenceFactSnapshot.Fields
Section titled “FactSnapshot.Fields”Fields returns a copy of the fact’s field values.
func (f FactSnapshot) Fields() FieldsFactSnapshot.Generation
Section titled “FactSnapshot.Generation”Generation returns the working-memory generation that owns this fact.
func (f FactSnapshot) Generation() GenerationFactSnapshot.ID
Section titled “FactSnapshot.ID”ID returns the fact identity.
func (f FactSnapshot) ID() FactIDFactSnapshot.Name
Section titled “FactSnapshot.Name”Name returns the dynamic fact name, if the fact is not template-backed.
func (f FactSnapshot) Name() stringFactSnapshot.Path
Section titled “FactSnapshot.Path”Path returns the value at path, if present.
func (f FactSnapshot) Path(path PathSpec) (Value, bool, error)FactSnapshot.Recency
Section titled “FactSnapshot.Recency”Recency returns the mutation recency that ordered this fact.
func (f FactSnapshot) Recency() RecencyFactSnapshot.String
Section titled “FactSnapshot.String”func (f FactSnapshot) String() stringFactSnapshot.Support
Section titled “FactSnapshot.Support”Support returns the fact’s logical support classification.
func (f FactSnapshot) Support() FactSupportProvenanceFactSnapshot.TemplateKey
Section titled “FactSnapshot.TemplateKey”TemplateKey returns the template identity, if the fact is template-backed.
func (f FactSnapshot) TemplateKey() TemplateKeyFactSnapshot.Version
Section titled “FactSnapshot.Version”Version returns the fact version.
func (f FactSnapshot) Version() FactVersionFactSupportProvenance
Section titled “FactSupportProvenance”FactSupportProvenance is a fact’s support classification.
type FactSupportProvenance struct { State FactSupportState}FactSupportState
Section titled “FactSupportState”FactSupportState classifies how a fact is supported.
type FactSupportState stringFactSupportStated, FactSupportLogical, FactSupportStatedAndLogical, FactSupportMetadataOnly
Section titled “FactSupportStated, FactSupportLogical, FactSupportStatedAndLogical, FactSupportMetadataOnly”const ( FactSupportStated FactSupportState = "stated" FactSupportLogical FactSupportState = "logical" FactSupportStatedAndLogical FactSupportState = "stated_and_logical" FactSupportMetadataOnly FactSupportState = "metadata_only")FactTarget
Section titled “FactTarget”FactTarget names the facts a condition matches.
type FactTarget struct { // contains filtered or unexported fields}DynamicFact
Section titled “DynamicFact”DynamicFact builds a target matching dynamic facts with name.
func DynamicFact(name string) FactTargetDynamicFactIn
Section titled “DynamicFactIn”DynamicFactIn builds a target matching dynamic facts in module.
func DynamicFactIn(module ModuleName, name string) FactTargetTemplateFact
Section titled “TemplateFact”TemplateFact builds a target matching facts of the named template.
func TemplateFact(name string) FactTargetTemplateFactIn
Section titled “TemplateFactIn”TemplateFactIn builds a target matching facts of the named template in module.
func TemplateFactIn(module ModuleName, name string) FactTargetTemplateKeyFact
Section titled “TemplateKeyFact”TemplateKeyFact builds a target matching facts of the template key.
func TemplateKeyFact(key TemplateKey) FactTargetFactTarget.Kind
Section titled “FactTarget.Kind”func (t FactTarget) Kind() FactTargetKindFactTarget.Normalized
Section titled “FactTarget.Normalized”Normalized returns t with trimmed names and inferred kind where possible.
func (t FactTarget) Normalized() FactTargetFactTarget.Ref
Section titled “FactTarget.Ref”func (t FactTarget) Ref() NameRefFactTarget.TemplateKey
Section titled “FactTarget.TemplateKey”func (t FactTarget) TemplateKey() TemplateKeyFactTargetKind
Section titled “FactTargetKind”FactTargetKind identifies what kind of fact a FactTarget matches.
type FactTargetKind uint8FactTargetUnknown, FactTargetDynamic, FactTargetTemplate, FactTargetTemplateKey
Section titled “FactTargetUnknown, FactTargetDynamic, FactTargetTemplate, FactTargetTemplateKey”const ( FactTargetUnknown FactTargetKind = iota FactTargetDynamic FactTargetTemplate FactTargetTemplateKey)FactVersion
Section titled “FactVersion”FactVersion advances each time a fact is modified; a fact’s FactID stays stable across modifies within a generation.
type FactVersion uint32FieldChange
Section titled “FieldChange”FieldChange describes one field’s before and after value.
type FieldChange struct { Field string Old Value New Value}CloneFieldChange
Section titled “CloneFieldChange”CloneFieldChange returns a defensive copy of change.
func CloneFieldChange(change FieldChange) FieldChangeCloneFieldChanges
Section titled “CloneFieldChanges”CloneFieldChanges returns a defensive copy of changes.
func CloneFieldChanges(changes []FieldChange) []FieldChangeFieldConstraint
Section titled “FieldConstraint”FieldConstraint is the compiled, inspectable form of a FieldConstraintSpec.
type FieldConstraint struct { Field string Path PathSpec Operator FieldConstraintOperator Value Value}CloneFieldConstraint
Section titled “CloneFieldConstraint”CloneFieldConstraint returns a defensive copy of c.
func CloneFieldConstraint(c FieldConstraint) FieldConstraintFieldConstraintOperator
Section titled “FieldConstraintOperator”FieldConstraintOperator is the comparison a FieldConstraintSpec applies.
type FieldConstraintOperator stringFieldConstraintSpec
Section titled “FieldConstraintSpec”FieldConstraintSpec constrains one field, or nested path, of a matched fact.
type FieldConstraintSpec struct { Field string Path PathSpec Operator FieldConstraintOperator Value any}CloneFieldConstraintSpec
Section titled “CloneFieldConstraintSpec”CloneFieldConstraintSpec returns a defensive copy of s.
func CloneFieldConstraintSpec(s FieldConstraintSpec) FieldConstraintSpecFieldPresence
Section titled “FieldPresence”FieldPresence reports how a field came to have its value.
type FieldPresence stringFieldPresenceOmitted, FieldPresenceDefault, FieldPresenceExplicit
Section titled “FieldPresenceOmitted, FieldPresenceDefault, FieldPresenceExplicit”const ( FieldPresenceOmitted FieldPresence = "omitted" FieldPresenceDefault FieldPresence = "default" FieldPresenceExplicit FieldPresence = "explicit")FieldRef
Section titled “FieldRef”FieldRef names a field, or nested path, of an earlier binding.
type FieldRef struct { Binding string Field string Path PathSpec}CloneFieldRef
Section titled “CloneFieldRef”CloneFieldRef returns a defensive copy of r.
func CloneFieldRef(r FieldRef) FieldRefFieldSpec
Section titled “FieldSpec”FieldSpec declares one template field: its name, kind, whether it’s required, an optional default, and an optional closed set of allowed values.
type FieldSpec struct { Name string Kind ValueKind Required bool Default any HasDefault bool AllowedValues []any}CloneFieldSpec
Section titled “CloneFieldSpec”CloneFieldSpec returns a defensive copy of field.
func CloneFieldSpec(field FieldSpec) FieldSpecCloneFieldSpecs
Section titled “CloneFieldSpecs”CloneFieldSpecs returns a defensive copy of fields.
func CloneFieldSpecs(fields []FieldSpec) []FieldSpecFields
Section titled “Fields”type Fields map[string]ValueCloneFields
Section titled “CloneFields”CloneFields returns a defensive copy of fields.
func CloneFields(in Fields) FieldsMustFields
Section titled “MustFields”MustFields builds fields from alternating string keys and raw values, panicking when the inputs cannot be converted.
func MustFields(pairs ...any) FieldsNewFields
Section titled “NewFields”func NewFields(raw map[string]any) (Fields, error)NewFieldsFromPairs
Section titled “NewFieldsFromPairs”NewFieldsFromPairs builds fields from alternating string keys and raw values.
func NewFieldsFromPairs(pairs ...any) (Fields, error)NormalizeFields
Section titled “NormalizeFields”NormalizeFields returns fields in canonical immutable form.
func NormalizeFields(fields Fields) FieldsFields.DuplicateKey
Section titled “Fields.DuplicateKey”DuplicateKey returns a deterministic duplicate key for fields.
func (f Fields) DuplicateKey() stringFields.Equal
Section titled “Fields.Equal”func (f Fields) Equal(other Fields) boolForallCondition
Section titled “ForallCondition”ForallCondition tests whether every tuple matching Domain also satisfies Requirement.
type ForallCondition struct { Domain ConditionSpec Requirement ConditionSpec Source SourceSpan}Forall
Section titled “Forall”Forall builds a ForallCondition.
func Forall(domain ConditionSpec, requirement ConditionSpec) ForallConditionFunctionEvaluationError
Section titled “FunctionEvaluationError”FunctionEvaluationError reports a pure function that panicked, returned an error, or returned a value of the wrong kind.
type FunctionEvaluationError struct { RuleName string QueryName string ConditionIndex int PredicateIndex int FunctionName string Source SourceSpan Err error}*FunctionEvaluationError.Error
Section titled “*FunctionEvaluationError.Error”func (e *FunctionEvaluationError) Error() string*FunctionEvaluationError.Is
Section titled “*FunctionEvaluationError.Is”func (e *FunctionEvaluationError) Is(target error) bool*FunctionEvaluationError.Unwrap
Section titled “*FunctionEvaluationError.Unwrap”func (e *FunctionEvaluationError) Unwrap() errorGeneration
Section titled “Generation”Generation is the working-memory reset epoch.
type Generation uint64Global
Section titled “Global”Global is the compiled, inspectable form of a GlobalSpec.
type Global struct { NameValue string KindValue ValueKind DefaultValue Value HasDefaultValue bool DescriptionText string Order int}CloneGlobal
Section titled “CloneGlobal”CloneGlobal returns a defensive copy of g.
func CloneGlobal(g Global) GlobalGlobal.DeclarationOrder
Section titled “Global.DeclarationOrder”func (g Global) DeclarationOrder() intGlobal.Default
Section titled “Global.Default”func (g Global) Default() (Value, bool)Global.Description
Section titled “Global.Description”func (g Global) Description() stringGlobal.Kind
Section titled “Global.Kind”func (g Global) Kind() ValueKindGlobal.Name
Section titled “Global.Name”func (g Global) Name() stringGlobalExpr
Section titled “GlobalExpr”GlobalExpr references a declared session global.
type GlobalExpr struct { Name string}GlobalValue
Section titled “GlobalValue”GlobalValue builds an expression reading the named session global.
func GlobalValue(name string) GlobalExprGlobalSpec
Section titled “GlobalSpec”GlobalSpec declares a named, typed global with an optional default value.
type GlobalSpec struct { Name string Kind ValueKind Default any HasDefault bool Description string}CloneGlobalSpec
Section titled “CloneGlobalSpec”CloneGlobalSpec returns a defensive copy of s.
func CloneGlobalSpec(s GlobalSpec) GlobalSpecHasPathExpr
Section titled “HasPathExpr”HasPathExpr evaluates to true when Path resolves to a present value on the current fact.
type HasPathExpr struct { Path PathSpec}HasPath
Section titled “HasPath”HasPath builds a HasPathExpr testing whether path resolves to a present value on the current fact.
func HasPath(path PathSpec) HasPathExprJoinConstraint
Section titled “JoinConstraint”JoinConstraint is the compiled, inspectable form of a JoinConstraintSpec.
type JoinConstraint struct { Field string Path PathSpec Operator FieldConstraintOperator Ref FieldRef}CloneJoinConstraint
Section titled “CloneJoinConstraint”CloneJoinConstraint returns a defensive copy of c.
func CloneJoinConstraint(c JoinConstraint) JoinConstraintJoinConstraintSpec
Section titled “JoinConstraintSpec”JoinConstraintSpec compares a field of the matched fact against a field of an earlier binding named by Ref.
type JoinConstraintSpec struct { Field string Path PathSpec Operator FieldConstraintOperator Ref FieldRef}CloneJoinConstraintSpec
Section titled “CloneJoinConstraintSpec”CloneJoinConstraintSpec returns a defensive copy of s.
func CloneJoinConstraintSpec(s JoinConstraintSpec) JoinConstraintSpecListPatternElement
Section titled “ListPatternElement”ListPatternElement is the compiled, inspectable form of a ListPatternElementSpec.
type ListPatternElement struct { KindValue ListPatternElementKind ExpressionSpec ExpressionSpec BindingName string Order int}CloneListPatternElement
Section titled “CloneListPatternElement”CloneListPatternElement returns a defensive copy of e.
func CloneListPatternElement(e ListPatternElement) ListPatternElementListPatternElement.Binding
Section titled “ListPatternElement.Binding”func (e ListPatternElement) Binding() stringListPatternElement.DeclarationOrder
Section titled “ListPatternElement.DeclarationOrder”func (e ListPatternElement) DeclarationOrder() intListPatternElement.Expression
Section titled “ListPatternElement.Expression”func (e ListPatternElement) Expression() ExpressionSpecListPatternElement.Kind
Section titled “ListPatternElement.Kind”func (e ListPatternElement) Kind() ListPatternElementKindListPatternElementKind
Section titled “ListPatternElementKind”ListPatternElementKind identifies one element of a ListPatternSpec.
type ListPatternElementKind stringListPatternElementUnknown, ListPatternElementValue, ListPatternElementWildcard, ListPatternElementSegment, ListPatternElementRestWildcard
Section titled “ListPatternElementUnknown, ListPatternElementValue, ListPatternElementWildcard, ListPatternElementSegment, ListPatternElementRestWildcard”const ( ListPatternElementUnknown ListPatternElementKind = "" ListPatternElementValue ListPatternElementKind = "value" ListPatternElementWildcard ListPatternElementKind = "wildcard" ListPatternElementSegment ListPatternElementKind = "segment" ListPatternElementRestWildcard ListPatternElementKind = "rest-wildcard")ListPatternElementSpec
Section titled “ListPatternElementSpec”ListPatternElementSpec is one element of a ListPatternSpec.
type ListPatternElementSpec struct { Kind ListPatternElementKind Expression ExpressionSpec Binding string}CloneListPatternElementSpec
Section titled “CloneListPatternElementSpec”CloneListPatternElementSpec returns a defensive copy of s.
func CloneListPatternElementSpec(s ListPatternElementSpec) ListPatternElementSpecListElem
Section titled “ListElem”ListElem builds a fixed-position list pattern element.
func ListElem(expression ExpressionSpec) ListPatternElementSpecListRestWildcard
Section titled “ListRestWildcard”ListRestWildcard builds a list pattern element matching a variable-length run without capturing it.
func ListRestWildcard() ListPatternElementSpecListSegment
Section titled “ListSegment”ListSegment builds a list pattern element matching a variable-length run.
func ListSegment(binding string) ListPatternElementSpecListWildcard
Section titled “ListWildcard”ListWildcard builds a list pattern element matching any one element.
func ListWildcard() ListPatternElementSpecListPatternSpec
Section titled “ListPatternSpec”ListPatternSpec is a structural pattern over a LIST-typed field.
type ListPatternSpec struct { Path PathSpec Elements []ListPatternElementSpec}CloneListPatternSpec
Section titled “CloneListPatternSpec”CloneListPatternSpec returns a defensive copy of s.
func CloneListPatternSpec(s ListPatternSpec) ListPatternSpecListPattern
Section titled “ListPattern”ListPattern builds a ListPatternSpec matching elements positionally against the LIST-typed field at path.
func ListPattern(path PathSpec, elements ...ListPatternElementSpec) ListPatternSpecMatch is a positive fact match condition tree node.
type Match RuleConditionSpecCloneMatch
Section titled “CloneMatch”CloneMatch returns a defensive copy of s.
func CloneMatch(s Match) MatchModifyResult
Section titled “ModifyResult”ModifyResult reports the outcome of a modify.
type ModifyResult struct { Status ModifyStatus Fact FactSnapshot Delta *MutationDelta}CloneModifyResult
Section titled “CloneModifyResult”CloneModifyResult returns a defensive copy of result.
func CloneModifyResult(result ModifyResult) ModifyResultModifyResult.Changed
Section titled “ModifyResult.Changed”Changed reports whether the modify changed the fact.
func (r ModifyResult) Changed() boolModifyStatus
Section titled “ModifyStatus”ModifyStatus is the outcome of a modify call.
type ModifyStatus stringModifyChanged, ModifyNoOp, ModifyMissing, ModifyStale, ModifyValidationFailure, ModifyDuplicate, ModifyLogicalSupport, ModifyClosed, ModifyConcurrencyMisuse
Section titled “ModifyChanged, ModifyNoOp, ModifyMissing, ModifyStale, ModifyValidationFailure, ModifyDuplicate, ModifyLogicalSupport, ModifyClosed, ModifyConcurrencyMisuse”const ( ModifyChanged ModifyStatus = "changed" ModifyNoOp ModifyStatus = "no_op" ModifyMissing ModifyStatus = "missing" ModifyStale ModifyStatus = "stale" ModifyValidationFailure ModifyStatus = "validation_failure" ModifyDuplicate ModifyStatus = "duplicate" ModifyLogicalSupport ModifyStatus = "logical_support" ModifyClosed ModifyStatus = "closed" ModifyConcurrencyMisuse ModifyStatus = "concurrency_misuse")Module
Section titled “Module”Module is the compiled, inspectable form of a ModuleSpec.
type Module struct { NameValue ModuleName DescriptionText string AutoFocusValue *bool}CloneModule
Section titled “CloneModule”CloneModule returns a defensive copy of m.
func CloneModule(m Module) ModuleModule.AutoFocusDefault
Section titled “Module.AutoFocusDefault”func (m Module) AutoFocusDefault() (bool, bool)Module.Description
Section titled “Module.Description”func (m Module) Description() stringModule.Name
Section titled “Module.Name”func (m Module) Name() ModuleNameModuleName
Section titled “ModuleName”ModuleName identifies a module. The zero value renders as MAIN, the default module.
type ModuleName stringMainModule
Section titled “MainModule”const MainModule ModuleName = "MAIN"ModuleName.IsZero
Section titled “ModuleName.IsZero”func (name ModuleName) IsZero() boolModuleName.String
Section titled “ModuleName.String”func (name ModuleName) String() stringModuleSpec
Section titled “ModuleSpec”ModuleSpec declares a module: its Name and optional default focus behavior.
type ModuleSpec struct { Name ModuleName Description string AutoFocus *bool}CloneModuleSpec
Section titled “CloneModuleSpec”CloneModuleSpec returns a defensive copy of s.
func CloneModuleSpec(s ModuleSpec) ModuleSpecModuleSpecFromModule
Section titled “ModuleSpecFromModule”ModuleSpecFromModule returns a ModuleSpec equivalent to m.
func ModuleSpecFromModule(m Module) ModuleSpecMutationDelta
Section titled “MutationDelta”MutationDelta describes one mutation’s effect.
type MutationDelta struct { Kind MutationKind Generation Generation OldGeneration Generation ActivationID ActivationID RuleID RuleID RuleRevisionID RuleRevisionID SupportBefore FactSupportProvenance SupportAfter FactSupportProvenance Recency Recency FactID FactID OldVersion FactVersion NewVersion FactVersion Before *FactSnapshot After *FactSnapshot OldDuplicate DuplicateKey NewDuplicate DuplicateKey ChangedFields []FieldChange}CloneMutationDelta
Section titled “CloneMutationDelta”CloneMutationDelta returns a defensive copy of delta.
func CloneMutationDelta(delta MutationDelta) MutationDeltaCloneMutationDeltaPtr
Section titled “CloneMutationDeltaPtr”CloneMutationDeltaPtr returns a defensive copy of delta when non-nil.
func CloneMutationDeltaPtr(delta *MutationDelta) *MutationDeltaMutationDelta.FieldChanges
Section titled “MutationDelta.FieldChanges”FieldChanges returns a cloned copy of changed fields.
func (d MutationDelta) FieldChanges() []FieldChangeMutationKind
Section titled “MutationKind”MutationKind is the kind of change recorded in a MutationDelta.
type MutationKind stringMutationAssert, MutationModify, MutationRetract, MutationReset
Section titled “MutationAssert, MutationModify, MutationRetract, MutationReset”const ( MutationAssert MutationKind = "assert" MutationModify MutationKind = "modify" MutationRetract MutationKind = "retract" MutationReset MutationKind = "reset")NameRef
Section titled “NameRef”NameRef is an unresolved reference to a named definition.
type NameRef struct { Module ModuleName Name string}ModuleRef
Section titled “ModuleRef”ModuleRef builds a NameRef explicitly qualified to module.
func ModuleRef(module ModuleName, name string) NameRefRef builds an unqualified NameRef.
func Ref(name string) NameRefNot negates a condition tree node.
type Not struct { Condition ConditionSpec Source SourceSpan}Or groups condition tree branches into a disjunction.
type Or struct { Conditions []ConditionSpec Source SourceSpan}ParamExpr
Section titled “ParamExpr”ParamExpr references a named query parameter.
type ParamExpr struct { Name string}PathSegment
Section titled “PathSegment”PathSegment is one step of a PathSpec.
type PathSegment struct { Kind PathSegmentKind Key string Index int}ListIndex
Section titled “ListIndex”ListIndex builds a list-index path segment.
func ListIndex(index int) PathSegmentMapKey
Section titled “MapKey”MapKey builds a map-key path segment.
func MapKey(key string) PathSegmentPathSegmentKind
Section titled “PathSegmentKind”PathSegmentKind identifies one step of a PathSpec.
type PathSegmentKind stringPathSegmentRoot, PathSegmentMap, PathSegmentIndex
Section titled “PathSegmentRoot, PathSegmentMap, PathSegmentIndex”const ( PathSegmentRoot PathSegmentKind = "root" PathSegmentMap PathSegmentKind = "map" PathSegmentIndex PathSegmentKind = "index")PathSpec
Section titled “PathSpec”PathSpec describes a path into a structured value.
type PathSpec struct { Segments []PathSegment}Path builds a PathSpec rooted at the field root, followed by segments.
func Path(root string, segments ...PathSegment) PathSpecPathSpec.String
Section titled “PathSpec.String”func (p PathSpec) String() stringPureFunction
Section titled “PureFunction”PureFunction is a deterministic, side-effect-free function implementation available to condition and query expressions.
type PureFunction func(context.Context, []Value) (Value, error)PureFunction0
Section titled “PureFunction0”PureFunction0 is a fixed-arity PureFunction taking no arguments.
type PureFunction0 func(context.Context) (Value, error)PureFunction1
Section titled “PureFunction1”PureFunction1 is a fixed-arity PureFunction taking one argument.
type PureFunction1 func(context.Context, Value) (Value, error)PureFunction2
Section titled “PureFunction2”PureFunction2 is a fixed-arity PureFunction taking two arguments.
type PureFunction2 func(context.Context, Value, Value) (Value, error)PureFunction3
Section titled “PureFunction3”PureFunction3 is a fixed-arity PureFunction taking three arguments.
type PureFunction3 func(context.Context, Value, Value, Value) (Value, error)PureFunctionDefinition
Section titled “PureFunctionDefinition”PureFunctionDefinition is the compiled, inspectable form of a PureFunctionSpec or ExpressionFunctionSpec.
type PureFunctionDefinition struct { NameValue string ParamNamesValue []string ArgsValue []ValueKind ReturnKind ValueKind DescriptionText string ExpressionSpec ExpressionSpec ExpressionBackedValue bool Order int EqualityComparatorValue bool IndexKeyExtractorValue bool}ClonePureFunctionDefinition
Section titled “ClonePureFunctionDefinition”ClonePureFunctionDefinition returns a defensive copy of f.
func ClonePureFunctionDefinition(f PureFunctionDefinition) PureFunctionDefinitionPureFunctionDefinition.Args
Section titled “PureFunctionDefinition.Args”func (f PureFunctionDefinition) Args() []ValueKindPureFunctionDefinition.DeclarationOrder
Section titled “PureFunctionDefinition.DeclarationOrder”func (f PureFunctionDefinition) DeclarationOrder() intPureFunctionDefinition.Description
Section titled “PureFunctionDefinition.Description”func (f PureFunctionDefinition) Description() stringPureFunctionDefinition.EqualityComparator
Section titled “PureFunctionDefinition.EqualityComparator”func (f PureFunctionDefinition) EqualityComparator() boolPureFunctionDefinition.Expression
Section titled “PureFunctionDefinition.Expression”func (f PureFunctionDefinition) Expression() (ExpressionSpec, bool)PureFunctionDefinition.ExpressionBacked
Section titled “PureFunctionDefinition.ExpressionBacked”func (f PureFunctionDefinition) ExpressionBacked() boolPureFunctionDefinition.IndexKeyExtractor
Section titled “PureFunctionDefinition.IndexKeyExtractor”func (f PureFunctionDefinition) IndexKeyExtractor() boolPureFunctionDefinition.Name
Section titled “PureFunctionDefinition.Name”func (f PureFunctionDefinition) Name() stringPureFunctionDefinition.ParamNames
Section titled “PureFunctionDefinition.ParamNames”func (f PureFunctionDefinition) ParamNames() []stringPureFunctionDefinition.Return
Section titled “PureFunctionDefinition.Return”func (f PureFunctionDefinition) Return() ValueKindPureFunctionSpec
Section titled “PureFunctionSpec”PureFunctionSpec registers a pure function by Name, its Args and Return value kinds, and exactly one implementation function.
type PureFunctionSpec struct { Name string Args []ValueKind Return ValueKind Func PureFunction Func0 PureFunction0 Func1 PureFunction1 Func2 PureFunction2 Func3 PureFunction3 EqualityComparator bool IndexKeyExtractor bool}ClonePureFunctionSpec
Section titled “ClonePureFunctionSpec”ClonePureFunctionSpec returns a defensive copy of s.
func ClonePureFunctionSpec(s PureFunctionSpec) PureFunctionSpecQualifiedName
Section titled “QualifiedName”QualifiedName is a module-qualified name, rendered as “MODULE.Name”.
type QualifiedName struct { Module ModuleName Name string}QualifiedName.String
Section titled “QualifiedName.String”func (n QualifiedName) String() stringQuery is the compiled, inspectable form of a QuerySpec.
type Query struct { NameValue string ModuleValue ModuleName DescriptionText string SourceSpan SourceSpan GessSourceText string ParameterValues []QueryParameter ConditionValues []RuleCondition ConditionTreeValue RuleConditionTree ConditionBranchValues []RuleConditionBranch ConditionBranchesTruncatedFlag bool ReturnValues []QueryReturn}CloneQuery
Section titled “CloneQuery”CloneQuery returns a defensive copy of q.
func CloneQuery(q Query) QueryQuery.ConditionBranches
Section titled “Query.ConditionBranches”func (q Query) ConditionBranches() []RuleConditionBranchQuery.ConditionBranchesTruncated
Section titled “Query.ConditionBranchesTruncated”ConditionBranchesTruncated reports whether ConditionBranches is a bounded inspection prefix rather than the complete Cartesian expansion.
func (q Query) ConditionBranchesTruncated() boolQuery.ConditionTree
Section titled “Query.ConditionTree”func (q Query) ConditionTree() RuleConditionTreeQuery.Conditions
Section titled “Query.Conditions”func (q Query) Conditions() []RuleConditionQuery.Description
Section titled “Query.Description”func (q Query) Description() stringQuery.GessSource
Section titled “Query.GessSource”func (q Query) GessSource() stringQuery.Module
Section titled “Query.Module”func (q Query) Module() ModuleNameQuery.Name
Section titled “Query.Name”func (q Query) Name() stringQuery.Parameters
Section titled “Query.Parameters”func (q Query) Parameters() []QueryParameterQuery.Returns
Section titled “Query.Returns”func (q Query) Returns() []QueryReturnQuery.Source
Section titled “Query.Source”func (q Query) Source() SourceSpanQueryParameter
Section titled “QueryParameter”QueryParameter is the compiled, inspectable form of a QueryParameterSpec.
type QueryParameter struct { NameValue string KindValue ValueKind Order int}CloneQueryParameters
Section titled “CloneQueryParameters”CloneQueryParameters returns a defensive copy of parameters.
func CloneQueryParameters(parameters []QueryParameter) []QueryParameterQueryParameter.DeclarationOrder
Section titled “QueryParameter.DeclarationOrder”func (p QueryParameter) DeclarationOrder() intQueryParameter.Kind
Section titled “QueryParameter.Kind”func (p QueryParameter) Kind() ValueKindQueryParameter.Name
Section titled “QueryParameter.Name”func (p QueryParameter) Name() stringQueryParameterSpec
Section titled “QueryParameterSpec”QueryParameterSpec declares one named, typed query parameter.
type QueryParameterSpec struct { Name string Kind ValueKind}CloneQueryParameterSpec
Section titled “CloneQueryParameterSpec”CloneQueryParameterSpec returns a defensive copy of s.
func CloneQueryParameterSpec(s QueryParameterSpec) QueryParameterSpecQueryReturn
Section titled “QueryReturn”QueryReturn is the compiled, inspectable form of a QueryReturnSpec.
type QueryReturn struct { AliasValue string BindingName string ExpressionSpec ExpressionSpec FactValue bool Order int SourceSpan SourceSpan}CloneQueryReturn
Section titled “CloneQueryReturn”CloneQueryReturn returns a defensive copy of r.
func CloneQueryReturn(r QueryReturn) QueryReturnCloneQueryReturns
Section titled “CloneQueryReturns”CloneQueryReturns returns a defensive copy of returns.
func CloneQueryReturns(returns []QueryReturn) []QueryReturnQueryReturn.Alias
Section titled “QueryReturn.Alias”func (r QueryReturn) Alias() stringQueryReturn.Binding
Section titled “QueryReturn.Binding”func (r QueryReturn) Binding() stringQueryReturn.DeclarationOrder
Section titled “QueryReturn.DeclarationOrder”func (r QueryReturn) DeclarationOrder() intQueryReturn.Expression
Section titled “QueryReturn.Expression”func (r QueryReturn) Expression() ExpressionSpecQueryReturn.Fact
Section titled “QueryReturn.Fact”func (r QueryReturn) Fact() boolQueryReturn.Source
Section titled “QueryReturn.Source”func (r QueryReturn) Source() SourceSpanQueryReturnSpec
Section titled “QueryReturnSpec”QueryReturnSpec declares one named query result column.
type QueryReturnSpec struct { Alias string Binding string Expression ExpressionSpec Source SourceSpan}CloneQueryReturnSpec
Section titled “CloneQueryReturnSpec”CloneQueryReturnSpec returns a defensive copy of s.
func CloneQueryReturnSpec(s QueryReturnSpec) QueryReturnSpecReturnFact
Section titled “ReturnFact”ReturnFact builds a QueryReturnSpec returning the whole fact bound to binding under alias.
func ReturnFact(alias, binding string) QueryReturnSpecReturnValue
Section titled “ReturnValue”ReturnValue builds a QueryReturnSpec returning expression under alias.
func ReturnValue(alias string, expression ExpressionSpec) QueryReturnSpecQuerySpec
Section titled “QuerySpec”QuerySpec defines a named query.
type QuerySpec struct { Name string Module ModuleName Description string Source SourceSpan GessSource string Parameters []QueryParameterSpec Conditions []RuleConditionSpec ConditionTree ConditionSpec Returns []QueryReturnSpec}CloneQuerySpec
Section titled “CloneQuerySpec”CloneQuerySpec returns a defensive copy of s.
func CloneQuerySpec(s QuerySpec) QuerySpecRHSBindExpr
Section titled “RHSBindExpr”RHSBindExpr references a right-hand-side local variable created by a bind action earlier in the same rule firing.
type RHSBindExpr struct { Name string}Recency
Section titled “Recency”Recency is a session-wide counter that advances on every fact mutation.
type Recency uint32ResetStatus
Section titled “ResetStatus”ResetStatus is the outcome of a reset.
type ResetStatus stringResetApplied, ResetValidationFailure, ResetClosed, ResetConcurrencyMisuse
Section titled “ResetApplied, ResetValidationFailure, ResetClosed, ResetConcurrencyMisuse”const ( ResetApplied ResetStatus = "applied" ResetValidationFailure ResetStatus = "validation_failure" ResetClosed ResetStatus = "closed" ResetConcurrencyMisuse ResetStatus = "concurrency_misuse")RetractResult
Section titled “RetractResult”RetractResult reports the outcome of a retract.
type RetractResult struct { Status RetractStatus Fact FactSnapshot Delta *MutationDelta}CloneRetractResult
Section titled “CloneRetractResult”CloneRetractResult returns a defensive copy of result.
func CloneRetractResult(result RetractResult) RetractResultRetractResult.Removed
Section titled “RetractResult.Removed”Removed reports whether the retract removed the fact.
func (r RetractResult) Removed() boolRetractStatus
Section titled “RetractStatus”RetractStatus is the outcome of a retract call.
type RetractStatus stringRetractRemoved, RetractStatedSupportRemoved, RetractLogicalOnly, RetractMissing, RetractStale, RetractClosed, RetractValidationFailure, RetractConcurrencyMisuse
Section titled “RetractRemoved, RetractStatedSupportRemoved, RetractLogicalOnly, RetractMissing, RetractStale, RetractClosed, RetractValidationFailure, RetractConcurrencyMisuse”const ( RetractRemoved RetractStatus = "removed" RetractStatedSupportRemoved RetractStatus = "stated_support_removed" RetractLogicalOnly RetractStatus = "logical_only" RetractMissing RetractStatus = "missing" RetractStale RetractStatus = "stale" RetractClosed RetractStatus = "closed" RetractValidationFailure RetractStatus = "validation_failure" RetractConcurrencyMisuse RetractStatus = "concurrency_misuse")Rule is the compiled, inspectable form of a RuleSpec.
type Rule struct { IDValue RuleID RevisionIDValue RuleRevisionID NameValue string ModuleValue ModuleName DescriptionText string TagValues []string SalienceValue int AutoFocusValue bool HasAutoFocus bool EffectiveAutoFocusFlag bool Order int SourceSpan SourceSpan GessSourceText string ConditionValues []RuleCondition ConditionTreeValue RuleConditionTree ConditionBranchValues []RuleConditionBranch ConditionBranchesTruncatedFlag bool ActionValues []RuleAction}CloneRule
Section titled “CloneRule”CloneRule returns a defensive copy of r.
func CloneRule(r Rule) RuleCloneRules
Section titled “CloneRules”CloneRules returns a defensive copy of rules.
func CloneRules(rules []Rule) []RuleRule.Actions
Section titled “Rule.Actions”func (r Rule) Actions() []RuleActionRule.AutoFocus
Section titled “Rule.AutoFocus”func (r Rule) AutoFocus() (bool, bool)Rule.ConditionBranches
Section titled “Rule.ConditionBranches”func (r Rule) ConditionBranches() []RuleConditionBranchRule.ConditionBranchesTruncated
Section titled “Rule.ConditionBranchesTruncated”ConditionBranchesTruncated reports whether ConditionBranches is a bounded inspection prefix rather than the complete Cartesian expansion.
func (r Rule) ConditionBranchesTruncated() boolRule.ConditionTree
Section titled “Rule.ConditionTree”func (r Rule) ConditionTree() RuleConditionTreeRule.Conditions
Section titled “Rule.Conditions”func (r Rule) Conditions() []RuleConditionRule.DeclarationOrder
Section titled “Rule.DeclarationOrder”func (r Rule) DeclarationOrder() intRule.Description
Section titled “Rule.Description”func (r Rule) Description() stringRule.EffectiveAutoFocus
Section titled “Rule.EffectiveAutoFocus”func (r Rule) EffectiveAutoFocus() boolRule.GessSource
Section titled “Rule.GessSource”func (r Rule) GessSource() stringRule.ID
Section titled “Rule.ID”func (r Rule) ID() RuleIDRule.Module
Section titled “Rule.Module”func (r Rule) Module() ModuleNameRule.Name
Section titled “Rule.Name”func (r Rule) Name() stringRule.RevisionID
Section titled “Rule.RevisionID”func (r Rule) RevisionID() RuleRevisionIDRule.Salience
Section titled “Rule.Salience”func (r Rule) Salience() intRule.Source
Section titled “Rule.Source”func (r Rule) Source() SourceSpanRule.Tags
Section titled “Rule.Tags”func (r Rule) Tags() []stringRuleAction
Section titled “RuleAction”RuleAction is a compiled, inspectable action reference on a rule.
type RuleAction struct { NameValue string Order int SourceSpan SourceSpan}CloneRuleAction
Section titled “CloneRuleAction”CloneRuleAction returns a defensive copy of a.
func CloneRuleAction(a RuleAction) RuleActionCloneRuleActions
Section titled “CloneRuleActions”CloneRuleActions returns a defensive copy of actions.
func CloneRuleActions(actions []RuleAction) []RuleActionRuleAction.DeclarationOrder
Section titled “RuleAction.DeclarationOrder”func (a RuleAction) DeclarationOrder() intRuleAction.Name
Section titled “RuleAction.Name”func (a RuleAction) Name() stringRuleAction.Source
Section titled “RuleAction.Source”func (a RuleAction) Source() SourceSpanRuleActionSpec
Section titled “RuleActionSpec”RuleActionSpec references, by Name, an action registered on the workspace.
type RuleActionSpec struct { Name string Source SourceSpan}CloneRuleActionSpec
Section titled “CloneRuleActionSpec”CloneRuleActionSpec returns a defensive copy of s.
func CloneRuleActionSpec(s RuleActionSpec) RuleActionSpecRuleCondition
Section titled “RuleCondition”RuleCondition is the compiled, inspectable form of a fact match condition.
type RuleCondition struct { IDValue ConditionID BindingName string NameValue string TemplateKeyValue TemplateKey FieldConstraintValues []FieldConstraint ListPatternValues []RuleListPattern JoinConstraintValues []JoinConstraint PredicateValues []ExpressionPredicate ExplicitValue bool Order int SourceSpan SourceSpan}CloneRuleCondition
Section titled “CloneRuleCondition”CloneRuleCondition returns a defensive copy of c.
func CloneRuleCondition(c RuleCondition) RuleConditionCloneRuleConditions
Section titled “CloneRuleConditions”CloneRuleConditions returns a defensive copy of conditions.
func CloneRuleConditions(conditions []RuleCondition) []RuleConditionRuleCondition.Binding
Section titled “RuleCondition.Binding”func (c RuleCondition) Binding() stringRuleCondition.DeclarationOrder
Section titled “RuleCondition.DeclarationOrder”func (c RuleCondition) DeclarationOrder() intRuleCondition.Explicit
Section titled “RuleCondition.Explicit”func (c RuleCondition) Explicit() boolRuleCondition.FieldConstraints
Section titled “RuleCondition.FieldConstraints”func (c RuleCondition) FieldConstraints() []FieldConstraintRuleCondition.ID
Section titled “RuleCondition.ID”func (c RuleCondition) ID() ConditionIDRuleCondition.JoinConstraints
Section titled “RuleCondition.JoinConstraints”func (c RuleCondition) JoinConstraints() []JoinConstraintRuleCondition.ListPatterns
Section titled “RuleCondition.ListPatterns”func (c RuleCondition) ListPatterns() []RuleListPatternRuleCondition.Name
Section titled “RuleCondition.Name”func (c RuleCondition) Name() stringRuleCondition.Predicates
Section titled “RuleCondition.Predicates”func (c RuleCondition) Predicates() []ExpressionPredicateRuleCondition.Source
Section titled “RuleCondition.Source”func (c RuleCondition) Source() SourceSpanRuleCondition.Target
Section titled “RuleCondition.Target”func (c RuleCondition) Target() FactTargetRuleCondition.TemplateKey
Section titled “RuleCondition.TemplateKey”func (c RuleCondition) TemplateKey() TemplateKeyRuleConditionBranch
Section titled “RuleConditionBranch”RuleConditionBranch is one compiled branch in a condition tree. Flat rules and tree rules without disjunction expose one branch. Disjunctive trees expose expanded alternatives in source order, bounded for structurally compiled programs; Rule.ConditionBranchesTruncated and Query.ConditionBranchesTruncated report whether the returned inspection is incomplete.
type RuleConditionBranch struct { IDValue int ConditionValues []RuleConditionBranchCondition}CloneRuleConditionBranch
Section titled “CloneRuleConditionBranch”CloneRuleConditionBranch returns a defensive copy of b.
func CloneRuleConditionBranch(b RuleConditionBranch) RuleConditionBranchCloneRuleConditionBranches
Section titled “CloneRuleConditionBranches”CloneRuleConditionBranches returns a defensive copy of branches.
func CloneRuleConditionBranches(branches []RuleConditionBranch) []RuleConditionBranchRuleConditionBranch.Conditions
Section titled “RuleConditionBranch.Conditions”func (b RuleConditionBranch) Conditions() []RuleConditionBranchConditionRuleConditionBranch.ID
Section titled “RuleConditionBranch.ID”func (b RuleConditionBranch) ID() intRuleConditionBranchCondition
Section titled “RuleConditionBranchCondition”RuleConditionBranchCondition describes a condition within an expanded branch. Path is the authored condition-tree path, while Visible indicates whether the binding is exposed to actions. Negated conditions are local and not visible.
type RuleConditionBranchCondition struct { ConditionValue RuleCondition PathValue []int VisibleValue bool NegatedValue bool ExplicitValue bool}CloneRuleConditionBranchCondition
Section titled “CloneRuleConditionBranchCondition”CloneRuleConditionBranchCondition returns a defensive copy of c.
func CloneRuleConditionBranchCondition(c RuleConditionBranchCondition) RuleConditionBranchConditionCloneRuleConditionBranchConditions
Section titled “CloneRuleConditionBranchConditions”CloneRuleConditionBranchConditions returns a defensive copy of conditions.
func CloneRuleConditionBranchConditions(conditions []RuleConditionBranchCondition) []RuleConditionBranchConditionRuleConditionBranchCondition.Condition
Section titled “RuleConditionBranchCondition.Condition”func (c RuleConditionBranchCondition) Condition() RuleConditionRuleConditionBranchCondition.Explicit
Section titled “RuleConditionBranchCondition.Explicit”func (c RuleConditionBranchCondition) Explicit() boolRuleConditionBranchCondition.Negated
Section titled “RuleConditionBranchCondition.Negated”func (c RuleConditionBranchCondition) Negated() boolRuleConditionBranchCondition.Path
Section titled “RuleConditionBranchCondition.Path”func (c RuleConditionBranchCondition) Path() []intRuleConditionBranchCondition.Visible
Section titled “RuleConditionBranchCondition.Visible”func (c RuleConditionBranchCondition) Visible() boolRuleConditionSpec
Section titled “RuleConditionSpec”RuleConditionSpec is the field set behind a positive fact match condition.
type RuleConditionSpec struct { Binding string // SyntheticBinding marks a binding generated by a source loader rather // than authored by the user. User-facing diagnostics may omit its name. SyntheticBinding bool // Volatile is a compile-time planning hint that the matched fact is // expected to be modified frequently. The planner may place an otherwise // independent volatile match later in a branch to reduce propagation // churn. It does not change match semantics or revision identity. Volatile bool Target FactTarget FieldConstraints []FieldConstraintSpec ListPatterns []ListPatternSpec JoinConstraints []JoinConstraintSpec Predicates []ExpressionSpec Source SourceSpan}CloneRuleConditionSpec
Section titled “CloneRuleConditionSpec”CloneRuleConditionSpec returns a defensive copy of s.
func CloneRuleConditionSpec(s RuleConditionSpec) RuleConditionSpecRuleConditionTree
Section titled “RuleConditionTree”RuleConditionTree is the compiled, inspectable condition tree for a rule or query.
type RuleConditionTree struct { KindValue ConditionTreeKind ChildrenValue []RuleConditionTree MatchCondition RuleCondition HasMatch bool TestExpression ExpressionSpec HasTest bool AggregateValue AccumulateCondition HasAggregate bool SourceSpan SourceSpan}CloneRuleConditionTree
Section titled “CloneRuleConditionTree”CloneRuleConditionTree returns a defensive copy of t.
func CloneRuleConditionTree(t RuleConditionTree) RuleConditionTreeCloneRuleConditionTrees
Section titled “CloneRuleConditionTrees”CloneRuleConditionTrees returns a defensive copy of trees.
func CloneRuleConditionTrees(trees []RuleConditionTree) []RuleConditionTreeRuleConditionTree.Aggregate
Section titled “RuleConditionTree.Aggregate”func (t RuleConditionTree) Aggregate() (AccumulateCondition, bool)RuleConditionTree.Children
Section titled “RuleConditionTree.Children”func (t RuleConditionTree) Children() []RuleConditionTreeRuleConditionTree.Kind
Section titled “RuleConditionTree.Kind”func (t RuleConditionTree) Kind() ConditionTreeKindRuleConditionTree.Match
Section titled “RuleConditionTree.Match”func (t RuleConditionTree) Match() (RuleCondition, bool)RuleConditionTree.Source
Section titled “RuleConditionTree.Source”func (t RuleConditionTree) Source() SourceSpanRuleConditionTree.Test
Section titled “RuleConditionTree.Test”func (t RuleConditionTree) Test() (ExpressionSpec, bool)RuleFieldConstraint
Section titled “RuleFieldConstraint”RuleFieldConstraint is an alias of FieldConstraint.
type RuleFieldConstraint = FieldConstraintRuleFieldConstraintSpec
Section titled “RuleFieldConstraintSpec”RuleFieldConstraintSpec is an alias of FieldConstraintSpec, used in rule-condition contexts.
type RuleFieldConstraintSpec = FieldConstraintSpecRuleID
Section titled “RuleID”RuleID is a rule’s stable identity, surviving ReplaceRule.
type RuleID stringRuleID.IsZero
Section titled “RuleID.IsZero”func (id RuleID) IsZero() boolRuleID.String
Section titled “RuleID.String”func (id RuleID) String() stringRuleListPattern
Section titled “RuleListPattern”RuleListPattern is the compiled, inspectable list pattern attached to a rule condition.
type RuleListPattern struct { PathSpec PathSpec ElementsValue []ListPatternElement Order int}CloneRuleListPattern
Section titled “CloneRuleListPattern”CloneRuleListPattern returns a defensive copy of p.
func CloneRuleListPattern(p RuleListPattern) RuleListPatternCloneRuleListPatterns
Section titled “CloneRuleListPatterns”CloneRuleListPatterns returns a defensive copy of patterns.
func CloneRuleListPatterns(patterns []RuleListPattern) []RuleListPatternRuleListPattern.DeclarationOrder
Section titled “RuleListPattern.DeclarationOrder”func (p RuleListPattern) DeclarationOrder() intRuleListPattern.Elements
Section titled “RuleListPattern.Elements”func (p RuleListPattern) Elements() []ListPatternElementRuleListPattern.Path
Section titled “RuleListPattern.Path”func (p RuleListPattern) Path() PathSpecRuleRevisionID
Section titled “RuleRevisionID”RuleRevisionID identifies one compiled revision of a rule.
type RuleRevisionID stringRuleRevisionID.IsZero
Section titled “RuleRevisionID.IsZero”func (id RuleRevisionID) IsZero() boolRuleRevisionID.String
Section titled “RuleRevisionID.String”func (id RuleRevisionID) String() stringRuleSpec
Section titled “RuleSpec”RuleSpec defines a rule.
type RuleSpec struct { Name string Module ModuleName ID RuleID Description string Source SourceSpan GessSource string Tags []string Salience int AutoFocus *bool // Conditions is the flat positive conjunction form. When ConditionTree is // nil, compile normalizes Conditions to And(Match...) without changing // condition ordering, condition identity, graph topology, or agenda behavior. Conditions []RuleConditionSpec // ConditionTree is the structured left-hand side form. It is mutually // exclusive with Conditions in one RuleSpec. ConditionTree ConditionSpec Actions []RuleActionSpec}CloneRuleSpec
Section titled “CloneRuleSpec”CloneRuleSpec returns a defensive copy of s.
func CloneRuleSpec(s RuleSpec) RuleSpecRuleset
Section titled “Ruleset”Ruleset is an immutable compiled ruleset facade. Its implementation is owned by the engine through a RulesetHandle.
type Ruleset struct { // contains filtered or unexported fields}Compile
Section titled “Compile”Compile compiles workspace into an immutable Ruleset, equivalent to calling workspace.Compile directly.
func Compile(ctx context.Context, workspace *Workspace) (*Ruleset, error)NewRuleset
Section titled “NewRuleset”NewRuleset returns a public Ruleset backed by handle.
func NewRuleset(handle RulesetHandle) *Ruleset*Ruleset.Action
Section titled “*Ruleset.Action”func (r *Ruleset) Action(name string) (Action, bool)*Ruleset.Actions
Section titled “*Ruleset.Actions”func (r *Ruleset) Actions() []Action*Ruleset.Function
Section titled “*Ruleset.Function”func (r *Ruleset) Function(name string) (PureFunctionDefinition, bool)*Ruleset.Functions
Section titled “*Ruleset.Functions”func (r *Ruleset) Functions() []PureFunctionDefinition*Ruleset.Global
Section titled “*Ruleset.Global”func (r *Ruleset) Global(name string) (Global, bool)*Ruleset.Globals
Section titled “*Ruleset.Globals”func (r *Ruleset) Globals() []Global*Ruleset.ID
Section titled “*Ruleset.ID”func (r *Ruleset) ID() RulesetID*Ruleset.Module
Section titled “*Ruleset.Module”func (r *Ruleset) Module(name ModuleName) (Module, bool)*Ruleset.Modules
Section titled “*Ruleset.Modules”func (r *Ruleset) Modules() []Module*Ruleset.Queries
Section titled “*Ruleset.Queries”func (r *Ruleset) Queries() []Query*Ruleset.Query
Section titled “*Ruleset.Query”func (r *Ruleset) Query(name string) (Query, bool)*Ruleset.Rule
Section titled “*Ruleset.Rule”func (r *Ruleset) Rule(name string) (Rule, bool)*Ruleset.RuleByID
Section titled “*Ruleset.RuleByID”func (r *Ruleset) RuleByID(id RuleID) (Rule, bool)*Ruleset.RuleByRevisionID
Section titled “*Ruleset.RuleByRevisionID”func (r *Ruleset) RuleByRevisionID(id RuleRevisionID) (Rule, bool)*Ruleset.Rules
Section titled “*Ruleset.Rules”func (r *Ruleset) Rules() []Rule*Ruleset.Template
Section titled “*Ruleset.Template”func (r *Ruleset) Template(name string) (Template, bool)*Ruleset.TemplateByKey
Section titled “*Ruleset.TemplateByKey”func (r *Ruleset) TemplateByKey(key TemplateKey) (Template, bool)*Ruleset.Templates
Section titled “*Ruleset.Templates”func (r *Ruleset) Templates() []TemplateRulesetHandle
Section titled “RulesetHandle”RulesetHandle is the engine-owned implementation behind a public Ruleset. Implementations must return detached inspection values.
type RulesetHandle interface { ID() RulesetID Module(ModuleName) (Module, bool) Modules() []Module Template(string) (Template, bool) TemplateByKey(TemplateKey) (Template, bool) Templates() []Template Action(string) (Action, bool) Actions() []Action Function(string) (PureFunctionDefinition, bool) Functions() []PureFunctionDefinition Global(string) (Global, bool) Globals() []Global Rule(string) (Rule, bool) RuleByID(RuleID) (Rule, bool) RuleByRevisionID(RuleRevisionID) (Rule, bool) Rules() []Rule Query(string) (Query, bool) Queries() []Query}RulesetHandleOf
Section titled “RulesetHandleOf”RulesetHandleOf returns the engine-owned implementation behind r.
func RulesetHandleOf(r *Ruleset) RulesetHandleRulesetID
Section titled “RulesetID”RulesetID identifies one compiled ruleset revision. It is derived from the ruleset’s declared shape: templates, rules, queries, globals, and the declared signatures of Go host functions and actions. Host function and action implementations do not contribute, so two rulesets differing only in their Go closures share the same RulesetID.
type RulesetID stringRulesetID.String
Section titled “RulesetID.String”func (id RulesetID) String() stringRunID identifies one session Run call.
type RunID uint64RunID.IsZero
Section titled “RunID.IsZero”func (id RunID) IsZero() boolRunID.String
Section titled “RunID.String”func (id RunID) String() stringRunStatus
Section titled “RunStatus”RunStatus is the outcome of a Run.
type RunStatus stringRunCompleted, RunHalted, RunFireLimit, RunCanceled, RunActionFailed, RunClosed, RunConcurrencyMisuse, RunFailed
Section titled “RunCompleted, RunHalted, RunFireLimit, RunCanceled, RunActionFailed, RunClosed, RunConcurrencyMisuse, RunFailed”const ( RunCompleted RunStatus = "completed" RunHalted RunStatus = "halted" RunFireLimit RunStatus = "fire_limit" RunCanceled RunStatus = "canceled" RunActionFailed RunStatus = "action_failed" RunClosed RunStatus = "closed" RunConcurrencyMisuse RunStatus = "concurrency_misuse" RunFailed RunStatus = "failed")SessionID
Section titled “SessionID”SessionID identifies a session.
type SessionID stringSessionID.String
Section titled “SessionID.String”func (id SessionID) String() stringSourceSpan
Section titled “SourceSpan”SourceSpan is a source location range within a .gess file, carried into compiled definitions and runtime errors for rulesets loaded from .gess source.
type SourceSpan struct { Name string StartLine int StartColumn int EndLine int EndColumn int}SourceSpan.String
Section titled “SourceSpan.String”String returns the source name and starting line/column.
func (s SourceSpan) String() stringSupportID
Section titled “SupportID”SupportID identifies one logical support edge.
type SupportID stringSupportID.IsZero
Section titled “SupportID.IsZero”func (id SupportID) IsZero() boolSupportID.String
Section titled “SupportID.String”func (id SupportID) String() stringTemplate
Section titled “Template”Template is the compiled, inspectable form of a TemplateSpec.
type Template struct { NameValue string ModuleValue ModuleName KeyValue TemplateKey CompatibilityKeyValue TemplateKey FieldValues []FieldSpec DuplicatePolicyValue DuplicatePolicy DuplicateKeyValues []string BackchainReactiveValue bool BackchainDemandKey TemplateKey BackchainDemandValue bool BackchainSourceKey TemplateKey SourceSpan SourceSpan GessSourceText string}CloneTemplate
Section titled “CloneTemplate”CloneTemplate returns a defensive copy of t.
func CloneTemplate(t Template) TemplateCloneTemplates
Section titled “CloneTemplates”CloneTemplates returns a defensive copy of templates.
func CloneTemplates(templates []Template) []TemplateTemplate.BackchainDemandTemplateKey
Section titled “Template.BackchainDemandTemplateKey”func (t Template) BackchainDemandTemplateKey() (TemplateKey, bool)Template.BackchainReactive
Section titled “Template.BackchainReactive”func (t Template) BackchainReactive() boolTemplate.BackchainSourceTemplateKey
Section titled “Template.BackchainSourceTemplateKey”func (t Template) BackchainSourceTemplateKey() (TemplateKey, bool)Template.CompatibilityKey
Section titled “Template.CompatibilityKey”func (t Template) CompatibilityKey() TemplateKeyTemplate.DuplicateKeys
Section titled “Template.DuplicateKeys”func (t Template) DuplicateKeys() []stringTemplate.DuplicatePolicy
Section titled “Template.DuplicatePolicy”func (t Template) DuplicatePolicy() DuplicatePolicyTemplate.Fields
Section titled “Template.Fields”func (t Template) Fields() []FieldSpecTemplate.GessSource
Section titled “Template.GessSource”func (t Template) GessSource() stringTemplate.IsBackchainDemandTemplate
Section titled “Template.IsBackchainDemandTemplate”func (t Template) IsBackchainDemandTemplate() boolTemplate.Key
Section titled “Template.Key”func (t Template) Key() TemplateKeyTemplate.Module
Section titled “Template.Module”func (t Template) Module() ModuleNameTemplate.Name
Section titled “Template.Name”func (t Template) Name() stringTemplate.QualifiedName
Section titled “Template.QualifiedName”func (t Template) QualifiedName() QualifiedNameTemplate.Source
Section titled “Template.Source”func (t Template) Source() SourceSpanTemplateKey
Section titled “TemplateKey”TemplateKey identifies a compiled template within a ruleset.
type TemplateKey stringTemplateKey.String
Section titled “TemplateKey.String”func (key TemplateKey) String() stringTemplateSpec
Section titled “TemplateSpec”TemplateSpec declares a fact template: its name, module, key, fields, duplicate policy, and whether it’s backward-chaining reactive.
type TemplateSpec struct { Name string Module ModuleName Key TemplateKey CompatibilityKey TemplateKey Source SourceSpan GessSource string Fields []FieldSpec DuplicatePolicy DuplicatePolicy DuplicateKeyNames []string BackchainReactive bool}Test evaluates a standalone boolean expression over earlier local bindings.
type Test struct { Expression ExpressionSpec Source SourceSpan}ValidationError
Section titled “ValidationError”ValidationError reports a definition that failed structural or compile-time validation.
type ValidationError struct { TemplateName string RuleName string FunctionName string GlobalName string Source SourceSpan FieldName string ConditionIndex int HasConditionIndex bool ConstraintIndex int HasConstraintIndex bool PredicateIndex int HasPredicateIndex bool JoinIndex int HasJoinIndex bool ActionIndex int HasActionIndex bool Reason string Err error}*ValidationError.Error
Section titled “*ValidationError.Error”func (e *ValidationError) Error() string*ValidationError.Is
Section titled “*ValidationError.Is”func (e *ValidationError) Is(target error) bool*ValidationError.Unwrap
Section titled “*ValidationError.Unwrap”func (e *ValidationError) Unwrap() errorValue is an immutable, typed field or expression value.
type Value struct { // contains filtered or unexported fields}BoolValue
Section titled “BoolValue”BoolValue returns a bool value.
func BoolValue(value bool) ValueCanonicalValue
Section titled “CanonicalValue”CanonicalValue converts raw into a Value.
func CanonicalValue(raw any) (Value, error)CloneValue
Section titled “CloneValue”CloneValue returns a defensive copy of v.
func CloneValue(v Value) ValueCloneValueSlice
Section titled “CloneValueSlice”CloneValueSlice returns a defensive copy of in.
func CloneValueSlice(in []Value) []ValueFloatValue
Section titled “FloatValue”FloatValue returns a float value.
func FloatValue(value float64) ValueIntValue
Section titled “IntValue”IntValue returns an integer value.
func IntValue(value int64) ValueNewValue
Section titled “NewValue”func NewValue(raw any) (Value, error)NullValue
Section titled “NullValue”func NullValue() ValueStringValue
Section titled “StringValue”StringValue returns a string value.
func StringValue(value string) ValueValue.AsBool
Section titled “Value.AsBool”AsBool returns the stored bool when the value kind is ValueBool.
func (v Value) AsBool() (bool, bool)Value.AsFloat64
Section titled “Value.AsFloat64”AsFloat64 returns the stored float when the value kind is ValueFloat.
func (v Value) AsFloat64() (float64, bool)Value.AsInt64
Section titled “Value.AsInt64”AsInt64 returns the stored integer when the value kind is ValueInt.
func (v Value) AsInt64() (int64, bool)Value.AsList
Section titled “Value.AsList”AsList returns a defensive copy of the stored list when the value kind is ValueList.
func (v Value) AsList() ([]Value, bool)Value.AsListShared
Section titled “Value.AsListShared”AsListShared returns the value’s backing list without copying when the kind is ValueList. The returned slice aliases internal storage and must not be modified; use AsList for a defensive copy.
func (v Value) AsListShared() ([]Value, bool)Value.AsMap
Section titled “Value.AsMap”AsMap returns a defensive copy of the stored map when the value kind is ValueMap.
func (v Value) AsMap() (map[string]Value, bool)Value.AsMapShared
Section titled “Value.AsMapShared”AsMapShared returns the value’s backing map without copying when the kind is ValueMap. The returned map aliases internal storage and must not be modified; use AsMap for a defensive copy.
func (v Value) AsMapShared() (map[string]Value, bool)Value.AsString
Section titled “Value.AsString”AsString returns the stored string when the value kind is ValueString.
func (v Value) AsString() (string, bool)Value.CanonicalKey
Section titled “Value.CanonicalKey”CanonicalKey returns a deterministic key for duplicate detection and stable ordering.
func (v Value) CanonicalKey() stringValue.Equal
Section titled “Value.Equal”func (v Value) Equal(other Value) boolValue.Kind
Section titled “Value.Kind”func (v Value) Kind() ValueKindValue.ListAt
Section titled “Value.ListAt”ListAt returns one list item when the value kind is ValueList.
func (v Value) ListAt(index int) (Value, bool)Value.ListLen
Section titled “Value.ListLen”ListLen returns the list length when the value kind is ValueList.
func (v Value) ListLen() (int, bool)Value.MapGet
Section titled “Value.MapGet”MapGet returns one map value when the value kind is ValueMap.
func (v Value) MapGet(key string) (Value, bool)Value.RangeList
Section titled “Value.RangeList”RangeList visits list items when the value kind is ValueList.
func (v Value) RangeList(fn func(int, Value) bool) boolValue.RangeMap
Section titled “Value.RangeMap”RangeMap visits map entries when the value kind is ValueMap.
func (v Value) RangeMap(fn func(string, Value) bool) boolValue.String
Section titled “Value.String”func (v Value) String() stringValueKind
Section titled “ValueKind”ValueKind is a Value’s type tag.
type ValueKind uint8ValueAny, ValueNull, ValueBool, ValueInt, ValueFloat, ValueString, ValueList, ValueMap
Section titled “ValueAny, ValueNull, ValueBool, ValueInt, ValueFloat, ValueString, ValueList, ValueMap”const ( ValueAny ValueKind ValueNull ValueBool ValueInt ValueFloat ValueString ValueList ValueMap)ValueKind.String
Section titled “ValueKind.String”func (k ValueKind) String() stringWhyNotConditionReason
Section titled “WhyNotConditionReason”WhyNotConditionReason classifies why one condition did not extend a partial match.
type WhyNotConditionReason stringWhyNotReasonNone, WhyNotReasonNoAlphaMatches, WhyNotReasonJoinMismatch, WhyNotReasonPredicate, WhyNotReasonNegationBlocked
Section titled “WhyNotReasonNone, WhyNotReasonNoAlphaMatches, WhyNotReasonJoinMismatch, WhyNotReasonPredicate, WhyNotReasonNegationBlocked”const ( WhyNotReasonNone WhyNotConditionReason = "" WhyNotReasonNoAlphaMatches WhyNotConditionReason = "no_alpha_matches" WhyNotReasonJoinMismatch WhyNotConditionReason = "join_mismatch" WhyNotReasonPredicate WhyNotConditionReason = "predicate_rejected" WhyNotReasonNegationBlocked WhyNotConditionReason = "negation_blocked")WhyNotOutcome
Section titled “WhyNotOutcome”WhyNotOutcome is the top-level answer to “why has this rule not fired?”.
type WhyNotOutcome stringWhyNotActivated, WhyNotAlreadyFired, WhyNotNeverMatched, WhyNotBlocked
Section titled “WhyNotActivated, WhyNotAlreadyFired, WhyNotNeverMatched, WhyNotBlocked”const ( WhyNotActivated WhyNotOutcome = "activated" WhyNotAlreadyFired WhyNotOutcome = "already_fired" WhyNotNeverMatched WhyNotOutcome = "never_matched" WhyNotBlocked WhyNotOutcome = "blocked")Workspace
Section titled “Workspace”Workspace is a mutable collection of module, template, action, function, rule, and query definitions. Definitions are validated as they’re added; Compile produces an immutable Ruleset.
type Workspace struct { // contains filtered or unexported fields}NewWorkspaceWithHandle
Section titled “NewWorkspaceWithHandle”NewWorkspaceWithHandle returns a Workspace backed by handle. Runtime packages use this constructor to make workspace ownership explicit while keeping rules independent of a concrete engine implementation.
func NewWorkspaceWithHandle(handle WorkspaceHandle) *Workspace*Workspace.AddAction
Section titled “*Workspace.AddAction”func (w *Workspace) AddAction(spec ActionSpec) error*Workspace.AddExpressionFunction
Section titled “*Workspace.AddExpressionFunction”AddExpressionFunction registers a pure function whose body is a single expression over its declared parameters.
func (w *Workspace) AddExpressionFunction(spec ExpressionFunctionSpec) error*Workspace.AddFunction
Section titled “*Workspace.AddFunction”func (w *Workspace) AddFunction(spec PureFunctionSpec) error*Workspace.AddGlobal
Section titled “*Workspace.AddGlobal”AddGlobal declares a typed global constant readable from rule, query, and aggregate expressions and from ActionContext.Global. Values bind per session via WithGlobals; a declaration without a default requires every session to supply a value. In .gess sources the equivalent form is (defglobal *name* (type KIND) (default value)).
func (w *Workspace) AddGlobal(spec GlobalSpec) error*Workspace.AddModule
Section titled “*Workspace.AddModule”AddModule records a module declaration. Compile treats identical repeated declarations as idempotent and rejects conflicting metadata.
func (w *Workspace) AddModule(spec ModuleSpec) error*Workspace.AddQuery
Section titled “*Workspace.AddQuery”func (w *Workspace) AddQuery(spec QuerySpec) error*Workspace.AddRule
Section titled “*Workspace.AddRule”func (w *Workspace) AddRule(spec RuleSpec) error*Workspace.AddTemplate
Section titled “*Workspace.AddTemplate”func (w *Workspace) AddTemplate(spec TemplateSpec) error*Workspace.Compile
Section titled “*Workspace.Compile”Compile compiles workspace into an immutable Ruleset.
func (w *Workspace) Compile(ctx context.Context) (*Ruleset, error)*Workspace.RemoveAction
Section titled “*Workspace.RemoveAction”func (w *Workspace) RemoveAction(name string) error*Workspace.RemoveFunction
Section titled “*Workspace.RemoveFunction”func (w *Workspace) RemoveFunction(name string) error*Workspace.RemoveGlobal
Section titled “*Workspace.RemoveGlobal”func (w *Workspace) RemoveGlobal(name string) error*Workspace.RemoveQuery
Section titled “*Workspace.RemoveQuery”func (w *Workspace) RemoveQuery(name string) error*Workspace.RemoveRule
Section titled “*Workspace.RemoveRule”func (w *Workspace) RemoveRule(name string) error*Workspace.ReplaceAction
Section titled “*Workspace.ReplaceAction”func (w *Workspace) ReplaceAction(spec ActionSpec) error*Workspace.ReplaceFunction
Section titled “*Workspace.ReplaceFunction”func (w *Workspace) ReplaceFunction(spec PureFunctionSpec) error*Workspace.ReplaceGlobal
Section titled “*Workspace.ReplaceGlobal”func (w *Workspace) ReplaceGlobal(spec GlobalSpec) error*Workspace.ReplaceQuery
Section titled “*Workspace.ReplaceQuery”func (w *Workspace) ReplaceQuery(spec QuerySpec) error*Workspace.ReplaceRule
Section titled “*Workspace.ReplaceRule”func (w *Workspace) ReplaceRule(spec RuleSpec) errorWorkspaceHandle
Section titled “WorkspaceHandle”WorkspaceHandle is the engine-owned implementation behind a public Workspace.
type WorkspaceHandle interface { AddModule(ModuleSpec) error AddTemplate(TemplateSpec) error AddGlobal(GlobalSpec) error ReplaceGlobal(GlobalSpec) error RemoveGlobal(string) error AddAction(ActionSpec) error ReplaceAction(ActionSpec) error RemoveAction(string) error AddFunction(PureFunctionSpec) error AddExpressionFunction(ExpressionFunctionSpec) error ReplaceFunction(PureFunctionSpec) error RemoveFunction(string) error AddRule(RuleSpec) error ReplaceRule(RuleSpec) error RemoveRule(string) error AddQuery(QuerySpec) error ReplaceQuery(QuerySpec) error RemoveQuery(string) error Compile(context.Context) (*Ruleset, error)}WorkspaceHandleOf
Section titled “WorkspaceHandleOf”WorkspaceHandleOf returns the engine-owned implementation behind w.
func WorkspaceHandleOf(w *Workspace) WorkspaceHandleFunctions
Section titled “Functions”CompareValues
Section titled “CompareValues”CompareValues compares string or numeric values.
func CompareValues(left, right Value) (int, bool)DuplicateKeyValueCapacity
Section titled “DuplicateKeyValueCapacity”DuplicateKeyValueCapacity returns the expected encoded capacity for value.
func DuplicateKeyValueCapacity(value Value) intEncodeValueForDuplicateKey
Section titled “EncodeValueForDuplicateKey”EncodeValueForDuplicateKey appends value’s deterministic duplicate-key representation.
func EncodeValueForDuplicateKey(b *strings.Builder, value Value)FieldsShareable
Section titled “FieldsShareable”FieldsShareable reports whether all field values can be shared without defensive cloning.
func FieldsShareable(fields Fields) boolInt64Len
Section titled “Int64Len”Int64Len returns the decimal byte length of value.
func Int64Len(value int64) intValueShareable
Section titled “ValueShareable”ValueShareable reports whether v can be shared without defensive cloning.
func ValueShareable(v Value) bool