Documentation
¶
Overview ¶
Package engine provides a unified parse → query → serialize pipeline. It accepts any supported format as input, runs a jq expression against it, and serializes the result to the requested output format.
Index ¶
- Variables
- func Parse(data []byte, fmt_ detector.Format) (interface{}, error)
- func ParseMulti(data []byte, fmt_ detector.Format) ([]interface{}, error)
- func Run(r io.Reader, w io.Writer, query string, data []byte, opts Options) error
- func RunValues(w io.Writer, query string, inputs []interface{}, opts Options) error
- type Options
Constants ¶
This section is empty.
Variables ¶
var ErrExitStatus = fmt.Errorf("exit status 1")
ErrExitStatus is returned when --exit-status is set and the last value is false/null.
Functions ¶
func Parse ¶
Parse converts raw bytes in the given format to a generic Go value. It is the exported counterpart of the internal parse function, intended for use by sibling packages (diff, validator) that need parsed data without running a jq query.
func ParseMulti ¶ added in v1.1.0
ParseMulti parses all documents from data and returns them as a slice. For JSON it uses a streaming decoder so concatenated objects (e.g. the output of `go list -json ./...`) are each returned as a separate element. For YAML it splits on `---` document separators. For TOML there is only ever one document, so the slice has length 1.
Types ¶
type Options ¶
type Options struct {
InputFormat detector.Format // FormatUnknown means auto-detect from content
OutputFormat detector.Format // FormatUnknown means same as input
Pretty bool // pretty-print output (JSON only; YAML/TOML are always pretty)
RawOutput bool // -r: print strings without quotes
Compact bool // -c: compact JSON output
NullInput bool // -n: use null as input (no parsing)
ExitStatus bool // -e: exit 1 if last value is false/null
Color bool // enable ANSI syntax highlighting on output
}
Options controls engine behaviour.