Documentation
¶
Index ¶
- func Avg(nodes ...adapters.Node) adapters.Node
- func Call(funcName string, argNodes ...adapters.Node) adapters.Node
- func Coalesce(definition string, or adapters.Node) adapters.Node
- func Equal(first, second adapters.Node) adapters.Node
- func Exists(definition string) adapters.Node
- func Greater(first, second adapters.Node) adapters.Node
- func GreaterOrEqual(first, second adapters.Node) adapters.Node
- func HasPrefix(text, prefix adapters.Node) adapters.Node
- func HasSuffix(text, suffix adapters.Node) adapters.Node
- func If(condition, thenBranch adapters.Node, elseBranch ...adapters.Node) adapters.Node
- func IsEmpty(node adapters.Node) adapters.Node
- func Not(expression adapters.Node) adapters.Node
- func Or(nodes ...adapters.Node) adapters.Node
- func Reference(key string) adapters.Node
- func Smaller(first, second adapters.Node) adapters.Node
- func SmallerOrEqual(first, second adapters.Node) adapters.Node
- func Sum(nodes ...adapters.Node) adapters.Node
- type AvgNode
- type CallNode
- type CoalesceNode
- type EqualNode
- type ExistsNode
- type GreaterNode
- type HasPrefixNode
- type HasSuffixNode
- type IfNode
- type IsEmptyNode
- type LiteralNode
- func (node *LiteralNode) Call(ctx context.Context, key string, args ...adapters.Value) adapters.Value
- func (node *LiteralNode) Definition(key string) (adapters.Value, bool)
- func (node *LiteralNode) Eval(scope adapters.Scope) adapters.Value
- func (node *LiteralNode) Register(codex adapters.Codex) error
- func (node *LiteralNode) Scalar() string
- func (node *LiteralNode) Shape() []adapters.KeyNode
- func (node *LiteralNode) Type() adapters.NodeType
- func (node *LiteralNode) Value() any
- type NotNode
- type OrNode
- type ReferenceNode
- type SmallerNode
- type SumNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Call ¶
Call defines a function call. It tries to find the provided funcName under it's evaluated scope and call it with the given args. It will evaluate all args before providing them to the funcName. Returns a NodeError if the funcName is not found, callable or has wrong arguments. Context doesn't need to be given as an argument, and is handled automatically by nodes.
func Equal ¶
Equal defines an equality node, all input nodes should evaluate to the same type, and be not nil. Returns a boolean value indicating whether the inputs are equal.
func Greater ¶
Greater defines a greater node, all input nodes should evaluate to the same type, and be not nil. Returns a boolean value indicating whether the first node is greater than the second.
func GreaterOrEqual ¶
Greater defines a greater node, all input nodes should evaluate to the same type, and be not nil. Returns a boolean value indicating whether the first node is greater or equal than the second.
func HasPrefix ¶
Equal defines a prefix node, all input nodes should evaluate to the same type, and be not nil. Returns a boolean value indicating whether the text has the prefix.
func HasSuffix ¶
Equal defines a suffix node, all input nodes should evaluate to the same type, and be not nil. Returns a boolean value indicating whether the text has the suffix.
func Not ¶
Not defines a not node, the input node should evaluate to boolean and be not-nil. It inverts the result of the evaluated boolean.
func Or ¶
Or defines an or node, there must be at least one input. It returns the value of the first error, true boolean or non-boolean expression.
func Smaller ¶
Smaller defines a smaller node, all input nodes should evaluate to the same type, and be not nil. Returns a boolean value indicating whether the first node is smaller to the second.
func SmallerOrEqual ¶
SmallerOrEqual defines a greater node, all input nodes should evaluate to the same type, and be not nil. Returns a boolean value indicating whether the first node is smaller or equal to the second.
Types ¶
type CoalesceNode ¶ added in v0.1.9
type CoalesceNode struct {
// contains filtered or unexported fields
}
func (*CoalesceNode) Eval ¶ added in v0.1.9
func (node *CoalesceNode) Eval(scope adapters.Scope) adapters.Value
func (*CoalesceNode) Register ¶ added in v0.1.9
func (node *CoalesceNode) Register(codex adapters.Codex) error
func (*CoalesceNode) Scalar ¶ added in v0.1.9
func (node *CoalesceNode) Scalar() string
func (*CoalesceNode) Shape ¶ added in v0.1.9
func (node *CoalesceNode) Shape() []adapters.KeyNode
func (*CoalesceNode) Type ¶ added in v0.1.9
func (node *CoalesceNode) Type() adapters.NodeType
type ExistsNode ¶ added in v0.1.9
type ExistsNode struct {
// contains filtered or unexported fields
}
func (*ExistsNode) Eval ¶ added in v0.1.9
func (node *ExistsNode) Eval(scope adapters.Scope) adapters.Value
func (*ExistsNode) Register ¶ added in v0.1.9
func (node *ExistsNode) Register(codex adapters.Codex) error
func (*ExistsNode) Scalar ¶ added in v0.1.9
func (node *ExistsNode) Scalar() string
func (*ExistsNode) Shape ¶ added in v0.1.9
func (node *ExistsNode) Shape() []adapters.KeyNode
func (*ExistsNode) Type ¶ added in v0.1.9
func (node *ExistsNode) Type() adapters.NodeType
type GreaterNode ¶
type GreaterNode struct {
// contains filtered or unexported fields
}
func (*GreaterNode) Scalar ¶
func (node *GreaterNode) Scalar() string
func (*GreaterNode) Shape ¶
func (node *GreaterNode) Shape() []adapters.KeyNode
func (*GreaterNode) Type ¶
func (node *GreaterNode) Type() adapters.NodeType
type HasPrefixNode ¶
type HasPrefixNode struct {
// contains filtered or unexported fields
}
func (*HasPrefixNode) Scalar ¶
func (node *HasPrefixNode) Scalar() string
func (*HasPrefixNode) Shape ¶
func (node *HasPrefixNode) Shape() []adapters.KeyNode
func (*HasPrefixNode) Type ¶
func (node *HasPrefixNode) Type() adapters.NodeType
type HasSuffixNode ¶
type HasSuffixNode struct {
// contains filtered or unexported fields
}
func (*HasSuffixNode) Scalar ¶
func (node *HasSuffixNode) Scalar() string
func (*HasSuffixNode) Shape ¶
func (node *HasSuffixNode) Shape() []adapters.KeyNode
func (*HasSuffixNode) Type ¶
func (node *HasSuffixNode) Type() adapters.NodeType
type IsEmptyNode ¶
type IsEmptyNode struct {
// contains filtered or unexported fields
}
func (*IsEmptyNode) Scalar ¶
func (node *IsEmptyNode) Scalar() string
func (*IsEmptyNode) Shape ¶
func (node *IsEmptyNode) Shape() []adapters.KeyNode
func (*IsEmptyNode) Type ¶ added in v0.1.8
func (node *IsEmptyNode) Type() adapters.NodeType
type LiteralNode ¶
type LiteralNode struct {
// contains filtered or unexported fields
}
func Literal ¶
func Literal(value any) *LiteralNode
Literal represents a value/node. Use Literal with functions to define callable definitions. Use Literal with structs or maps to define definitions with children attributes. time.Time is serialized as time(RFC3339) by default.
func (*LiteralNode) Definition ¶
func (node *LiteralNode) Definition(key string) (adapters.Value, bool)
func (*LiteralNode) Scalar ¶
func (node *LiteralNode) Scalar() string
func (*LiteralNode) Shape ¶
func (node *LiteralNode) Shape() []adapters.KeyNode
func (*LiteralNode) Type ¶
func (node *LiteralNode) Type() adapters.NodeType
func (*LiteralNode) Value ¶
func (node *LiteralNode) Value() any
type ReferenceNode ¶
type ReferenceNode struct {
// contains filtered or unexported fields
}
func (*ReferenceNode) Register ¶ added in v0.1.7
func (node *ReferenceNode) Register(codex adapters.Codex) error
func (*ReferenceNode) Scalar ¶
func (node *ReferenceNode) Scalar() string
func (*ReferenceNode) Shape ¶
func (node *ReferenceNode) Shape() []adapters.KeyNode
func (*ReferenceNode) Type ¶
func (node *ReferenceNode) Type() adapters.NodeType
type SmallerNode ¶
type SmallerNode struct {
// contains filtered or unexported fields
}
func (*SmallerNode) Scalar ¶
func (node *SmallerNode) Scalar() string
func (*SmallerNode) Shape ¶
func (node *SmallerNode) Shape() []adapters.KeyNode
func (*SmallerNode) Type ¶
func (node *SmallerNode) Type() adapters.NodeType