totalcall

package
v1.0.0-alpha.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 4 Imported by: 0

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

View Source
const FormulaSite = "ATTR_FORMULA"

FormulaSite is the one expression site that accepts total().

View Source
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

func ArgKey(c *exprast.CallNode) string

ArgKey is the accumulator key of a one-argument total() call: its argument's canonical printed form.

func Args

func Args(src string) []string

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

func Contains(src string) bool

Contains reports whether src calls total(...) anywhere. A source that does not parse reports false — its compile reports the syntax error.

func IsCall

func IsCall(n exprast.Node) (*exprast.CallNode, bool)

IsCall reports whether n is a total(...) call (callee the bare identifier total).

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL