Documentation
¶
Overview ¶
Package jqfmt provides formatting utilities for jq queries.
Package jqfmt provides formatting utilities for jq queries.
Index ¶
- func DoThing(jqStr string, cfg_ JqFmtCfg) (string, error)
- func Marshal(v interface{}) ([]byte, error)
- type Array
- type Bind
- type ConstArray
- type ConstObject
- type ConstObjectKeyVal
- type ConstTerm
- type Foreach
- type Func
- type FuncDef
- type If
- type IfElif
- type Import
- type Index
- type JqFmtCfg
- type Label
- type Object
- type ObjectKeyVal
- type Pattern
- type PatternObject
- type Query
- type Reduce
- type String
- type Suffix
- type Term
- type Try
- type Unary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Marshal ¶
Marshal returns the jq-flavored JSON encoding of v.
This method accepts only limited types (nil, bool, int, float64, *big.Int, string, []interface{}, and map[string]interface{}) because these are the possible types a gojq iterator can emit. This method marshals NaN to null, truncates infinities to (+|-) math.MaxFloat64, uses \b and \f in strings, and does not escape '<', '>', '&', '\u2028', and '\u2029'. These behaviors are based on the marshaler of jq command, and different from json.Marshal in the Go standard library. Note that the result is not safe to embed in HTML.
Types ¶
type ConstArray ¶
type ConstArray struct {
Elems []*ConstTerm
}
ConstArray ...
func (*ConstArray) String ¶
func (e *ConstArray) String() string
type ConstObject ¶
type ConstObject struct {
KeyVals []*ConstObjectKeyVal
}
ConstObject ...
func (*ConstObject) String ¶
func (e *ConstObject) String() string
func (*ConstObject) ToValue ¶
func (e *ConstObject) ToValue() map[string]interface{}
ToValue converts the object to map[string]interface{}.
type ConstObjectKeyVal ¶
ConstObjectKeyVal ...
func (*ConstObjectKeyVal) String ¶
func (e *ConstObjectKeyVal) String() string
type ConstTerm ¶
type ConstTerm struct {
Object *ConstObject
Array *ConstArray
Number string
Str string
Null bool
True bool
False bool
}
ConstTerm ...
type Import ¶
type Import struct {
ImportPath string
ImportAlias string
IncludePath string
Meta *ConstObject
}
Import ...
type JqFmtCfg ¶
func ValidateConfig ¶
type ObjectKeyVal ¶
ObjectKeyVal ...
func (*ObjectKeyVal) String ¶
func (e *ObjectKeyVal) String() string
type Pattern ¶
type Pattern struct {
Name string
Array []*Pattern
Object []*PatternObject
}
Pattern ...
type PatternObject ¶
PatternObject ...
func (*PatternObject) String ¶
func (e *PatternObject) String() string
type Query ¶
type Query struct {
Meta *ConstObject
Imports []*Import
FuncDefs []*FuncDef
Term *Term
Left *Query
Op gojq.Operator
Right *Query
Func string
}
Query represents the abstract syntax tree of a jq query.
type Term ¶
type Term struct {
Type gojq.TermType
Index *Index
Func *Func
Object *Object
Array *Array
Number string
Unary *Unary
Format string
Str *String
If *If
Try *Try
Reduce *Reduce
Foreach *Foreach
Label *Label
Break string
Query *Query
SuffixList []*Suffix
}
Term ...