Documentation
¶
Overview ¶
Package jq compiles and runs the jq programs a workflow step reshapes its result with (the step's `jq` field), on gojq, a pure-Go jq.
A program sees the step's result as its input and the workflow input and loop variables as $input and $vars. It must yield one value: a program that yields a stream is wrapped in [ ] to collect it, so the stored result never depends on how many rows the data happened to hold.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache holds compiled programs by their source, so a step inside a loop is compiled once, not once per iteration. It is safe for concurrent use.
type Program ¶
type Program struct {
// contains filtered or unexported fields
}
Program is a compiled jq program.
func (*Program) Run ¶
func (p *Program) Run(ctx context.Context, input interface{}, workflowInput, vars map[string]interface{}) (interface{}, error)
Run runs the program on input with the workflow input and loop variables bound to $input and $vars. It returns the one value the program yields, nil when it yields none, and an error when it yields more than one or fails.