Documentation ¶
Index ¶
- Constants
- func NewTypeChecker() expr.TypeChecker
- type IL
- func (e *IL) AssertType(expr string, finder expr.AttributeDescriptorFinder, expectedType pb.ValueType) error
- func (e *IL) ChangeVocabulary(finder expr.AttributeDescriptorFinder)
- func (e *IL) Eval(expr string, attrs attribute.Bag) (interface{}, error)
- func (e *IL) EvalPredicate(expr string, attrs attribute.Bag) (bool, error)
- func (e *IL) EvalString(expr string, attrs attribute.Bag) (string, error)
- func (e *IL) EvalType(expression string, finder expr.AttributeDescriptorFinder) (pb.ValueType, error)
Constants ¶
const DefaultCacheSize = 1024
DefaultCacheSize is the default size for the expression cache.
Variables ¶
This section is empty.
Functions ¶
func NewTypeChecker ¶
func NewTypeChecker() expr.TypeChecker
NewTypeChecker returns a new TypeChecker implementation.
Types ¶
type IL ¶
type IL struct {
// contains filtered or unexported fields
}
IL is an implementation of expr.Evaluator that also exposes specific methods. Specifically, it can listen to config change events.
func NewILEvaluator ¶
NewILEvaluator returns a new instance of IL.
func (*IL) AssertType ¶
func (e *IL) AssertType(expr string, finder expr.AttributeDescriptorFinder, expectedType pb.ValueType) error
AssertType evaluates the type of expr using the attribute set; if the evaluated type is equal to the expected type we return nil, and return an error otherwise.
func (*IL) ChangeVocabulary ¶
func (e *IL) ChangeVocabulary(finder expr.AttributeDescriptorFinder)
ChangeVocabulary handles changing of the attribute vocabulary.
func (*IL) Eval ¶
Eval evaluates expr using the attr attribute bag and returns the result as interface{}.
func (*IL) EvalPredicate ¶
EvalPredicate evaluates expr using the attr attribute bag and returns the result as bool.
func (*IL) EvalString ¶
EvalString evaluates expr using the attr attribute bag and returns the result as string.