expr

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2018 License: BSD-3-Clause Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

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     *Expression `json:"left"`
	Operator OPERATIOR   `json:"operator"`
	Right    *Expression `json:"right"`

	Value interface{}       `json:"value"`
	Type  funcexprtype.Type `json:"type"`
}

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) IsFunction

func (e *Expression) IsFunction() bool

func (*Expression) IsNil

func (e *Expression) IsNil() bool

func (*Expression) String

func (e *Expression) String() string

func (*Expression) UnmarshalJSON

func (e *Expression) UnmarshalJSON(exprData []byte) error

type OPERATIOR

type OPERATIOR int
const (
	EQ OPERATIOR = iota
	OR
	AND
	NOT_EQ
	GT
	LT
	GTE
	LTE
	ADDITION
	SUBTRACTION
	MULTIPLICATION
	DIVISION
	INT_DIVISTION
	MODULAR_DIVISION
	GEGATIVE
	UNINE
)

func ToOperator

func ToOperator(operator string) (OPERATIOR, bool)

func (OPERATIOR) String

func (o OPERATIOR) String() string

type TernaryExpressio

type TernaryExpressio struct {
	First  interface{}
	Second interface{}
	Third  interface{}
}

func (*TernaryExpressio) Eval

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

func (*TernaryExpressio) EvalWithData

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

func (*TernaryExpressio) EvalWithScope

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

func (*TernaryExpressio) HandleParameter

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

Jump to

Keyboard shortcuts

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