package module
Version: v0.0.0-...-69f9630 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2021 License: BSD-2-Clause Imports: 6 Imported by: 0



This package is a wrapper of JQ for the Go programming language, designed to make it easy for Go programs to filter JSON input using JQ. This is used internally at ThreatGRID to perform unit testing using expectjq and as a map/reduce VM for ThreatGRID's internal data storage.

API information is available at godoc.org.



Wraps the "jq" utility as a pipe.

This package makes it easy for Go programs to filter JSON data using stedolan's "jq". This is used internally at ThreatGRID as a sort of expedient map/reduce in its distributed data store and in its "expectjq" test utility.



This section is empty.


This section is empty.


func Eval

func Eval(js string, expr string, opts ...string) ([]json.RawMessage, error)

Eval starts a new Jq process to evaluate an expression with json input


type Pipe

type Pipe struct {
	// contains filtered or unexported fields

Pipe encapsulates a child "jq" process with a fixed expression, returning each JSON output from jq.

func New

func New(r io.Reader, expr string, opts ...string) (*Pipe, error)

New wraps a jq.Pipe around an existing io.Reader, applying a JQ expression

func (*Pipe) Close

func (p *Pipe) Close() error

Close attempts to halt the jq process if it has not already exited. This is only necessary if Next has not returned io.EOF.

func (*Pipe) Next

func (p *Pipe) Next() (json.RawMessage, error)

Next provides the next JSON result from JQ. If there are no more results, io.EOF is returned.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL