Documentation
¶
Index ¶
Constants ¶
const MaxReferences = 32
MaxReferences is the largest number of field paths a template may contain. A path inside to_string counts toStringWeight times.
Variables ¶
var ErrNotAccepted = errors.New("template is outside the accepted forms")
ErrNotAccepted marks a template that parses but is outside the accepted forms. A template that does not parse yields the parser's error instead.
Functions ¶
func Check ¶
Check reports whether expression is a template of an accepted form:
template = scalar
scalar = path | literal | to_string(scalar) | not_null(scalar, ...)
| scalar || scalar | join('<literal>', [scalar, ...])
path = field(.field)* with optional [integer] steps
literal = 'string' or a JSON string, number, boolean or null
go-jmespath cannot be interrupted and has no limits, so templates are held to forms whose result stays proportional to the input. A field path returns at most the whole input, to_string enlarges it at most toStringWeight times, and join adds its literal separator once per item. With paths counted against MaxReferences, the result and every intermediate value are bounded by that many copies of the input plus what the template's literals add, and evaluation time is linear in the input.
Types ¶
This section is empty.