query

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: MIT Imports: 11 Imported by: 6

Documentation

Index

Constants

View Source
const (
	TypeNull   = Type(anyenc.TypeNull)
	TypeNumber = Type(anyenc.TypeNumber)
	TypeString = Type(anyenc.TypeString)
	TypeFalse  = Type(anyenc.TypeFalse)
	TypeTrue   = Type(anyenc.TypeTrue)
	TypeArray  = Type(anyenc.TypeArray)
	TypeObject = Type(anyenc.TypeObject)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type All

type All struct{}

func (All) IndexBounds

func (a All) IndexBounds(fieldName string, bs Bounds) (bounds Bounds)

func (All) Ok

func (a All) Ok(_ *anyenc.Value) bool

func (All) String

func (a All) String() string

type And

type And []Filter

func (And) IndexBounds

func (e And) IndexBounds(fieldName string, bs Bounds) (bounds Bounds)

func (And) Ok

func (e And) Ok(v *anyenc.Value) bool

func (And) String

func (e And) String() string

type Bound

type Bound struct {
	Start, End anyenc.Tuple

	StartInclude bool
	EndInclude   bool
	// contains filtered or unexported fields
}

func (Bound) String

func (b Bound) String() string

type Bounds

type Bounds []Bound

func (Bounds) Append

func (bs Bounds) Append(b Bound) Bounds

func (Bounds) Len

func (bs Bounds) Len() int

func (Bounds) Less

func (bs Bounds) Less(i, j int) bool

func (Bounds) Merge

func (bs Bounds) Merge() Bounds

func (Bounds) String

func (bs Bounds) String() string

func (Bounds) Swap

func (bs Bounds) Swap(i, j int)

type Comp

type Comp struct {
	EqValue []byte

	CompOp CompOp
	// contains filtered or unexported fields
}

func NewComp

func NewComp(op CompOp, value any) *Comp

func NewCompValue added in v0.1.0

func NewCompValue(op CompOp, value *anyenc.Value) *Comp

func (*Comp) IndexBounds

func (e *Comp) IndexBounds(fieldName string, bs Bounds) (bounds Bounds)

func (*Comp) Ok

func (e *Comp) Ok(v *anyenc.Value) bool

func (*Comp) String

func (e *Comp) String() string

type CompOp

type CompOp uint8
const (
	CompOpEq CompOp = iota
	CompOpGt
	CompOpGte
	CompOpLt
	CompOpLte
	CompOpNe
)

type Exists

type Exists struct{}

func (Exists) IndexBounds

func (e Exists) IndexBounds(fieldName string, bs Bounds) (bounds Bounds)

func (Exists) Ok

func (e Exists) Ok(v *anyenc.Value) bool

func (Exists) String

func (e Exists) String() string

type Filter

type Filter interface {
	Ok(v *anyenc.Value) bool

	IndexBounds(fieldName string, bs Bounds) (bounds Bounds)

	fmt.Stringer
}

func MustParseCondition

func MustParseCondition(cond any) Filter

func ParseCondition

func ParseCondition(cond any) (Filter, error)

type Key

type Key struct {
	Path []string
	Filter
}

func (Key) IndexBounds

func (e Key) IndexBounds(fieldName string, bs Bounds) (bounds Bounds)

func (Key) Ok

func (e Key) Ok(v *anyenc.Value) bool

func (Key) String

func (e Key) String() string

type Modifier

type Modifier interface {
	Modify(a *anyenc.Arena, v *anyenc.Value) (result *anyenc.Value, modified bool, err error)
}

func MustParseModifier

func MustParseModifier(modifier any) Modifier

func ParseModifier

func ParseModifier(modifier any) (Modifier, error)

type ModifierChain

type ModifierChain []Modifier

func (ModifierChain) Modify

func (mRoot ModifierChain) Modify(a *anyenc.Arena, v *anyenc.Value) (result *anyenc.Value, modified bool, err error)

type ModifyFunc

type ModifyFunc func(a *anyenc.Arena, v *anyenc.Value) (result *anyenc.Value, modified bool, err error)

func (ModifyFunc) Modify

func (m ModifyFunc) Modify(a *anyenc.Arena, v *anyenc.Value) (result *anyenc.Value, modified bool, err error)

type Nor

type Nor []Filter

func (Nor) IndexBounds

func (e Nor) IndexBounds(fieldName string, bs Bounds) (bounds Bounds)

func (Nor) Ok

func (e Nor) Ok(v *anyenc.Value) bool

func (Nor) String

func (e Nor) String() string

type Not

type Not struct {
	Filter
}

func (Not) IndexBounds

func (e Not) IndexBounds(fieldName string, bs Bounds) (bounds Bounds)

func (Not) Ok

func (e Not) Ok(v *anyenc.Value) bool

func (Not) String

func (e Not) String() string

type Operator

type Operator uint8

type Or

type Or []Filter

func (Or) IndexBounds

func (e Or) IndexBounds(fieldName string, bs Bounds) (bounds Bounds)

func (Or) Ok

func (e Or) Ok(v *anyenc.Value) bool

func (Or) String

func (e Or) String() string

type Regexp

type Regexp struct {
	Regexp *regexp.Regexp
}

func (Regexp) IndexBounds

func (r Regexp) IndexBounds(_ string, bs Bounds) (bounds Bounds)

func (Regexp) Ok

func (r Regexp) Ok(v *anyenc.Value) bool

func (Regexp) String

func (r Regexp) String() string

type Size

type Size struct {
	Size int64
}

func (Size) IndexBounds

func (s Size) IndexBounds(_ string, bs Bounds) (bounds Bounds)

func (Size) Ok

func (s Size) Ok(v *anyenc.Value) bool

func (Size) String

func (s Size) String() string

type Sort

type Sort interface {
	Fields() []SortField
	AppendKey(k anyenc.Tuple, v *anyenc.Value) anyenc.Tuple
}

func MustParseSort

func MustParseSort(sorts ...any) Sort

func ParseSort

func ParseSort(sorts ...any) (Sort, error)

type SortField

type SortField struct {
	Field   string
	Path    []string
	Reverse bool
}

func (*SortField) AppendKey

func (s *SortField) AppendKey(tuple anyenc.Tuple, v *anyenc.Value) anyenc.Tuple

func (*SortField) Fields

func (s *SortField) Fields() []SortField

type Sorts

type Sorts []Sort

func (Sorts) AppendKey

func (ss Sorts) AppendKey(k anyenc.Tuple, v *anyenc.Value) anyenc.Tuple

func (Sorts) Fields

func (ss Sorts) Fields() []SortField

type Type

type Type anyenc.Type

func (Type) String

func (t Type) String() string

type TypeFilter

type TypeFilter struct {
	Type anyenc.Type
}

func (TypeFilter) IndexBounds

func (e TypeFilter) IndexBounds(fieldName string, bs Bounds) (bounds Bounds)

func (TypeFilter) Ok

func (e TypeFilter) Ok(v *anyenc.Value) bool

func (TypeFilter) String

func (e TypeFilter) String() string

Jump to

Keyboard shortcuts

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