filters

package
v1.25.7 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: BSD-3-Clause Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	InternalPropBackwardsCompatID  = "id"
	InternalPropID                 = "_id"
	InternalNullIndex              = "_nullState"
	InternalPropertyLength         = "_propertyLength"
	InternalPropCreationTimeUnix   = "_creationTimeUnix"
	InternalPropLastUpdateTimeUnix = "_lastUpdateTimeUnix"
)
View Source
const (
	InternalNotNullState = iota
	InternalNullState
)

NotNullState is encoded as 0, so it can be read with the IsNull operator and value false.

View Source
const (
	// LimitFlagSearchByDist indicates that the
	// vector search should be conducted by
	// distance, without limit
	LimitFlagSearchByDist int = iota - 2

	// LimitFlagNotSet indicates that no limit
	// was provided by the client
	LimitFlagNotSet
)

Variables

This section is empty.

Functions

func IsInternalProperty

func IsInternalProperty(propName schema.PropertyName) bool

func ValidateCursor added in v1.18.0

func ValidateCursor(className schema.ClassName, cursor *Cursor, offset int, filters *LocalFilter, sort []Sort) error

func ValidateFilters

func ValidateFilters(fn func(string) *models.Class, filters *LocalFilter) error

func ValidateSort

func ValidateSort(getClass func(string) *models.Class, className schema.ClassName, sort []Sort) error

Types

type AnalyticsProps

type AnalyticsProps struct {
	UseAnalyticsEngine bool
	ForceRecalculate   bool
}

AnalyticsProps will be extracted from the graphql args of analytics functions (such as Meta and Aggregate). They tell the connectors whether to use an external analytics engine if such an engine is configured.

type Clause

type Clause struct {
	Operator Operator `json:"operator"`
	On       *Path    `json:"on"`
	Value    *Value   `json:"value"`
	Operands []Clause `json:"operands"`
}

type Cursor added in v1.18.0

type Cursor struct {
	After string `json:"after"`
	Limit int    `json:"limit"`
}

func ExtractCursorFromArgs added in v1.18.0

func ExtractCursorFromArgs(args map[string]interface{}) (*Cursor, error)

ExtractCursorFromArgs gets the limit key out of a map. Not specific to GQL, but can be used from GQL

type GeoRange

type GeoRange struct {
	*models.GeoCoordinates
	Distance float32 `json:"distance"`
}

GeoRange to be used with fields of type GeoCoordinates. Identifies a point and a maximum distance from that point.

type LocalFilter

type LocalFilter struct {
	Root *Clause `json:"root"`
}

type Operator

type Operator int
const (
	OperatorEqual Operator = iota + 1
	OperatorNotEqual
	OperatorGreaterThan
	OperatorGreaterThanEqual
	OperatorLessThan
	OperatorLessThanEqual
	OperatorAnd
	OperatorOr
	OperatorWithinGeoRange
	OperatorLike
	OperatorIsNull
	ContainsAny
	ContainsAll
)

func (Operator) Name

func (o Operator) Name() string

func (Operator) OnValue

func (o Operator) OnValue() bool

type Pagination

type Pagination struct {
	Offset  int
	Limit   int
	Autocut int
}

func ExtractPaginationFromArgs

func ExtractPaginationFromArgs(args map[string]interface{}) (*Pagination, error)

ExtractPaginationFromArgs gets the limit key out of a map. Not specific to GQL, but can be used from GQL

type Path

type Path struct {
	Class    schema.ClassName    `json:"class"`
	Property schema.PropertyName `json:"property"`

	// If nil, then this is the property we're interested in.
	// If a pointer to another Path, the constraint applies to that one.
	Child *Path `json:"child"`
}

Represents the path in a filter. Either RelationProperty or PrimitiveProperty must be empty (e.g. "").

func ParsePath

func ParsePath(pathElements []interface{}, rootClass string) (*Path, error)

ParsePath Parses the path It parses an array of strings in this format [0] ClassName -> The root class name we're drilling down from [1] propertyName -> The property name we're interested in.

func (*Path) GetInnerMost

func (p *Path) GetInnerMost() *Path

GetInnerMost recursively searches for child paths, only when no more children can be found will the path be returned

func (*Path) Slice

func (p *Path) Slice() []string

Slice flattens the nested path into a slice of segments

func (*Path) SliceInterface

func (p *Path) SliceInterface() []interface{}

type Sort

type Sort struct {
	Path  []string `json:"path"`
	Order string   `json:"order"`
}

Sort contains path and order (asc, desc) information

func ExtractSortFromArgs

func ExtractSortFromArgs(in []interface{}) []Sort

ExtractSortFromArgs gets the sort parameters

type Value

type Value struct {
	Value interface{}     `json:"value"`
	Type  schema.DataType `json:"type"`
}

func (*Value) UnmarshalJSON

func (v *Value) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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