expressions

package
v0.0.0-...-e6fb8a6 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All(validators ...IValidator) *all

func AllArgs

func AllArgs(validator ISingleArgumentValidator) *allArgs

func Arg

func Arg(i int, validator ISingleArgumentValidator) *arg

func AtLeastNArgs

func AtLeastNArgs(n int) *atLeastNArgs

func AtMostNArgs

func AtMostNArgs(n int) *atMostNArgs

func ExactlyNArgs

func ExactlyNArgs(n int) *exactlyNArgs

func IfArgPresent

func IfArgPresent(i int, validator IValidator) *ifArgPresent

func OneOf

func OneOf(validators ...IValidator) *oneOf

func SameFamily

func SameFamily(f datavalues.Family) *sameFamily

func SameType

func SameType(idx ...int) *sameType

func SingleOneOf

func SingleOneOf(validators ...ISingleArgumentValidator) *singleOneOf

func TypeOf

func TypeOf(wantedType datavalues.IDataValue) *typeOf

func Walk

func Walk(visit Visit, exprs ...IExpression) error

Types

type AggregateExpression

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

func (*AggregateExpression) Document

func (e *AggregateExpression) Document() docs.Documentation

func (*AggregateExpression) Eval

func (e *AggregateExpression) Eval() error

func (*AggregateExpression) Merge

func (*AggregateExpression) Result

func (*AggregateExpression) String

func (e *AggregateExpression) String() string

func (*AggregateExpression) Update

func (e *AggregateExpression) Update(params IParams) (datavalues.IDataValue, error)

func (*AggregateExpression) Walk

func (e *AggregateExpression) Walk(visit Visit) error

type AliasedExpression

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

func NewAliasedExpression

func NewAliasedExpression(name string, expr IExpression) *AliasedExpression

func (*AliasedExpression) Document

func (e *AliasedExpression) Document() docs.Documentation

func (*AliasedExpression) Eval

func (e *AliasedExpression) Eval() error

func (*AliasedExpression) Merge

func (*AliasedExpression) Result

func (*AliasedExpression) String

func (e *AliasedExpression) String() string

func (*AliasedExpression) Update

func (e *AliasedExpression) Update(params IParams) (datavalues.IDataValue, error)

func (*AliasedExpression) Walk

func (e *AliasedExpression) Walk(visit Visit) error

type BinaryExpression

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

func (*BinaryExpression) Document

func (e *BinaryExpression) Document() docs.Documentation

func (*BinaryExpression) Eval

func (e *BinaryExpression) Eval() error

func (*BinaryExpression) Merge

func (*BinaryExpression) Result

func (*BinaryExpression) String

func (e *BinaryExpression) String() string

func (*BinaryExpression) Update

func (e *BinaryExpression) Update(params IParams) (datavalues.IDataValue, error)

func (*BinaryExpression) Walk

func (e *BinaryExpression) Walk(visit Visit) error

type ConstantExpression

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

ConstantExpression 常量表达式,返回给定的值

func NewConstantExpression

func NewConstantExpression(v datavalues.IDataValue) *ConstantExpression

func (*ConstantExpression) Document

func (e *ConstantExpression) Document() docs.Documentation

func (*ConstantExpression) Eval

func (e *ConstantExpression) Eval() error

Eval 常量不能被执行

func (*ConstantExpression) Merge

Merge 妈的常量值竟然能被覆盖掉?

func (*ConstantExpression) Result

Result 返回最终的常量

func (*ConstantExpression) String

func (e *ConstantExpression) String() string

func (*ConstantExpression) Update

func (e *ConstantExpression) Update(params IParams) (datavalues.IDataValue, error)

Update 常量没有参数

func (*ConstantExpression) Walk

func (e *ConstantExpression) Walk(visit Visit) error

Walk 遍历表达式

type IExpression

