filter

package
v1.0.0-alpha.33 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2022 License: Apache-2.0 Imports: 5 Imported by: 5

Documentation

Overview

Package filter provides methods to build logical filters. Filters are used to read or update only documents, which satisfies the filter.

Index

Constants

This section is empty.

Variables

View Source
var (
	//All represents filter which includes all the documents of the collection
	All = Expr{}
)

Functions

This section is empty.

Types

type Expr

type Expr map[string]interface{}

func And

func And(ops ...Expr) Expr

And composes 'and' operation. Result is equivalent to: (ops[0] && ... && ops[len(ops-1])

func Eq

func Eq[T schema.PrimitiveFieldType](field string, value T) Expr

Eq composes 'equal' operation. Result is equivalent to: field == value

func EqBytes

func EqBytes(field string, value []byte) Expr

EqBytes composes 'equal' operation from []byte value. Result is equivalent to: field == value

func EqFloat32

func EqFloat32(field string, value float32) Expr

EqFloat32 composes 'equal' operation from float32 value. Result is equivalent to: field == value

func EqFloat64

func EqFloat64(field string, value float64) Expr

EqFloat64 composes 'equal' operation from float64 value. Result is equivalent to: field == value

func EqInt

func EqInt(field string, value int) Expr

EqInt composes 'equal' operation from int value. Result is equivalent to: field == value

func EqInt32

func EqInt32(field string, value int32) Expr

EqInt32 composes 'equal' operation from int32 value. Result is equivalent to: field == value

func EqInt64

func EqInt64(field string, value int64) Expr

EqInt64 composes 'equal' operation from int64 value. Result is equivalent to: field == value

func EqString

func EqString(field string, value string) Expr

EqString composes 'equal' operation from string value. Result is equivalent to: field == value

func EqTime

func EqTime(field string, value time.Time) Expr

EqTime composes 'equal' operation. from time.Time value. Result is equivalent to: field == value

func EqUUID

func EqUUID(field string, value uuid.UUID) Expr

EqUUID composes 'equal' operation. from uuid.UUID value. Result is equivalent to: field == value

func Gt

func Gt(field string, value interface{}) Expr

Gt composes 'greater than' operation. Result is equivalent to: field > value

func Gte

func Gte(field string, value interface{}) Expr

Gte composes 'greater than or equal' operation. Result is equivalent to: field >= value

func Lt

func Lt(field string, value interface{}) Expr

Lt composes 'less than' operation. Result is equivalent to: field < value

func Lte

func Lte(field string, value interface{}) Expr

Lte composes 'less than or equal' operation. Result is equivalent to: field <= value

func Or

func Or(ops ...Expr) Expr

Or composes 'or' operation. Result is equivalent to: (ops[0] || ... || ops[len(ops-1])

func (Expr) Build

func (prev Expr) Build() (driver.Filter, error)

Build materializes the filter

type Filter

type Filter = Expr

type Operand

type Operand map[string]comparison

Jump to

Keyboard shortcuts

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