Documentation
¶
Index ¶
Constants ¶
View Source
const ( TypeNumber = "number" // 数字常量 TypeField = "field" // 字段引用 TypeOperator = "operator" // 运算符 TypeFunction = "function" // 函数调用 TypeParenthesis = "parenthesis" // 括号 TypeCase = "case" // CASE表达式 TypeString = "string" // 字符串常量 )
表达式类型
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExprNode ¶
type ExprNode struct {
Type string
Value string
Left *ExprNode
Right *ExprNode
Args []*ExprNode // 用于函数调用的参数
// CASE表达式专用字段
CaseExpr *ExprNode // CASE后面的表达式(简单CASE)
WhenClauses []WhenClause // WHEN子句列表
ElseExpr *ExprNode // ELSE表达式
}
表达式节点
type Expression ¶
type Expression struct {
Root *ExprNode
// contains filtered or unexported fields
}
Expression 表示一个可计算的表达式
func NewExpression ¶
func NewExpression(exprStr string) (*Expression, error)
NewExpression 创建一个新的表达式
func (*Expression) Evaluate ¶
func (e *Expression) Evaluate(data map[string]interface{}) (float64, error)
Evaluate 计算表达式的值
func (*Expression) EvaluateWithNull ¶
func (e *Expression) EvaluateWithNull(data map[string]interface{}) (float64, bool, error)
EvaluateWithNull 提供公开接口,用于聚合函数调用
type WhenClause ¶
CASE表达式的WHEN子句
Click to show internal directories.
Click to hide internal directories.