Documentation
¶
Overview ¶
Package expr compiles and evaluates the expressions used by flow definitions: choice predicates (`when:`), map sources (`over:`), subflow inputs, search attributes and concurrency keys. Expressions are written in expr-lang and evaluated against the execution's context view:
input the start payload channels the reduced state channels results each settled node's latest output, keyed by node id last_node the most recently settled node visits how many times each node was entered signals consumed signal payloads, keyed by signal name branches branch status of the current fan-out, keyed by branch id counters generic usage counters item/index the current element of a map node (map instances only)
Expressions are restricted to a bounded, straight-line subset (see validateBudgetedProgram): flow authors are not fully trusted, and expr has no preemptive VM deadline.
Index ¶
Constants ¶
const ( VarInput = "input" VarChannels = "channels" VarResults = "results" VarLastNode = "last_node" VarVisits = "visits" VarSignals = "signals" VarBranches = "branches" VarCounters = "counters" VarErrors = "errors" VarItem = "item" VarIndex = "index" )
Context view variable names.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Program ¶
type Program struct {
// contains filtered or unexported fields
}
Program is a compiled expression.
func CompilePredicate ¶
CompilePredicate compiles a boolean expression (a choice rule).
func CompileValue ¶
CompileValue compiles an expression producing any value (map `over`, subflow `input`, search attributes, concurrency keys).
func (*Program) Eval ¶
Eval evaluates the program against env (a context view as produced by the fold). ctx is checked before and after evaluation; the compile-time restrictions are the primary CPU bound.