Documentation
¶
Overview ¶
Package totalcall finds the total(expr) calls an expression makes and judges where they may appear — the one rule shared by the engine (internal/processing: ATTR_FORMULA's two-pass build, the expression filterer's and overlay formula's refusals), the merge gate (internal/mergegate) and the no-execute field-reference pass (internal/descriptor: predict and the runtime's entry check). It parses expr-lang and nothing else, so internal/descriptor may import it without reaching the engine (TestPredictNoExecutionImports).
total(expr) is ATTR_FORMULA's cohort-total term: the sum of a row-level expression over the post-filter rows, computed in a pre-pass and read as a constant by every row. A formula that calls it is therefore NOT row-local — Contains is the per-attribute predicate every type-keyed row-local gate must ask beside the attribute type.
Index ¶
Constants ¶
const FormulaSite = "ATTR_FORMULA"
FormulaSite is the one expression site that accepts total().
const Func = "total"
Func is the expression function name. Lowercase, like coef / lookup; an embedder ExprFunction may not claim it.
Variables ¶
This section is empty.
Functions ¶
func ArgKey ¶
ArgKey is the accumulator key of a one-argument total() call: its argument's canonical printed form.
func Args ¶
Args returns the argument source of every distinct one-argument total() call in src, in walk order (post-order: an inner call before its parent, left before right), keyed by the argument's canonical printed form (ast.Node.String) — the key the engine's patcher reads back to find a call's accumulator. nil when src does not parse or makes no call.
func Contains ¶
Contains reports whether src calls total(...) anywhere. A source that does not parse reports false — its compile reports the syntax error.
func Refusal ¶
func Refusal(src, site string) *errors.CodedError
Refusal is the coded refusal of src's total() calls at the named expression site ("ATTR_FORMULA", "FILTER_EXPRESSION", "OVERLAY_FORMULA"), nil when every call is admissible:
- outside ATTR_FORMULA, any call is PULSE_FORMULA_TOTAL_SITE;
- in ATTR_FORMULA, a call whose argument itself calls total() is PULSE_FORMULA_TOTAL_NESTED, and one with other than exactly one argument is PULSE_FORMULA_TOTAL_ARITY.
A source that does not parse yields nil (the compile reports it).
Types ¶
This section is empty.