go.bigb.es/auxilia
Documentation
Types
type Row struct { Gate func() bool Over func() []string When func(*legatus.FlowCtx) bool Make func(item string) ([]legatus.Step, error) }
Row is one entry in a Spec. Every column is optional except Make:
- Gate nil — the row is always included; false drops it (Over/Make unrun).
- Over nil — a single pass with item == ""; otherwise one pass per element.
- When nil — the emitted steps are unconditional; otherwise each is wrapped in steps.When{Cond: When}.
Spec is a named, ordered table of Rows that resolves to a legatus.Flow.
func (s Spec) Resolve() (legatus.Flow, error)
Resolve lowers the table to a Flow, walking rows in declaration order: a row whose Gate is false contributes nothing; otherwise Make runs once per Over item (or once with ""), and each produced step is wrapped in steps.When when the row has a When gate. The first Make error aborts, returning Flow{Name} (no steps) plus the error so the Runner can name the failed flow.
Package flowspec turns a legatus Flow into a single declarative table instead of imperative builder code. A Spec is a list of Rows; each Row carries the conditionality that consumers otherwise hand-roll as control flow:
Spec implements legatus.FlowSource, so a Spec is handed to Runner.Run exactly where a static Flow would be. Resolve lowers the table to a Flow once, before any host fan-out, which is why Gate/Over are host-independent and only When sees the host.