Documentation
¶
Index ¶
- Constants
- func IsNullableTypeRef(typeRef TypeRef) bool
- type AttachmentClause
- type BlockExpression
- type CallExpression
- type CastExpression
- type Cmplx
- type CommentStatement
- type DescriptionStatement
- type DictTypeRef
- type DocumentTypeRef
- type Expression
- type FQN
- type FactStatement
- type FieldAccessExpression
- type FloatLiteral
- type Identifier
- type ImportClause
- type IndexAccessExpression
- type InfixExpression
- type IntegerLiteral
- type IsDefinedExpression
- type IsEmptyExpression
- type LambdaExpression
- type ListLiteral
- type ListTypeRef
- type MapEntry
- type MapLiteral
- type NamespaceStatement
- type Node
- type NullLiteral
- type NullableTypeRef
- type NumberTypeRef
- type PipelineHoleExpression
- type PolicyStatement
- type Positionable
- type PrecedingCommentExpression
- type Program
- type RecordTypeRef
- type RuleExportStatement
- type RuleStatement
- type ShapeExportStatement
- type ShapeField
- type ShapeStatement
- type ShapeTypeRef
- type Statement
- type StringLiteral
- type StringTypeRef
- type TagStatement
- type TernaryExpression
- type TitleStatement
- type TrailingCommentExpression
- type TransformExpression
- type TrinaryLiteral
- type TrinaryTypeRef
- type TypeRef
- type TypeRefConstraint
- type UnaryExpression
- type UseStatement
- type VarDeclaration
- type VersionStatement
- type WithClause
Constants ¶
const FQNSeparator = "/"
Variables ¶
This section is empty.
Functions ¶
func IsNullableTypeRef ¶ added in v0.0.4
Types ¶
type AttachmentClause ¶
type AttachmentClause struct {
What string // Name of the attachment
As Expression // Value of the attachment
// contains filtered or unexported fields
}
func NewAttachmentClause ¶
func NewAttachmentClause(what string, as Expression, ssp tokens.Range) *AttachmentClause
func (AttachmentClause) String ¶
func (a AttachmentClause) String() string
type BlockExpression ¶
type BlockExpression struct {
Statements []Statement
Yield Expression
// contains filtered or unexported fields
}
func NewBlockExpression ¶
func NewBlockExpression(statements []Statement, yield Expression, ssp tokens.Range) *BlockExpression
func (*BlockExpression) String ¶
func (b *BlockExpression) String() string
type CallExpression ¶
type CallExpression struct {
Callee Expression
Arguments []Expression
Memoized bool
MemoizeTTL *time.Duration
// contains filtered or unexported fields
}
func NewCallExpression ¶
func NewCallExpression(callee Expression, arguments []Expression, memoized bool, memoizeTTL *time.Duration, ssp tokens.Range) *CallExpression
func (*CallExpression) String ¶
func (c *CallExpression) String() string
type CastExpression ¶
type CastExpression struct {
Expr Expression
TargetType TypeRef
// contains filtered or unexported fields
}
func NewCastExpression ¶
func NewCastExpression(expr Expression, targetType TypeRef, ssp tokens.Range) *CastExpression
func (*CastExpression) String ¶
func (c *CastExpression) String() string
type CommentStatement ¶
type CommentStatement struct {
Content string
// contains filtered or unexported fields
}
func NewCommentStatement ¶
func NewCommentStatement(content string, ssp tokens.Range) *CommentStatement
func (CommentStatement) String ¶
func (c CommentStatement) String() string
type DescriptionStatement ¶ added in v0.0.3
type DescriptionStatement struct {
Value string
// contains filtered or unexported fields
}
DescriptionStatement is a policy metadata line: description "…".
func NewDescriptionStatement ¶ added in v0.0.3
func NewDescriptionStatement(value string, ssp tokens.Range) *DescriptionStatement
func (*DescriptionStatement) String ¶ added in v0.0.3
func (s *DescriptionStatement) String() string
type DictTypeRef ¶ added in v0.0.3
type DictTypeRef struct {
ValueType TypeRef
// contains filtered or unexported fields
}
func NewDictTypeRef ¶ added in v0.0.3
func NewDictTypeRef(valueType TypeRef, ssp tokens.Range) *DictTypeRef
func (DictTypeRef) AddConstraint ¶ added in v0.0.3
func (b DictTypeRef) AddConstraint(constraint *TypeRefConstraint) error
func (DictTypeRef) GetConstraints ¶ added in v0.0.3
func (b DictTypeRef) GetConstraints() []*TypeRefConstraint
func (*DictTypeRef) String ¶ added in v0.0.3
func (m *DictTypeRef) String() string
type DocumentTypeRef ¶
type DocumentTypeRef struct {
// contains filtered or unexported fields
}
func NewDocumentTypeRef ¶
func NewDocumentTypeRef(ssp tokens.Range) *DocumentTypeRef
func (DocumentTypeRef) AddConstraint ¶
func (b DocumentTypeRef) AddConstraint(constraint *TypeRefConstraint) error
func (DocumentTypeRef) GetConstraints ¶
func (b DocumentTypeRef) GetConstraints() []*TypeRefConstraint
func (*DocumentTypeRef) String ¶
func (d *DocumentTypeRef) String() string
type Expression ¶
type Expression interface {
Node
// contains filtered or unexported methods
}
func NewStringLiteral ¶
func NewStringLiteral(value string, ssp tokens.Range) Expression
type FQN ¶
type FQN struct {
Parts []string
// contains filtered or unexported fields
}
func (FQN) IsParentOf ¶
func (FQN) LastSegment ¶
LastSegment returns the last segment of the FQN
type FactStatement ¶
type FactStatement struct {
Name string // Name of the fact
Type TypeRef // Type of the fact
Alias string // Exposed name of the fact
Default Expression // Default value expression (optional)
Optional bool // Whether the fact is optional (default: false, i.e., required)
// contains filtered or unexported fields
}
func NewFactStatement ¶
func NewFactStatement(name string, typeRef TypeRef, alias string, defaultExpr Expression, optional bool, ssp tokens.Range) *FactStatement
func (FactStatement) String ¶
func (f FactStatement) String() string
type FieldAccessExpression ¶
type FieldAccessExpression struct {
Left Expression
Field string
// contains filtered or unexported fields
}
func NewFieldAccessExpression ¶
func NewFieldAccessExpression(left Expression, field string, ssp tokens.Range) *FieldAccessExpression
func (*FieldAccessExpression) String ¶
func (f *FieldAccessExpression) String() string
type FloatLiteral ¶
type FloatLiteral struct {
Value float64
// contains filtered or unexported fields
}
FloatLiteral represents a float literal
func NewFloatLiteral ¶
func NewFloatLiteral(value float64, ssp tokens.Range) *FloatLiteral
func (*FloatLiteral) String ¶
func (f *FloatLiteral) String() string
type Identifier ¶
type Identifier struct {
Value string
// contains filtered or unexported fields
}
Identifier represents an identifier
func NewIdentifier ¶
func NewIdentifier(value string, ssp tokens.Range) *Identifier
func (*Identifier) String ¶
func (i *Identifier) String() string
type ImportClause ¶
type ImportClause struct {
RuleToImport string // The name of the rule being imported
FromPolicyFQN *FQN // The source identifier - segmented by '/'
Withs []*WithClause // Inline with import clause
// contains filtered or unexported fields
}
'import value|decision @ident from @string { @WithClause }'
func NewImportClause ¶
func NewImportClause(ruleToImport string, fromPolicyFQN *FQN, withs []*WithClause, ssp tokens.Range) *ImportClause
func (ImportClause) String ¶
func (i ImportClause) String() string
type IndexAccessExpression ¶
type IndexAccessExpression struct {
Left Expression
Index Expression
// contains filtered or unexported fields
}
func NewIndexAccessExpression ¶
func NewIndexAccessExpression(left Expression, index Expression, ssp tokens.Range) *IndexAccessExpression
func (*IndexAccessExpression) String ¶
func (i *IndexAccessExpression) String() string
type InfixExpression ¶
type InfixExpression struct {
Left Expression
Operator string
Right Expression
// contains filtered or unexported fields
}
func NewInfixExpression ¶
func NewInfixExpression(left Expression, right Expression, operator string, ssp tokens.Range) *InfixExpression
func (*InfixExpression) String ¶
func (e *InfixExpression) String() string
type IntegerLiteral ¶
type IntegerLiteral struct {
// under the hood, all values are floats
Value float64
// contains filtered or unexported fields
}
IntegerLiteral represents an integer literal
func NewIntegerLiteral ¶
func NewIntegerLiteral(value int64, ssp tokens.Range) *IntegerLiteral
func (*IntegerLiteral) String ¶
func (i *IntegerLiteral) String() string
type IsDefinedExpression ¶
type IsDefinedExpression struct {
Left Expression
// contains filtered or unexported fields
}
func NewIsDefinedExpression ¶
func NewIsDefinedExpression(left Expression, ssp tokens.Range) *IsDefinedExpression
func (*IsDefinedExpression) String ¶
func (e *IsDefinedExpression) String() string
type IsEmptyExpression ¶
type IsEmptyExpression struct {
Left Expression
// contains filtered or unexported fields
}
func NewIsEmptyExpression ¶
func NewIsEmptyExpression(left Expression, ssp tokens.Range) *IsEmptyExpression
func (*IsEmptyExpression) String ¶
func (e *IsEmptyExpression) String() string
type LambdaExpression ¶ added in v0.0.3
type LambdaExpression struct {
Params []string
Body *BlockExpression
// contains filtered or unexported fields
}
LambdaExpression is an inline block-bodied lambda: (a, b) => { yield ... }
func NewLambdaExpression ¶ added in v0.0.3
func NewLambdaExpression(params []string, body *BlockExpression, ssp tokens.Range) *LambdaExpression
func (*LambdaExpression) String ¶ added in v0.0.3
func (l *LambdaExpression) String() string
type ListLiteral ¶
type ListLiteral struct {
Values []Expression
// contains filtered or unexported fields
}
func NewListLiteral ¶
func NewListLiteral(values []Expression, ssp tokens.Range) *ListLiteral
func (*ListLiteral) String ¶
func (l *ListLiteral) String() string
type ListTypeRef ¶
type ListTypeRef struct {
ElemType TypeRef
// contains filtered or unexported fields
}
func NewListTypeRef ¶
func NewListTypeRef(elemType TypeRef, ssp tokens.Range) *ListTypeRef
func (ListTypeRef) AddConstraint ¶
func (b ListTypeRef) AddConstraint(constraint *TypeRefConstraint) error
func (ListTypeRef) GetConstraints ¶
func (b ListTypeRef) GetConstraints() []*TypeRefConstraint
func (*ListTypeRef) String ¶
func (l *ListTypeRef) String() string
type MapEntry ¶
type MapEntry struct {
Key Expression
Value Expression
}
type MapLiteral ¶
type MapLiteral struct {
Entries []MapEntry
// contains filtered or unexported fields
}
func NewMapLiteral ¶
func NewMapLiteral(entries []MapEntry, ssp tokens.Range) *MapLiteral
func (*MapLiteral) String ¶
func (m *MapLiteral) String() string
type NamespaceStatement ¶
type NamespaceStatement struct {
Name FQN // Fully Qualified Name (FQN) of the namespace
// contains filtered or unexported fields
}
func NewNamespaceStatement ¶
func NewNamespaceStatement(name FQN, ssp tokens.Range) *NamespaceStatement
func (NamespaceStatement) String ¶
func (n NamespaceStatement) String() string
type Node ¶
type Node interface {
Positionable
String() string
Kind() string
}
type NullLiteral ¶
type NullLiteral struct {
// contains filtered or unexported fields
}
func NewNullLiteral ¶
func NewNullLiteral(ssp tokens.Range) *NullLiteral
func (*NullLiteral) String ¶
func (n *NullLiteral) String() string
type NullableTypeRef ¶ added in v0.0.4
type NullableTypeRef struct {
Inner TypeRef
// contains filtered or unexported fields
}
func NewNullableTypeRef ¶ added in v0.0.4
func NewNullableTypeRef(inner TypeRef, ssp tokens.Range) *NullableTypeRef
func (*NullableTypeRef) AddConstraint ¶ added in v0.0.4
func (n *NullableTypeRef) AddConstraint(constraint *TypeRefConstraint) error
func (*NullableTypeRef) GetConstraints ¶ added in v0.0.4
func (n *NullableTypeRef) GetConstraints() []*TypeRefConstraint
func (*NullableTypeRef) String ¶ added in v0.0.4
func (n *NullableTypeRef) String() string
type NumberTypeRef ¶
type NumberTypeRef struct {
// contains filtered or unexported fields
}
func NewNumberTypeRef ¶
func NewNumberTypeRef(ssp tokens.Range) *NumberTypeRef
func (NumberTypeRef) AddConstraint ¶
func (b NumberTypeRef) AddConstraint(constraint *TypeRefConstraint) error
func (NumberTypeRef) GetConstraints ¶
func (b NumberTypeRef) GetConstraints() []*TypeRefConstraint
func (*NumberTypeRef) String ¶
func (n *NumberTypeRef) String() string
type PipelineHoleExpression ¶ added in v0.0.3
type PipelineHoleExpression struct {
// contains filtered or unexported fields
}
PipelineHoleExpression is a placeholder used by pipeline lowering.
func NewPipelineHoleExpression ¶ added in v0.0.3
func NewPipelineHoleExpression(ssp tokens.Range) *PipelineHoleExpression
func (*PipelineHoleExpression) String ¶ added in v0.0.3
func (p *PipelineHoleExpression) String() string
type PolicyStatement ¶
type PolicyStatement struct {
Name string
Statements []Statement
// contains filtered or unexported fields
}
func NewPolicyStatement ¶
func NewPolicyStatement(name string, statements []Statement, ssp tokens.Range) *PolicyStatement
func (PolicyStatement) String ¶
func (p PolicyStatement) String() string
type Positionable ¶
type PrecedingCommentExpression ¶
type PrecedingCommentExpression struct {
CommentContent string
Wrap Expression
// contains filtered or unexported fields
}
func NewPrecedingCommentExpression ¶
func NewPrecedingCommentExpression(commentContent string, wrap Expression, ssp tokens.Range) *PrecedingCommentExpression
func (PrecedingCommentExpression) String ¶
func (p PrecedingCommentExpression) String() string
type RecordTypeRef ¶
type RecordTypeRef struct {
Fields []TypeRef
// contains filtered or unexported fields
}
func NewRecordTypeRef ¶
func NewRecordTypeRef(fields []TypeRef, ssp tokens.Range) *RecordTypeRef
func (RecordTypeRef) AddConstraint ¶
func (b RecordTypeRef) AddConstraint(constraint *TypeRefConstraint) error
func (RecordTypeRef) GetConstraints ¶
func (b RecordTypeRef) GetConstraints() []*TypeRefConstraint
func (*RecordTypeRef) String ¶
func (r *RecordTypeRef) String() string
type RuleExportStatement ¶
type RuleExportStatement struct {
Of string // Name of the exported variable or decision
Attachments []*AttachmentClause // Optional attachments for the export
// contains filtered or unexported fields
}
func NewRuleExportStatement ¶
func NewRuleExportStatement(of string, attachments []*AttachmentClause, ssp tokens.Range) *RuleExportStatement
func (RuleExportStatement) String ¶
func (v RuleExportStatement) String() string
type RuleStatement ¶
type RuleStatement struct {
RuleName string
Default Expression
When Expression
Body Expression
// contains filtered or unexported fields
}
func NewRuleStatement ¶
func NewRuleStatement(ruleName string, defaultExpr Expression, whenExpr Expression, bodyExpr Expression, ssp tokens.Range) *RuleStatement
func (RuleStatement) String ¶
func (r RuleStatement) String() string
type ShapeExportStatement ¶
type ShapeExportStatement struct {
Name string
// contains filtered or unexported fields
}
func NewShapeExportStatement ¶
func NewShapeExportStatement(name string, ssp tokens.Range) *ShapeExportStatement
func (ShapeExportStatement) String ¶
func (s ShapeExportStatement) String() string
type ShapeField ¶
type ShapeStatement ¶
type ShapeStatement struct {
Name string
Simple TypeRef
Complex *Cmplx
// contains filtered or unexported fields
}
func NewShapeStatement ¶
func (*ShapeStatement) String ¶
func (s *ShapeStatement) String() string
type ShapeTypeRef ¶
type ShapeTypeRef struct {
Ref *FQN // Fully Qualified Name (FQN) of the shape
// contains filtered or unexported fields
}
func NewShapeTypeRef ¶
func NewShapeTypeRef(ref *FQN, ssp tokens.Range) *ShapeTypeRef
func (ShapeTypeRef) AddConstraint ¶
func (b ShapeTypeRef) AddConstraint(constraint *TypeRefConstraint) error
func (ShapeTypeRef) GetConstraints ¶
func (b ShapeTypeRef) GetConstraints() []*TypeRefConstraint
func (*ShapeTypeRef) String ¶
func (s *ShapeTypeRef) String() string
type StringLiteral ¶
type StringLiteral struct {
Value string
// contains filtered or unexported fields
}
StringLiteral represents a string literal
func (*StringLiteral) String ¶
func (s *StringLiteral) String() string
type StringTypeRef ¶
type StringTypeRef struct {
// contains filtered or unexported fields
}
func NewStringTypeRef ¶
func NewStringTypeRef(ssp tokens.Range) *StringTypeRef
func (StringTypeRef) AddConstraint ¶
func (b StringTypeRef) AddConstraint(constraint *TypeRefConstraint) error
func (StringTypeRef) GetConstraints ¶
func (b StringTypeRef) GetConstraints() []*TypeRefConstraint
func (*StringTypeRef) String ¶
func (s *StringTypeRef) String() string
type TagStatement ¶ added in v0.0.3
TagStatement is a policy metadata line: tag "key" = "value".
func NewTagStatement ¶ added in v0.0.3
func NewTagStatement(key, value string, ssp tokens.Range) *TagStatement
func (*TagStatement) String ¶ added in v0.0.3
func (s *TagStatement) String() string
type TernaryExpression ¶
type TernaryExpression struct {
Condition Expression
ThenBranch Expression
ElseBranch Expression
// contains filtered or unexported fields
}
func NewTernaryExpression ¶
func NewTernaryExpression(condition Expression, thenBranch Expression, elseBranch Expression, ssp tokens.Range) *TernaryExpression
func (*TernaryExpression) String ¶
func (t *TernaryExpression) String() string
type TitleStatement ¶ added in v0.0.3
type TitleStatement struct {
Value string
// contains filtered or unexported fields
}
TitleStatement is a policy metadata line: title "…".
func NewTitleStatement ¶ added in v0.0.3
func NewTitleStatement(value string, ssp tokens.Range) *TitleStatement
func (*TitleStatement) String ¶ added in v0.0.3
func (s *TitleStatement) String() string
type TrailingCommentExpression ¶
type TrailingCommentExpression struct {
CommentContent string
Wrap Expression
// contains filtered or unexported fields
}
func NewTrailingCommentExpression ¶
func NewTrailingCommentExpression(commentContent string, wrap Expression, ssp tokens.Range) *TrailingCommentExpression
func (TrailingCommentExpression) String ¶
func (t TrailingCommentExpression) String() string
type TransformExpression ¶
type TransformExpression struct {
Argument Expression
Transformer string
// contains filtered or unexported fields
}
func NewTransformExpression ¶
func NewTransformExpression(argument Expression, transformer string, ssp tokens.Range) *TransformExpression
func (*TransformExpression) String ¶
func (t *TransformExpression) String() string
type TrinaryLiteral ¶
TrinaryLiteral represents a trinary literal
func NewTrinaryLiteral ¶
func NewTrinaryLiteral(value trinary.Value, ssp tokens.Range) *TrinaryLiteral
func (*TrinaryLiteral) String ¶
func (b *TrinaryLiteral) String() string
type TrinaryTypeRef ¶
type TrinaryTypeRef struct {
// contains filtered or unexported fields
}
func NewTrinaryTypeRef ¶
func NewTrinaryTypeRef(ssp tokens.Range) *TrinaryTypeRef
func (TrinaryTypeRef) AddConstraint ¶
func (b TrinaryTypeRef) AddConstraint(constraint *TypeRefConstraint) error
func (TrinaryTypeRef) GetConstraints ¶
func (b TrinaryTypeRef) GetConstraints() []*TypeRefConstraint
func (*TrinaryTypeRef) String ¶
func (b *TrinaryTypeRef) String() string
type TypeRef ¶
type TypeRef interface {
Node
GetConstraints() []*TypeRefConstraint
AddConstraint(*TypeRefConstraint) error
// contains filtered or unexported methods
}
func UnwrapNullableTypeRef ¶ added in v0.0.4
type TypeRefConstraint ¶
type TypeRefConstraint struct {
Name string
Args []Expression
// contains filtered or unexported fields
}
func NewTypeRefConstraint ¶
func NewTypeRefConstraint(name string, args []Expression, ssp tokens.Range) *TypeRefConstraint
type UnaryExpression ¶
type UnaryExpression struct {
Operator string
Right Expression
// contains filtered or unexported fields
}
func NewUnaryExpression ¶
func NewUnaryExpression(operator string, right Expression, ssp tokens.Range) *UnaryExpression
func (*UnaryExpression) String ¶
func (u *UnaryExpression) String() string
type UseStatement ¶
type UseStatement struct {
Modules []string // List of modules to use
RelativeFrom string //
LibFrom []string // Optional library information
As string
// contains filtered or unexported fields
}
func NewUseStatement ¶
func (*UseStatement) String ¶
func (s *UseStatement) String() string
type VarDeclaration ¶
type VarDeclaration struct {
Name string
Type TypeRef
Value Expression
// contains filtered or unexported fields
}
func NewVarDeclaration ¶
func NewVarDeclaration(name string, typeRef TypeRef, value Expression, ssp tokens.Range) *VarDeclaration
func (VarDeclaration) String ¶
func (v VarDeclaration) String() string
type VersionStatement ¶ added in v0.0.3
type VersionStatement struct {
Literal string
// contains filtered or unexported fields
}
VersionStatement is a policy metadata line: version "…" (SemVer validated at index time).
func NewVersionStatement ¶ added in v0.0.3
func NewVersionStatement(literal string, ssp tokens.Range) *VersionStatement
func (*VersionStatement) String ¶ added in v0.0.3
func (s *VersionStatement) String() string
type WithClause ¶
type WithClause struct {
Name string // Name of the with clause - this is also the name that the target policy exposes
Expr Expression // Value associated with the with clause
// contains filtered or unexported fields
}
'with @ident as @string' Represents a 'with' clause in an import statement, allowing for additional context or configuration.
func NewWithClause ¶
func NewWithClause(name string, expr Expression, ssp tokens.Range) *WithClause
func (WithClause) String ¶
func (w WithClause) String() string
Source Files
¶
- access.go
- block.go
- call.go
- cast.go
- comment.go
- export.go
- export_shape.go
- fact.go
- fqn.go
- ident.go
- import.go
- infix.go
- is.go
- lambda.go
- let.go
- literal_float.go
- literal_integer.go
- literal_list.go
- literal_map.go
- literal_null.go
- literal_string.go
- literal_trinary.go
- node.go
- pipeline_hole.go
- policy_metadata_description.go
- policy_metadata_tag.go
- policy_metadata_title.go
- policy_metadata_version.go
- program.go
- rule.go
- shape.go
- ternary.go
- transform.go
- typeref.go
- typeref_constraint_args_gen.go
- typeref_dict.go
- typeref_document.go
- typeref_list.go
- typeref_nullable.go
- typeref_number.go
- typeref_record.go
- typeref_shape.go
- typeref_string.go
- typeref_trinary.go
- unary.go
- use.go