common_filters

package
v0.0.0-...-8832f83 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2019 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

                         _       _
*__      _____  __ ___   ___  __ _| |_ ___
*\ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
* \ V  V /  __/ (_| |\ V /| | (_| | ||  __/
*  \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
*
* Copyright © 2016 - 2019 Weaviate. All rights reserved.
* LICENSE: https://github.com/creativesoftwarefdn/weaviate/blob/develop/LICENSE.md
* DESIGN & CONCEPT: Bob van Luijt (@bobvanluijt)
* CONTACT: hello@creativesoftwarefdn.org

Package common_filters provides the filters for the graphql endpoint for Weaviate

                         _       _
*__      _____  __ ___   ___  __ _| |_ ___
*\ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
* \ V  V /  __/ (_| |\ V /| | (_| | ||  __/
*  \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
*
* Copyright © 2016 - 2019 Weaviate. All rights reserved.
* LICENSE: https://github.com/creativesoftwarefdn/weaviate/blob/develop/LICENSE.md
* DESIGN & CONCEPT: Bob van Luijt (@bobvanluijt)
* CONTACT: hello@creativesoftwarefdn.org

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildNew

The filters common to Local->Get and Local->GetMeta queries.

Types

type Clause

type Clause struct {
	Operator Operator
	On       *Path
	Value    *Value
	Operands []Clause
}

type GeoRange

type GeoRange struct {
	*models.GeoCoordinates
	Distance float32
}

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
}

func ExtractFilters

func ExtractFilters(args map[string]interface{}, rootClass string) (*LocalFilter, error)

Extract the filters from the arguments of a Local->Get or Local->GetMeta query.

type Operator

type Operator int
const (
	OperatorEqual            Operator = 1
	OperatorNotEqual         Operator = 2
	OperatorGreaterThan      Operator = 3
	OperatorGreaterThanEqual Operator = 4
	OperatorLessThan         Operator = 5
	OperatorLessThanEqual    Operator = 6
	OperatorAnd              Operator = 7
	OperatorOr               Operator = 8
	OperatorNot              Operator = 9
	OperatorWithinGeoRange   Operator = 10
)

func (Operator) Name

func (o Operator) Name() string

func (Operator) OnValue

func (o Operator) OnValue() bool

type Path

type Path struct {
	Class    schema.ClassName
	Property schema.PropertyName

	// 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
}

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() []interface{}

Slice flattens the nested path into a slice of segments

type Value

type Value struct {
	Value interface{}
	Type  schema.DataType
}

func ParseValue

func ParseValue(args map[string]interface{}) (*Value, error)

ParseValue used in a comparator operator.

Jump to

Keyboard shortcuts

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