Documentation
¶
Index ¶
- func Build(code string, data map[string]any) (any, error)
- func BuildWithOptions(code string, data map[string]any, extraOptions ...expr.Option) (any, error)
- func ExprOptions() []expr.Option
- func FormulaEnv(combine map[string]any) map[string]any
- func NormalizeExcelIFCalls(expr string) string
- type DateTimeFuncs
- type LogicFuncs
- type MathFuncs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildWithOptions ¶
BuildWithOptions 编译并执行公式;支持附加 expr.Option(如注入自定义函数)。 数值结果会按既有规则做截断;非数值结果原样返回。
func ExprOptions ¶
ExprOptions 返回与 Build 相同的 expr 编译选项,供需要自定义 Run 流程的场景使用。
func FormulaEnv ¶
FormulaEnv 将 Combine 转为 expr 可用的环境:无点的键原样放入(map 值浅拷贝一层,避免合并点号键时改动 Combine);带点的键(如 demo.some)合并为嵌套 map,便于公式里写 demo.some。
func NormalizeExcelIFCalls ¶
NormalizeExcelIFCalls 把 Excel 风格的三参调用 if(…) / If(…) 统一成 IF(…),避免 expr 把小写 if 解析成关键字语法。 不会改写:sumif(、countif(、elseif(、以及 "if(" 若未来要做字符串字面量需另行处理。
Types ¶
type MathFuncs ¶
type MathFuncs struct{}
MathFuncs 为无状态的数学类 expr 函数接收者。
func (MathFuncs) CeilDecimal ¶
CeilDecimal 舍弃的尾数不为 0 时强制进位。
Click to show internal directories.
Click to hide internal directories.