Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Expression ¶
type Expression interface { // Evaluate evaluates this compiled expression against the attribute bag. Evaluate(attributes attribute.Bag) (interface{}, error) // EvaluateBoolean evaluates this compiled expression against the attribute bag and returns the result as boolean. // panics if the expression does not return a boolean. EvaluateBoolean(attributes attribute.Bag) (bool, error) // EvaluateString evaluates this compiled expression against the attribute bag and returns the result as string. // panics if the expression does not return a string. EvaluateString(attributes attribute.Bag) (string, error) // EvaluateDouble evaluates this compiled expression against the attribute bag and returns the result as float64. // panics if the expression does not return a float64. EvaluateDouble(attribute attribute.Bag) (float64, error) // EvaluateInteger evaluates this compiled expression against the attribute bag and returns the result as int64. // panics if the expression does not return a int64. EvaluateInteger(attribute attribute.Bag) (int64, error) }
Expression represents a precompiled expression that can be immediately evaluated. It holds no cache and does not listen to any events. If the configuration changes, the CompiledExpression needs to be discarded and created again.
type ExpressionBuilder ¶
type ExpressionBuilder struct {
// contains filtered or unexported fields
}
ExpressionBuilder is used to create a set of pre-compiled expressions, backed by the same program and interpreter instance. It is meant to be used to create a large number of precompiled expressions that are backed by an efficient set of shared, immutable objects.
func NewBuilder ¶
func NewBuilder(finder ast.AttributeDescriptorFinder) *ExpressionBuilder
NewBuilder returns a new ExpressionBuilder
func (*ExpressionBuilder) Compile ¶
func (e *ExpressionBuilder) Compile(text string) (Expression, descriptor.ValueType, error)
Compile the given text and return a pre-compiled expression object.
Click to show internal directories.
Click to hide internal directories.