query

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: MIT Imports: 12 Imported by: 17

Documentation

Index

Constants

View Source
const (
	TypeNull   = Type(encoding.TypeNull)
	TypeNumber = Type(encoding.TypeNumber)
	TypeString = Type(encoding.TypeString)
	TypeFalse  = Type(encoding.TypeFalse)
	TypeTrue   = Type(encoding.TypeTrue)
	TypeArray  = Type(encoding.TypeArray)
	TypeObject = Type(encoding.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(_ *fastjson.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 *fastjson.Value) bool

func (And) String

func (e And) String() string

type Bound

type Bound struct {
	Start, End   key.Key
	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) Reverse

func (bs Bounds) Reverse()

func (Bounds) SetPrefix

func (bs Bounds) SetPrefix(k key.Key)

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 (*Comp) IndexBounds

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

func (*Comp) Ok

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

func (*Comp) OkBytes

func (e *Comp) OkBytes(b []byte) 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 *fastjson.Value) bool

func (Exists) String

func (e Exists) String() string

type Filter

type Filter interface {
	Ok(v *fastjson.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 *fastjson.Value) bool

func (Key) String

func (e Key) String() string

type Modifier

type Modifier interface {
	Modify(a *fastjson.Arena, v *fastjson.Value) (result *fastjson.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 *fastjson.Arena, v *fastjson.Value) (result *fastjson.Value, modified bool, err error)

type ModifyFunc

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

func (ModifyFunc) Modify

func (m ModifyFunc) Modify(a *fastjson.Arena, v *fastjson.Value) (result *fastjson.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 *fastjson.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 *fastjson.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 *fastjson.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 *fastjson.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 *fastjson.Value) bool

func (Size) String

func (s Size) String() string

type Sort

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

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(k []byte, v *fastjson.Value) []byte

func (*SortField) Fields

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

type Sorts

type Sorts []Sort

func (Sorts) AppendKey

func (ss Sorts) AppendKey(k []byte, v *fastjson.Value) []byte

func (Sorts) Fields

func (ss Sorts) Fields() []SortField

type Type

type Type encoding.Type

func (Type) String

func (t Type) String() string

type TypeFilter

type TypeFilter struct {
	Type encoding.Type
}

func (TypeFilter) IndexBounds

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

func (TypeFilter) Ok

func (e TypeFilter) Ok(v *fastjson.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