jmespath

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: 0BSD Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEvaluationFailed indicates that the evaluation of the expression
	// failed with an error.
	ErrEvaluationFailed = errors.New("jmespath: evaluation failed")

	// ErrInvalidArity indicates that the expression called a function with an
	// incorrect number of arguments.
	ErrInvalidArity = errors.New("jmespath: invalid arity")

	// ErrInvalidType indicates that a field was used in a context where its
	// type wasn't valid.
	ErrInvalidType = errors.New("jmespath: invalid type")

	// ErrInvalidValue indicates that a field was used in a context where its
	// value wasn't valid.
	ErrInvalidValue = errors.New("jmespath: invalid value")

	// ErrNotANumber indicates that the an operation produced an infinity or
	// not-a-number result.
	ErrNotANumber = errors.New("jmespath: not a number")

	// ErrSyntax indicates that the expression contains a syntax error.
	ErrSyntax = errors.New("jmespath: syntax error")

	// ErrUndefinedVariable indicates that the expression attempted to access a
	// variable that hadn't been defined.
	ErrUndefinedVariable = errors.New("jmespath: undefined variable")

	// ErrUnknownFunction indicates that the expression attempted to invoke a
	// function that hasn't been defined.
	ErrUnknownFunction = errors.New("jmespath: unknown function")
)

Functions

func Search(expression string, data any) (any, error)

Search evaluates expression with data and returns the result.

Types

type Expression

type Expression struct {
	// contains filtered or unexported fields
}

Expression represents a compiled expression.

func Compile

func Compile(expression string) (*Expression, error)

Compile compiles expression and, if successful, returns an Expression that can be used evaluate it against data.

func MustCompile

func MustCompile(expression string) *Expression

MustCompile is like Compile but panics if the expression cannot be compiled.

func (Expression) Search

func (e Expression) Search(data any) (any, error)

Search evaluates the compiled expression against data and returns the result.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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