operators

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(left, right core.Value) core.Value

Adds numbers Concats strings

func Decrement

func Decrement(left, _ core.Value) core.Value

func Divide

func Divide(left, right core.Value) core.Value

func Equal

func Equal(left, right core.Value) core.Value

Equality

func Greater

func Greater(left, right core.Value) core.Value

func GreaterOrEqual

func GreaterOrEqual(left, right core.Value) core.Value

func Increment

func Increment(left, _ core.Value) core.Value

func IsValidArrayOperatorType

func IsValidArrayOperatorType(aotype ArrayOperatorType) bool

func Less

func Less(left, right core.Value) core.Value

func LessOrEqual

func LessOrEqual(left, right core.Value) core.Value

func Modulus

func Modulus(left, right core.Value) core.Value

func Multiply

func Multiply(left, right core.Value) core.Value

func Not

func Not(left, _ core.Value) core.Value

func NotEqual

func NotEqual(left, right core.Value) core.Value

func Subtract

func Subtract(left, right core.Value) core.Value

Types

type ArrayOperator

type ArrayOperator struct {
	// contains filtered or unexported fields
}

func NewArrayOperator

func NewArrayOperator(
	src core.SourceMap,
	left core.Expression,
	right core.Expression,
	aotype ArrayOperatorType,
	comparator core.OperatorExpression,
) (*ArrayOperator, error)

func (*ArrayOperator) Eval

func (operator *ArrayOperator) Eval(ctx context.Context, left, right core.Value) (core.Value, error)

func (*ArrayOperator) Exec

func (operator *ArrayOperator) Exec(ctx context.Context, scope *core.Scope) (core.Value, error)

type ArrayOperatorType

type ArrayOperatorType int
const (
	ArrayOperatorTypeAll  ArrayOperatorType = 0
	ArrayOperatorTypeAny  ArrayOperatorType = 1
	ArrayOperatorTypeNone ArrayOperatorType = 2
)

func ToIsValidArrayOperatorType

func ToIsValidArrayOperatorType(stype string) (ArrayOperatorType, error)

type EqualityOperator

type EqualityOperator struct {
	// contains filtered or unexported fields
}

func NewEqualityOperator

func NewEqualityOperator(
	src core.SourceMap,
	left core.Expression,
	right core.Expression,
	operator string,
) (*EqualityOperator, error)

func (*EqualityOperator) Eval

func (operator *EqualityOperator) Eval(_ context.Context, left, right core.Value) (core.Value, error)

func (*EqualityOperator) Exec

func (operator *EqualityOperator) Exec(ctx context.Context, scope *core.Scope) (core.Value, error)

type InOperator

type InOperator struct {
	// contains filtered or unexported fields
}

func NewInOperator

func NewInOperator(
	src core.SourceMap,
	left core.Expression,
	right core.Expression,
	not bool,
) (*InOperator, error)

func (*InOperator) Eval

func (operator *InOperator) Eval(_ context.Context, left, right core.Value) (core.Value, error)

func (*InOperator) Exec

func (operator *InOperator) Exec(ctx context.Context, scope *core.Scope) (core.Value, error)

type LogicalOperator

type LogicalOperator struct {
	// contains filtered or unexported fields
}

func NewLogicalOperator

func NewLogicalOperator(
	src core.SourceMap,
	left core.Expression,
	right core.Expression,
	operator string,
) (*LogicalOperator, error)

func (*LogicalOperator) Eval

func (operator *LogicalOperator) Eval(_ context.Context, left, right core.Value) (core.Value, error)

func (*LogicalOperator) Exec

func (operator *LogicalOperator) Exec(ctx context.Context, scope *core.Scope) (core.Value, error)

type LogicalOperatorType

type LogicalOperatorType int
const (
	LogicalOperatorTypeAnd LogicalOperatorType = 0
	LogicalOperatorTypeOr  LogicalOperatorType = 1
	LogicalOperatorTypeNot LogicalOperatorType = 2
)

type MathOperator

type MathOperator struct {
	// contains filtered or unexported fields
}

func NewMathOperator

func NewMathOperator(
	src core.SourceMap,
	left core.Expression,
	right core.Expression,
	operator MathOperatorType,
) (*MathOperator, error)

func (*MathOperator) Eval

func (operator *MathOperator) Eval(_ context.Context, left, right core.Value) (core.Value, error)

func (*MathOperator) Exec

func (operator *MathOperator) Exec(ctx context.Context, scope *core.Scope) (core.Value, error)

type MathOperatorType

type MathOperatorType string
const (
	MathOperatorTypeAdd       MathOperatorType = "+"
	MathOperatorTypeSubtract  MathOperatorType = "-"
	MathOperatorTypeMultiply  MathOperatorType = "*"
	MathOperatorTypeDivide    MathOperatorType = "/"
	MathOperatorTypeModulus   MathOperatorType = "%"
	MathOperatorTypeIncrement MathOperatorType = "++"
	MathOperatorTypeDecrement MathOperatorType = "--"
)

type OperatorFunc

type OperatorFunc func(left, right core.Value) core.Value

type RangeOperator

type RangeOperator struct {
	// contains filtered or unexported fields
}

func NewRangeOperator

func NewRangeOperator(
	src core.SourceMap,
	left core.Expression,
	right core.Expression,
) (*RangeOperator, error)

func (*RangeOperator) Eval

func (operator *RangeOperator) Eval(_ context.Context, left, right core.Value) (core.Value, error)

func (*RangeOperator) Exec

func (operator *RangeOperator) Exec(ctx context.Context, scope *core.Scope) (core.Value, error)

func (*RangeOperator) Iterate

func (operator *RangeOperator) Iterate(ctx context.Context, scope *core.Scope) (collections.Iterator, error)

Jump to

Keyboard shortcuts

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