Documentation
¶
Index ¶
- func Eval(term string, input interface{}, opt *Opt) (interface{}, error)
- func EvalBool(term string, input interface{}, opt *Opt) bool
- func EvalFloat64(term string, input interface{}, opt *Opt) float64
- func EvalInt(term string, input interface{}, opt *Opt) int
- func EvalString(term string, input interface{}, opt *Opt) string
- func EvalStringInterfaceMap(term string, input interface{}, opt *Opt) map[string]interface{}
- func EvalStringSlice(term string, input interface{}, opt *Opt) []string
- func EvalStringStringMap(term string, input interface{}, opt *Opt) map[string]string
- type AstNode
- type Expr
- type Opt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EvalBool ¶
EvalBool runs term against input, returning the boolean result. If an error occurs, the opt.OnError is returned.
func EvalFloat64 ¶
EvalFloat64 runs term against input, returning the float64 result. If an error occurs, the opt.OnError is returned.
func EvalInt ¶
EvalInt runs term against input, returning the int result. If an error occurs, the opt.OnError is returned.
func EvalString ¶
EvalString runs term against input, returning the string result. If an error occurs, the opt.OnError is returned.
func EvalStringInterfaceMap ¶
EvalStringInterfaceMap runs term against input, returning the string map result. If an error occurs, the opt.OnError is returned or nil.
func EvalStringSlice ¶
EvalStringSlice runs term against input, returning the string slice result. If an error occurs, the opt.OnError is returned or nil.
Types ¶
type AstNode ¶
type AstNode interface { // Evaluate the interface, returning the results. This is intended // to be only an internal API: the Opt* is a pointer but can not be nil. Eval(interface{}, *Opt) (interface{}, error) }
AstNode defines the basic interface for evaluating expressions.
type Opt ¶
type Opt struct { // Strict causes sloppy conditions to become errors. For example, comparing a // number to a string is false if strict is off, but error if it's on. Strict bool // OnError is a value returned when one of the typed Eval() statements returns an error. // Must match the type. For example, the value must be assigend a string if using EvalString(). OnError interface{} }
Opt contains options for evaluation.