expr

package
Version: v0.5.8 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2019 License: BSD-3-Clause Imports: 7 Imported by: 3

Documentation

Index

Constants

View Source
const (
	OR             = "||"
	AND            = "&&"
	EQ             = "=="
	NOT_EQ         = "!="
	GT             = ">"
	LT             = "<"
	GTE            = ">="
	LTE            = "<="
	ADDITION       = "+"
	SUBTRACTION    = "-"
	MULTIPLICATION = "*"
	DIVIDE         = "/"
	MODE           = "%"
)

Variables

This section is empty.

Functions

func ConvertToSameType added in v0.5.5

func ConvertToSameType(left interface{}, right interface{}) (interface{}, interface{}, error)

Types

type Expr

type Expr interface {
	EvalWithScope(inputScope data.Scope, resolver data.Resolver) (interface{}, error)
	Eval() (interface{}, error)
	EvalWithData(value interface{}, inputScope data.Scope, resolver data.Resolver) (interface{}, error)
}

type Expression

type Expression struct {
	Left     Expr   `json:"left"`
	Operator string `json:"operator"`
	Right    Expr   `json:"right"`
	Value    Expr   `json:"value"`
}

func NewExpression

func NewExpression() *Expression

func (*Expression) Eval

func (f *Expression) Eval() (interface{}, error)

func (*Expression) EvalWithData

func (f *Expression) EvalWithData(data interface{}, inputScope data.Scope, resolver data.Resolver) (interface{}, error)

func (*Expression) EvalWithScope

func (f *Expression) EvalWithScope(inputScope data.Scope, resolver data.Resolver) (interface{}, error)

func (*Expression) IsNil

func (e *Expression) IsNil() bool

func (*Expression) String

func (e *Expression) String() string

type LiteralExpr added in v0.5.8

type LiteralExpr struct {
	V interface{}
}

func NewLiteralExpr added in v0.5.8

func NewLiteralExpr(v interface{}) *LiteralExpr

func (*LiteralExpr) Eval added in v0.5.8

func (iffl *LiteralExpr) Eval() (interface{}, error)

func (*LiteralExpr) EvalWithData added in v0.5.8

func (iffl *LiteralExpr) EvalWithData(value interface{}, inputScope data.Scope, resolver data.Resolver) (interface{}, error)

func (*LiteralExpr) EvalWithScope added in v0.5.8

func (iffl *LiteralExpr) EvalWithScope(inputScope data.Scope, resolver data.Resolver) (interface{}, error)

type TernaryExpression added in v0.5.8

type TernaryExpression struct {
	First  Expr
	Second Expr
	Third  Expr
}

func (*TernaryExpression) Eval added in v0.5.8

func (t *TernaryExpression) Eval() (interface{}, error)

func (*TernaryExpression) EvalWithData added in v0.5.8

func (t *TernaryExpression) EvalWithData(value interface{}, inputScope data.Scope, resolver data.Resolver) (interface{}, error)

func (*TernaryExpression) EvalWithScope added in v0.5.8

func (t *TernaryExpression) EvalWithScope(inputScope data.Scope, resolver data.Resolver) (interface{}, error)

func (*TernaryExpression) HandleParameter added in v0.5.8

func (t *TernaryExpression) HandleParameter(param interface{}, value interface{}, inputScope data.Scope, resolver data.Resolver) (interface{}, error)

Source Files

Jump to

Keyboard shortcuts

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