type IExpression interface {

	// Eval 执行表达式
	Eval() error

	// Result 获取表达式的执行结果
	Result() datavalues.IDataValue

	// Update 设置表达式的参数
	Update(params IParams) (datavalues.IDataValue, error)

	// Merge 合并多个表达式的结果
	Merge(arg IExpression) (datavalues.IDataValue, error)

	Walk(visit Visit) error

	String() string

	// Document 表达式的执行结果
	Document() docs.Documentation
}

IExpression 表示SQL中的一个表达式

func ADD

func ADD(left interface{}, right interface{}) IExpression

func ALIASED

func ALIASED(name string, expr IExpression) IExpression

func AND

func AND(left interface{}, right interface{}) IExpression

func CONST

func CONST(v interface{}) IExpression

CONST 创建一个常量表达式

func COUNT

func COUNT(arg interface{}) IExpression

func DIV

func DIV(left interface{}, right interface{}) IExpression

func EQ

func EQ(left interface{}, right interface{}) IExpression

func ExpressionFactory

func ExpressionFactory(name string, args []interface{}) (IExpression, error)

func GT

func GT(left interface{}, right interface{}) IExpression

func GTE

func GTE(left interface{}, right interface{}) IExpression

func IF

func IF(args ...interface{}) IExpression

IF 条件表达式

func LIKE

func LIKE(left interface{}, right interface{}) IExpression

func LOGMOCK

func LOGMOCK(args ...interface{}) IExpression

func LT

func LT(left interface{}, right interface{}) IExpression

func LTE

func LTE(left interface{}, right interface{}) IExpression

func MAX

func MAX(arg interface{}) IExpression

func MIN

func MIN(arg interface{}) IExpression

func MUL

func MUL(left interface{}, right interface{}) IExpression

func NEQ

func NEQ(left interface{}, right interface{}) IExpression

func NOT_LIKE

func NOT_LIKE(left interface{}, right interface{}) IExpression

func OR

func OR(left interface{}, right interface{}) IExpression

func RANDTABLE

func RANDTABLE(args ...interface{}) IExpression

func RANGETABLE

func RANGETABLE(args ...interface{}) IExpression

func SUB

func SUB(left interface{}, right interface{}) IExpression

func SUM

func SUM(arg interface{}) IExpression

func VAR

func VAR(v string) IExpression

func ZIP

func ZIP(args ...interface{}) IExpression

type IParams

type IParams interface {
	Get(name string) (datavalues.IDataValue, bool)
}

type ISingleArgumentValidator

type ISingleArgumentValidator interface {
	docs.Documented
	Validate(arg datavalues.IDataValue) error
}

type IValidator

type IValidator interface {
	docs.Documented
	Validate(args ...datavalues.IDataValue) error
}

type Map

func (Map) Get

func (p Map) Get(name string) (datavalues.IDataValue, bool)

type ScalarExpression

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

func (*ScalarExpression) Document

func (e *ScalarExpression) Document() docs.Documentation

func (*ScalarExpression) Eval

func (e *ScalarExpression) Eval() error

func (*ScalarExpression) Merge

func (*ScalarExpression) Result

func (*ScalarExpression) String

func (e *ScalarExpression) String() string

func (*ScalarExpression) Update

func (e *ScalarExpression) Update(params IParams) (datavalues.IDataValue, error)

func (*ScalarExpression) Walk

func (e *ScalarExpression) Walk(visit Visit) error

type VariableExpression

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

func NewVariableExpression

func NewVariableExpression(v string) *VariableExpression

func (*VariableExpression) Document

func (e *VariableExpression) Document() docs.Documentation

func (*VariableExpression) Eval

func (e *VariableExpression) Eval() error

func (*VariableExpression) Merge

func (*VariableExpression) Result

func (*VariableExpression) String

func (e *VariableExpression) String() string

func (*VariableExpression) Update

func (e *VariableExpression) Update(params IParams) (datavalues.IDataValue, error)

func (*VariableExpression) Walk

func (e *VariableExpression) Walk(visit Visit) error

type Visit

type Visit func(e IExpression) (isContinue bool, err error)

Jump to

Keyboard shortcuts

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