jmespath

package
v0.0.0-...-27647ab Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Functions = []Function{
	{"sum", func(arg []Arg[any]) any {
		panic("fixme")
	}},
}

Functions

This section is empty.

Types

type And

type And struct {
	Left  Node
	Right Node
	// contains filtered or unexported fields
}

type Arg

type Arg[T any] struct {
	Node  Node
	Value T
}

type Call

type Call struct {
	Name string
	Args []Node
	// contains filtered or unexported fields
}

type Cmp

type Cmp struct {
	Op    CmpOp
	Left  Node
	Right Node
	// contains filtered or unexported fields
}

type CmpOp

type CmpOp int8
const (
	CmpInvalid CmpOp = iota
	CmpEq
	CmpNe
	CmpGt
	CmpGe
	CmpLt
	CmpLe
)

func ParseCmpOp

func ParseCmpOp(s string) CmpOp

func (CmpOp) String

func (o CmpOp) String() string

type CreateArray

type CreateArray struct {
	Items []Node
	// contains filtered or unexported fields
}

type CreateObject

type CreateObject struct {
	Fields map[string]Node
	// contains filtered or unexported fields
}

type Current

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

type Evaluator

type Evaluator[T any] struct {
	// contains filtered or unexported fields
}

func (Evaluator[T]) Eval

func (e Evaluator[T]) Eval(node Node, obj T) T

func (Evaluator[T]) EvalAnd

func (e Evaluator[T]) EvalAnd(node *And, obj T) T

func (Evaluator[T]) EvalCall

func (e Evaluator[T]) EvalCall(node *Call, obj T) T

func (Evaluator[T]) EvalCmp

func (e Evaluator[T]) EvalCmp(node *Cmp, obj T) T

func (Evaluator[T]) EvalCreateArray

func (e Evaluator[T]) EvalCreateArray(node *CreateArray, obj T) T

func (Evaluator[T]) EvalCreateObject

func (e Evaluator[T]) EvalCreateObject(node *CreateObject, obj T) T

func (Evaluator[T]) EvalCurrent

func (e Evaluator[T]) EvalCurrent(node *Current, obj T) T

func (Evaluator[T]) EvalExprRef

func (e Evaluator[T]) EvalExprRef(node *ExprRef, obj T) T

func (Evaluator[T]) EvalFlattenArray

func (e Evaluator[T]) EvalFlattenArray(node *FlattenArray, obj T) T

func (Evaluator[T]) EvalFlattenObject

func (e Evaluator[T]) EvalFlattenObject(node *FlattenObject, obj T) T

func (Evaluator[T]) EvalIndex

func (e Evaluator[T]) EvalIndex(node *Index, obj T) T

func (Evaluator[T]) EvalJsonLiteral

func (e Evaluator[T]) EvalJsonLiteral(node *JsonLiteral, obj T) T

func (Evaluator[T]) EvalNegate

func (e Evaluator[T]) EvalNegate(node *Negate, obj T) T

func (Evaluator[T]) EvalOr

func (e Evaluator[T]) EvalOr(node *Or, obj T) T

func (Evaluator[T]) EvalParameter

func (e Evaluator[T]) EvalParameter(node *Parameter, obj T) T

func (Evaluator[T]) EvalProject

func (e Evaluator[T]) EvalProject(node *Project, obj T) T

func (Evaluator[T]) EvalProperty

func (e Evaluator[T]) EvalProperty(node *Property, obj T) T

func (Evaluator[T]) EvalSelection

func (e Evaluator[T]) EvalSelection(node *Selection, obj T) T

func (Evaluator[T]) EvalSequence

func (e Evaluator[T]) EvalSequence(node *Sequence, obj T) T

func (Evaluator[T]) EvalSlice

func (e Evaluator[T]) EvalSlice(node *Slice, obj T) T

func (Evaluator[T]) EvalString

func (e Evaluator[T]) EvalString(node *String, obj T) T

type ExprRef

type ExprRef struct {
	Expr Node
	// contains filtered or unexported fields
}

type FlattenArray

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

type FlattenObject

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

