compiled

package
v0.0.0-...-fe632b3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

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

NewBuilder returns a new ExpressionBuilder

func (*ExpressionBuilder) Compile

Compile the given text and return a pre-compiled expression object.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL