Documentation
¶
Overview ¶
This package wraps https://github.com/stedolan/jq as a virtual machine. This provides Go programmers with a way to filter JSON data using JQ.
Building this package requires a very current build of JQ; earlier releases do not provide JQ as a separate library component. For a more stable and portable implementation, see https://github.com/threatgrid/jqpipe-go
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Vm ¶
type Vm struct {
// contains filtered or unexported fields
}
A Vm encloses the internal state of a compiled JQ filter machine. Vm's can be reused, but cannot be used concurrently.
func MustCompile ¶
MustCompile uses Compile to compile a JQ filter, and panics if it fails. This simplifies wrapping a known good filter into global variable.
func (*Vm) Apply ¶
Apply runs the JQ filter on each input after using encoding/json to convert to JSON. The results of each run are combined into an array of JSON raw messages. Apply stops on the first error, which could be during Compile or a Run.