Documentation
¶
Overview ¶
Package schemaexpr constructs and validates the closed P1 database-schema expression language. It is intentionally separate from authorization predicates.
Index ¶
- Constants
- func CanonicalPredicate(engine *Engine, input ir.SchemaPredicateIR) ([]byte, []ir.Diagnostic)
- type CheckSemantics
- type Engine
- func (engine *Engine) And(children ...ir.SchemaPredicateIR) (ir.SchemaPredicateIR, []ir.Diagnostic)
- func (engine *Engine) Constant(value bool) ir.SchemaPredicateIR
- func (engine *Engine) Expression(identity string, operands ...ir.SchemaExprIR) (ir.SchemaExprIR, []ir.Diagnostic)
- func (engine *Engine) Field(fieldID ir.FieldID) (ir.SchemaExprIR, []ir.Diagnostic)
- func (engine *Engine) Literal(logicalType ir.LogicalTypeIR, literal ir.TypedLiteralIR) (ir.SchemaExprIR, []ir.Diagnostic)
- func (engine *Engine) Not(child ir.SchemaPredicateIR) (ir.SchemaPredicateIR, []ir.Diagnostic)
- func (engine *Engine) Or(children ...ir.SchemaPredicateIR) (ir.SchemaPredicateIR, []ir.Diagnostic)
- func (engine *Engine) PlanGenerated(inputs []GeneratedInput) (GeneratedPlan, []ir.Diagnostic)
- func (engine *Engine) Predicate(identity string, operands ...ir.SchemaExprIR) (ir.SchemaPredicateIR, []ir.Diagnostic)
- func (engine *Engine) ValidateExpression(input ir.SchemaExprIR) (ir.SchemaExprIR, []ir.Diagnostic)
- func (engine *Engine) ValidateGenerated(input GeneratedInput) (GeneratedNode, []ir.Diagnostic)
- func (engine *Engine) ValidateIndexExpression(input ir.SchemaExprIR, declaredScope ir.ProviderScope) (ir.SchemaExprIR, []ir.Diagnostic)
- func (engine *Engine) ValidatePredicate(input ir.SchemaPredicateIR) (ir.SchemaPredicateIR, []ir.Diagnostic)
- func (engine *Engine) ValidatePredicateUse(input ir.SchemaPredicateIR, use PredicateUse, declaredScope ir.ProviderScope) (PredicateAnalysis, []ir.Diagnostic)
- type GeneratedInput
- type GeneratedNode
- type GeneratedPlan
- type NullRule
- type PredicateAnalysis
- type PredicateUse
- type Registry
- type SymbolRole
- type SymbolSpec
Constants ¶
View Source
const ( Add = "golem.schema.operator.add.v1" Subtract = "golem.schema.operator.subtract.v1" Multiply = "golem.schema.operator.multiply.v1" Divide = "golem.schema.operator.divide.v1" Remainder = "golem.schema.operator.remainder.v1" Concat = "golem.schema.operator.concat.v1" Lower = "golem.schema.function.lower.v1" Upper = "golem.schema.function.upper.v1" Length = "golem.schema.function.length.v1" Coalesce = "golem.schema.function.coalesce.v1" Equal = "golem.schema.predicate.equal.v1" NotEqual = "golem.schema.predicate.not-equal.v1" Less = "golem.schema.predicate.less.v1" LessEqual = "golem.schema.predicate.less-equal.v1" Greater = "golem.schema.predicate.greater.v1" GreaterEq = "golem.schema.predicate.greater-equal.v1" IsNull = "golem.schema.predicate.is-null.v1" IsNotNull = "golem.schema.predicate.is-not-null.v1" In = "golem.schema.predicate.in.v1" CastInt16ToInt32 = "golem.schema.cast.int16-to-int32.v1" CastInt16ToInt64 = "golem.schema.cast.int16-to-int64.v1" CastInt32ToInt64 = "golem.schema.cast.int32-to-int64.v1" CastInt64ToString = "golem.schema.cast.int64-to-string.v1" )
Variables ¶
This section is empty.
Functions ¶
func CanonicalPredicate ¶
func CanonicalPredicate(engine *Engine, input ir.SchemaPredicateIR) ([]byte, []ir.Diagnostic)
Types ¶
type CheckSemantics ¶
CheckSemantics explicitly preserves SQL CHECK three-valued behavior. It is not authorization/policy truth semantics.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func (*Engine) And ¶
func (engine *Engine) And(children ...ir.SchemaPredicateIR) (ir.SchemaPredicateIR, []ir.Diagnostic)
func (*Engine) Expression ¶
func (engine *Engine) Expression(identity string, operands ...ir.SchemaExprIR) (ir.SchemaExprIR, []ir.Diagnostic)
func (*Engine) Field ¶
func (engine *Engine) Field(fieldID ir.FieldID) (ir.SchemaExprIR, []ir.Diagnostic)
func (*Engine) Literal ¶
func (engine *Engine) Literal(logicalType ir.LogicalTypeIR, literal ir.TypedLiteralIR) (ir.SchemaExprIR, []ir.Diagnostic)
func (*Engine) Not ¶
func (engine *Engine) Not(child ir.SchemaPredicateIR) (ir.SchemaPredicateIR, []ir.Diagnostic)
func (*Engine) Or ¶
func (engine *Engine) Or(children ...ir.SchemaPredicateIR) (ir.SchemaPredicateIR, []ir.Diagnostic)
func (*Engine) PlanGenerated ¶
func (engine *Engine) PlanGenerated(inputs []GeneratedInput) (GeneratedPlan, []ir.Diagnostic)
func (*Engine) Predicate ¶
func (engine *Engine) Predicate(identity string, operands ...ir.SchemaExprIR) (ir.SchemaPredicateIR, []ir.Diagnostic)
func (*Engine) ValidateExpression ¶
func (engine *Engine) ValidateExpression(input ir.SchemaExprIR) (ir.SchemaExprIR, []ir.Diagnostic)
func (*Engine) ValidateGenerated ¶
func (engine *Engine) ValidateGenerated(input GeneratedInput) (GeneratedNode, []ir.Diagnostic)
func (*Engine) ValidateIndexExpression ¶
func (engine *Engine) ValidateIndexExpression(input ir.SchemaExprIR, declaredScope ir.ProviderScope) (ir.SchemaExprIR, []ir.Diagnostic)
func (*Engine) ValidatePredicate ¶
func (engine *Engine) ValidatePredicate(input ir.SchemaPredicateIR) (ir.SchemaPredicateIR, []ir.Diagnostic)
func (*Engine) ValidatePredicateUse ¶
func (engine *Engine) ValidatePredicateUse(input ir.SchemaPredicateIR, use PredicateUse, declaredScope ir.ProviderScope) (PredicateAnalysis, []ir.Diagnostic)
type GeneratedInput ¶
type GeneratedInput struct {
FieldID ir.FieldID
Expr ir.SchemaExprIR
Scope ir.ProviderScope
Span ir.SourceSpan
}
type GeneratedNode ¶
type GeneratedNode struct {
FieldID ir.FieldID
Expr ir.SchemaExprIR
Provider ir.ProviderScope
DependsOn []ir.FieldID
}
type GeneratedPlan ¶
type GeneratedPlan struct{ Nodes []GeneratedNode }
type PredicateAnalysis ¶
type PredicateAnalysis struct {
Predicate ir.SchemaPredicateIR
Provider ir.ProviderScope
Check *CheckSemantics
}
type PredicateUse ¶
type PredicateUse string
const ( UseCheck PredicateUse = "check" UsePartialIndex PredicateUse = "partialIndex" )
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *Registry
func (*Registry) Register ¶
func (registry *Registry) Register(spec SymbolSpec) *ir.Diagnostic
Register adds one fixed-signature typed function or cast. Operators and predicate vocabulary are closed and cannot be extended here.
func (*Registry) Symbols ¶
func (registry *Registry) Symbols() []ir.SchemaSymbolRef
type SymbolRole ¶
type SymbolRole string
const ( RoleExpression SymbolRole = "expression" RolePredicate SymbolRole = "predicate" )
type SymbolSpec ¶
type SymbolSpec struct {
Ref ir.SchemaSymbolRef
Role SymbolRole
Inputs []ir.LogicalTypeIR
Output ir.LogicalTypeIR
Variadic bool
MinimumArity int
NullRule NullRule
// contains filtered or unexported fields
}
SymbolSpec is the registration boundary for typed provider functions and casts. Built-in polymorphic symbols use the same registry internally.
Click to show internal directories.
Click to hide internal directories.