type Function

type Function struct {
	Name string
	Fn   func([]Arg[any]) any
}

type Index

type Index struct {
	Value int
	// contains filtered or unexported fields
}

type JsonLiteral

type JsonLiteral struct {
	Text string
	// contains filtered or unexported fields
}

type Leaf

type Leaf interface {
	Node
	// contains filtered or unexported methods
}

type NameTarget

type NameTarget string

type Negate

type Negate struct {
	Item Node
	// contains filtered or unexported fields
}

type Node

type Node interface {
	// contains filtered or unexported methods
}

type NumberTarget

type NumberTarget int

type Op

type Op interface {
	Node
	// contains filtered or unexported methods
}

type Or

type Or struct {
	Left  Node
	Right Node
	// contains filtered or unexported fields
}

type Parameter

type Parameter struct {
	Target Target
	// contains filtered or unexported fields
}

type Project

type Project struct {
	Child Node
	// contains filtered or unexported fields
}

type Property

type Property struct {
	Name string
	// contains filtered or unexported fields
}

type Runtime

type Runtime[T any] interface {
	IsTruthy(obj T) bool
	GetType(obj T) ValueType
	IsNull(obj T) bool
	CreateNull() T
	Compare(o CmpOp, left, right T) T
	CreateArray(items []T) T
	CreateObject(fields map[string]T) T
	ToIterable(obj T) []T
	InvokeFunction(name string, args []Arg[T]) T
	CreateBool(value bool) T
	GetProperty(obj T, field string) T
	ParseStr(s string) T
	CreateStr(val string) T
	GetNumVar(num int) T
	GetNameVar(name string) T
}

type Selection

type Selection struct {
	Node
	Child Node
}

type Sequence

type Sequence struct {
	Items []Node
	// contains filtered or unexported fields
}

type SimpleRuntime

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

func (*SimpleRuntime) AddFunctions

func (r *SimpleRuntime) AddFunctions(fns ...Function)

func (SimpleRuntime) Compare

func (r SimpleRuntime) Compare(o CmpOp, left, right any) any

func (SimpleRuntime) CreateArray

func (r SimpleRuntime) CreateArray(items []any) any

func (SimpleRuntime) CreateBool

func (r SimpleRuntime) CreateBool(value bool) any

func (SimpleRuntime) CreateNull

func (r SimpleRuntime) CreateNull() any

func (SimpleRuntime) CreateObject

func (r SimpleRuntime) CreateObject(fields map[string]any) any

func (SimpleRuntime) CreateStr

func (r SimpleRuntime) CreateStr(val string) any

func (SimpleRuntime) GetNameVar

func (r SimpleRuntime) GetNameVar(name string) any

func (SimpleRuntime) GetNumVar

func (r SimpleRuntime) GetNumVar(num int) any

func (SimpleRuntime) GetProperty

func (r SimpleRuntime) GetProperty(obj any, field string) any

func (SimpleRuntime) GetType

func (r SimpleRuntime) GetType(obj any) ValueType

func (SimpleRuntime) InvokeFunction

func (r SimpleRuntime) InvokeFunction(name string, args []Arg[any]) any

func (SimpleRuntime) IsNull

func (r SimpleRuntime) IsNull(obj any) bool

func (SimpleRuntime) IsTruthy

func (r SimpleRuntime) IsTruthy(obj any) bool

func (SimpleRuntime) ParseStr

func (r SimpleRuntime) ParseStr(s string) any

func (SimpleRuntime) ToIterable

func (r SimpleRuntime) ToIterable(obj any) []any

type Slice

type Slice struct {
	Start bt.Optional[int]
	Stop  bt.Optional[int]
	Step  bt.Optional[int]
	// contains filtered or unexported fields
}

type String

type String struct {
	Value string
	// contains filtered or unexported fields
}

type Target

type Target interface {
	// contains filtered or unexported methods
}

type ValueType

type ValueType int8
const (
	InvalidType ValueType = iota
	NumberType
	StringType
	BooleanType
	ArrayType
	ObjectType
	NullType
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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