filter

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 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 = Expr{}

All represents filter which includes all the documents of the collection.

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 GtBytes

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

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

func GtFloat32

func GtFloat32(field string, value float32) Expr

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

func GtFloat64

func GtFloat64(field string, value float64) Expr

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

func GtInt

func GtInt(field string, value int) Expr

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

func GtInt32

func GtInt32(field string, value int32) Expr

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

func GtInt64

func GtInt64(field string, value int64) Expr

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

func GtString

func GtString(field string, value string) Expr

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

func GtTime

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

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

func GtUUID

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

GtUUID composes 'equal' operation. from uuid.UUID value. 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 GteBytes

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

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

func GteFloat32

func GteFloat32(field string, value float32) Expr

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

func GteFloat64

func GteFloat64(field string, value float64) Expr

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

func GteInt

func GteInt(field string, value int) Expr

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

func GteInt32

func GteInt32(field string, value int32) Expr

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

func GteInt64

func GteInt64(field string, value int64) Expr

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

func GteString

func GteString(field string, value string) Expr

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

func GteTime

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

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

func GteUUID

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

GteUUID composes 'equal' operation. from uuid.UUID value. 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 LtBytes

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

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

func LtFloat32

func LtFloat32(field string, value float32) Expr

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

func LtFloat64

func LtFloat64(field string, value float64) Expr

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

func LtInt

func LtInt(field string, value int) Expr

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

func LtInt32

func LtInt32(field string, value int32) Expr

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

func LtInt64

func LtInt64(field string, value int64) Expr

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

func LtString

func LtString(field string, value string) Expr

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

func LtTime

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

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

func LtUUID

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

LtUUID composes 'equal' operation. from uuid.UUID value. 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 LteBytes

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

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

func LteFloat32

func LteFloat32(field string, value float32) Expr

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

func LteFloat64

func LteFloat64(field string, value float64) Expr

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

func LteInt

func LteInt(field string, value int) Expr

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

func LteInt32

func LteInt32(field string, value int32) Expr

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

func LteInt64

func LteInt64(field string, value int64) Expr

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

func LteString

func LteString(field string, value string) Expr

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

func LteTime

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

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

func LteUUID

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

LteUUID composes 'equal' operation. from uuid.UUID value. 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