Documentation
¶
Overview ¶
Package expr is the data layer's expression evaluator. Pipeline operators that need conditional logic (filter `where:`, derive `compute:`, join `on:`) compile expressions once at Build time and evaluate them per item at Fetch / Subscribe time.
The package wraps github.com/expr-lang/expr behind a tiny Go interface so the rest of the codebase doesn't import the library directly. Centralizing this boundary lets us:
- Swap evaluators later (cel-go, govaluate, custom) without touching every operator that compiles expressions.
- Concentrate built-in functions (now, len, lower, upper, …) in one place — operator implementations get a consistent set of helpers automatically.
- Format error messages uniformly so configs surface compile and runtime errors the same way regardless of evaluator.
Like the rest of the data layer, this package never imports anything TUI-related. A CI check enforces.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Eval ¶
Eval runs the program against env (typically the item being evaluated, exposed at the top level — so `status.phase` works without an `item.` prefix). Pipeline-level parameters are passed separately via EvalWithParams; this convenience form is for callers that don't have params (or only have the item).
func EvalBool ¶
EvalBool runs the program and coerces the result to bool. Used by predicate operators (filter `where:`, future `if` clauses).
Coercion rules: real bool returns directly; nil and "" → false; non-zero numbers → true; non-empty strings (besides "") → true. Any other type errors so a misspelled field doesn't silently pass the filter.
func EvalBoolWithParams ¶
EvalBoolWithParams is EvalBool with pipeline-bound params available as `params.<name>` in the expression env.
func EvalWithParams ¶
EvalWithParams runs the program with the item AND a separate pipeline-bound parameters map. Params show up as `params.<name>` in the expression; item fields stay at the top level. Pass nil for params when the operator has none.