Documentation ¶
Index ¶
- Constants
- func DoChildNodes(childNodes []Node, env map[string]interface{}, arg_array *[]interface{}) ([]byte, error)
- func FindAllExpressConvertString(str string) []string
- func FindAllExpressString(str string) []string
- func Replace(findStrs []string, data string, typeConvert SqlArgTypeConvert, ...) (string, error)
- func ReplaceRaw(findStrs []string, data string, typeConvert SqlArgTypeConvert, ...) (string, error)
- type ExpressionEngine
- type Node
- type NodeBind
- type NodeChoose
- type NodeConfigHolder
- type NodeForEach
- type NodeIf
- type NodeInclude
- type NodeOtherwise
- type NodeParser
- type NodeString
- type NodeTrim
- type NodeType
- type NodeWhen
- type SqlArgTypeConvert
Constants ¶
View Source
const DefaultOverrides = ","
View Source
const DefaultWhereElement_Prefix = "where"
View Source
const DefaultWhereElement_PrefixOverrides = "and |or |And |Or |AND |OR "
Variables ¶
This section is empty.
Functions ¶
func DoChildNodes ¶
func DoChildNodes(childNodes []Node, env map[string]interface{}, arg_array *[]interface{}) ([]byte, error)
执行子所有节点
func FindAllExpressConvertString ¶
find like #{*} value *
func Replace ¶
func Replace(findStrs []string, data string, typeConvert SqlArgTypeConvert, arg map[string]interface{}, engine ExpressionEngine, arg_array *[]interface{}) (string, error)
执行替换操作
func ReplaceRaw ¶
func ReplaceRaw(findStrs []string, data string, typeConvert SqlArgTypeConvert, arg map[string]interface{}, engine ExpressionEngine) (string, error)
执行替换操作
Types ¶
type ExpressionEngine ¶
type ExpressionEngine interface { //引擎名称 Name() string //编译一个表达式 //参数:lexerArg 表达式内容 //返回:interface{} 编译结果,error 错误 Lexer(lexerArg string) (interface{}, error) //执行一个表达式 //参数:lexerResult=编译结果,arg=参数 //返回:执行结果,错误 Eval(lexerResult interface{}, arg interface{}, operation int) (interface{}, error) LexerAndEval(lexerArg string, arg interface{}) (interface{}, error) }
q:为什么要拆分表达式编译和执行步骤?优化性能,如果需要可以缓存表达式编译结果,执行表达式时不需要重复编译 表达式引擎接口
type Node ¶
type Node interface { Type() NodeType Eval(env map[string]interface{}, arg_array *[]interface{}) ([]byte, error) }
sql构建抽象语法树节点
type NodeBind ¶
type NodeBind struct {
// contains filtered or unexported fields
}
type NodeChoose ¶
type NodeChoose struct {
// contains filtered or unexported fields
}
func (*NodeChoose) Eval ¶
func (it *NodeChoose) Eval(env map[string]interface{}, arg_array *[]interface{}) ([]byte, error)
func (*NodeChoose) Type ¶
func (it *NodeChoose) Type() NodeType
type NodeConfigHolder ¶
type NodeConfigHolder struct { Convert SqlArgTypeConvert Proxy ExpressionEngine }
func (*NodeConfigHolder) GetExpressionEngineProxy ¶
func (it *NodeConfigHolder) GetExpressionEngineProxy() ExpressionEngine
func (*NodeConfigHolder) GetSqlArgTypeConvert ¶
func (it *NodeConfigHolder) GetSqlArgTypeConvert() SqlArgTypeConvert
type NodeForEach ¶
type NodeForEach struct {
// contains filtered or unexported fields
}
foreach 节点
func (*NodeForEach) Eval ¶
func (it *NodeForEach) Eval(env map[string]interface{}, arg_array *[]interface{}) ([]byte, error)
func (*NodeForEach) Type ¶
func (it *NodeForEach) Type() NodeType
type NodeIf ¶
type NodeIf struct {
// contains filtered or unexported fields
}
判断节点
type NodeInclude ¶
type NodeInclude struct {
// contains filtered or unexported fields
}
func (*NodeInclude) Eval ¶
func (it *NodeInclude) Eval(env map[string]interface{}, arg_array *[]interface{}) ([]byte, error)
func (*NodeInclude) Type ¶
func (it *NodeInclude) Type() NodeType
type NodeOtherwise ¶
type NodeOtherwise struct {
// contains filtered or unexported fields
}
func (*NodeOtherwise) Eval ¶
func (it *NodeOtherwise) Eval(env map[string]interface{}, arg_array *[]interface{}) ([]byte, error)
func (*NodeOtherwise) Type ¶
func (it *NodeOtherwise) Type() NodeType
type NodeParser ¶
type NodeParser struct {
Holder NodeConfigHolder
}
节点解析器
func (NodeParser) ParserNodes ¶
func (it NodeParser) ParserNodes(mapperXml []etree.Token) []Node
界面为node
type NodeString ¶
type NodeString struct {
// contains filtered or unexported fields
}
字符串节点
func (*NodeString) Eval ¶
func (it *NodeString) Eval(env map[string]interface{}, arg_array *[]interface{}) ([]byte, error)
func (*NodeString) Type ¶
func (it *NodeString) Type() NodeType
type NodeTrim ¶
type NodeTrim struct {
// contains filtered or unexported fields
}
Trim操作节点
type NodeWhen ¶
type NodeWhen struct {
// contains filtered or unexported fields
}
type SqlArgTypeConvert ¶
type SqlArgTypeConvert interface {
Convert(arg interface{}) string
}
表达式类型(基本类型)转换函数
Click to show internal directories.
Click to hide internal directories.