safejmespath

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const MaxReferences = 32

MaxReferences is the largest number of field paths a template may contain. A path inside to_string counts toStringWeight times.

Variables

View Source
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

func Check(expression string) (err error)

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.

func Compile

func Compile(expression string) (*jmespath.JMESPath, error)

Compile is Check followed by jmespath.Compile.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL