filters

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// IgnoreCase
	// Case insensitivity to match upper and lower cases. For an example, see
	// Perform Case-Insensitive Regular Expression Match.
	IgnoreCase = "i"

	// MultilineMatch
	// For patterns that include anchors (i.e. ^ for the start, $ for the end),
	// match at the beginning or end of each line for strings with multiline values.
	// Without this option, these anchors match at beginning or end of the string.
	// For an example, see Multiline Match for Lines Starting with Specified Pattern.
	// If the pattern contains no anchors or if the string value has no newline
	// characters (e.g. \n), the m option has no effect.
	MultilineMatch = "m"

	// Extended
	// "Extended" capability to ignore all white space characters in the $regex
	// pattern unless escaped or included in a character class.
	// Additionally, it ignores characters in-between and including an un-escaped
	// hash/pound (#) character and the next new line, so that you may include comments
	// in complicated patterns. This only applies to data characters; white space
	// characters may never appear within special character sequences in a pattern.
	// The x option does not affect the handling of the VT character (i.e. code 11).
	Extended = "x"

	// AllowDotChar
	// Allows the dot character (i.e. .) to match all characters including newline characters.
	// For an example, see Use the . Dot Character to Match New Line.
	AllowDotChar = "s"
)

Variables

View Source
var (
	DataTypeDouble              = &DataType{number: 1, alias: "double"}
	DataTypeString              = &DataType{number: 2, alias: "string"}
	DataTypeObject              = &DataType{number: 3, alias: "object"}
	DataTypeArray               = &DataType{number: 4, alias: "array"}
	DataTypeBinaryData          = &DataType{number: 5, alias: "binData"}
	DataTypeUndefined           = &DataType{number: 6, alias: "undefined"}
	DataTypeObjectId            = &DataType{number: 7, alias: "objectId"}
	DataTypeBool                = &DataType{number: 8, alias: "bool"}
	DataTypeDate                = &DataType{number: 9, alias: "date"}
	DataTypeNull                = &DataType{number: 10, alias: "null"}
	DataTypeRegex               = &DataType{number: 11, alias: "regex"}
	DataTypeDBPointer           = &DataType{number: 12, alias: "dbPointer"}
	DataTypeJavascript          = &DataType{number: 13, alias: "javascript"}
	DataTypeSymbol              = &DataType{number: 14, alias: "symbol"}
	DataTypeJavascriptWithScope = &DataType{number: 15, alias: "javascriptWithScope"}
	DataTypeInt32               = &DataType{number: 16, alias: "int"}
	DataTypeTimestamp           = &DataType{number: 17, alias: "timestamp"}
	DataTypeInt64               = &DataType{number: 18, alias: "long"}
	DataTypeDecimal128          = &DataType{number: 19, alias: "decimal"}
	DataTypeMinKey              = &DataType{number: -1, alias: "minKey"}
	DataTypeMaxKey              = &DataType{number: 127, alias: "maxKey"}
)

Functions

This section is empty.

Types

type DataType added in v0.0.26

type DataType struct {
	// contains filtered or unexported fields
}

func (*DataType) Alias added in v0.0.26

func (d *DataType) Alias() string

func (*DataType) Order added in v0.0.26

func (d *DataType) Order() int8

type Filter

type Filter struct {
	// contains filtered or unexported fields
}

func All

func All[T any](key string, items []T) *Filter

func And

func And(others ...*Filter) *Filter

func BitsAllClear

func BitsAllClear(key string, mask int) *Filter

func BitsAllClearByBinary

func BitsAllClearByBinary(key string, bin primitive.Binary) *Filter

func BitsAllClearByPositions

func BitsAllClearByPositions(key string, pos []int) *Filter

func BitsAllSet

func BitsAllSet(key string, mask int) *Filter

func BitsAllSetByBinary

func BitsAllSetByBinary(key string, bin primitive.Binary) *Filter

func BitsAllSetByPositions

func BitsAllSetByPositions(key string, pos []int) *Filter

func BitsAnyClear

func BitsAnyClear(key string, mask int) *Filter

func BitsAnyClearByBinary

func BitsAnyClearByBinary(key string, bin primitive.Binary) *Filter

func BitsAnyClearByPositions

func BitsAnyClearByPositions(key string, pos []int) *Filter

func BitsAnySet

func BitsAnySet(key string, mask int) *Filter

func BitsAnySetByBinary

func BitsAnySetByBinary(key string, bin primitive.Binary) *Filter

func BitsAnySetByPositions

func BitsAnySetByPositions(key string, pos []int) *Filter

func Cast

func Cast(d rawbson.D) *Filter

func ElemMatch

func ElemMatch(key string, sub *Filter) *Filter

func ElemMatchWithInterval added in v0.0.26

func ElemMatchWithInterval(key string, interval *Interval) *Filter

func Eq

func Eq(key string, val any) *Filter

func Exists

func Exists(key string, val bool) *Filter

func Expr

func Expr(expression any) *Filter

func From

func From(m rawbson.M) *Filter

func Gt

func Gt(key string, val any) *Filter

func Gte

func Gte(key string, val any) *Filter

func In

func In[T any](key string, items []T) *Filter

func Like

func Like(key string, matcher *Matcher) *Filter

func Lt

func Lt(key string, val any) *Filter

func Lte

func Lte(key string, val any) *Filter

func Mod

func Mod(key string, divisor, remainder float64) *Filter

func Ne

func Ne(key string, val any) *Filter

func New

func New() *Filter

func Nin

func Nin[T any](key string, items []T) *Filter

func Nor

func Nor(others ...*Filter) *Filter

func Not

func Not(key string, sub *Filter) *Filter

func Or

func Or(others ...*Filter) *Filter

func Size

func Size(key string, size int64) *Filter

func Text

func Text(search *text.Search) *Filter

func Type

func Type(key string, val *DataType) *Filter

func Where

func Where(key, expression string) *Filter

func WithInterval added in v0.0.26

func WithInterval(key string, val *Interval) *Filter

func (*Filter) All

func (f *Filter) All(key string, items []any) *Filter

func (*Filter) And

func (f *Filter) And(others ...*Filter) *Filter

func (*Filter) Append

func (f *Filter) Append(other *Filter) *Filter

func (*Filter) BitsAllClear

func (f *Filter) BitsAllClear(key string, mask int) *Filter

func (*Filter) BitsAllClearByBinary

func (f *Filter) BitsAllClearByBinary(key string, bin primitive.Binary) *Filter

func (*Filter) BitsAllClearByPositions

func (f *Filter) BitsAllClearByPositions(key string, pos []int) *Filter

func (*Filter) BitsAllSet

func (f *Filter) BitsAllSet(key string, mask int) *Filter

func (*Filter) BitsAllSetByBinary

func (f *Filter) BitsAllSetByBinary(key string, bin primitive.Binary) *Filter

func (*Filter) BitsAllSetByPositions

func (f *Filter) BitsAllSetByPositions(key string, pos []int) *Filter

func (*Filter) BitsAnyClear

func (f *Filter) BitsAnyClear(key string, mask int) *Filter

func (*Filter) BitsAnyClearByBinary

func (f *Filter) BitsAnyClearByBinary(key string, bin primitive.Binary) *Filter

func (*Filter) BitsAnyClearByPositions

func (f *Filter) BitsAnyClearByPositions(key string, pos []int) *Filter

func (*Filter) BitsAnySet

func (f *Filter) BitsAnySet(key string, mask int) *Filter

func (*Filter) BitsAnySetByBinary

func (f *Filter) BitsAnySetByBinary(key string, bin primitive.Binary) *Filter

func (*Filter) BitsAnySetByPositions

func (f *Filter) BitsAnySetByPositions(key string, pos []int) *Filter

func (*Filter) ElemMatch

func (f *Filter) ElemMatch(key string, sub *Filter) *Filter

func (*Filter) ElemMatchWithInterval added in v0.0.26

func (f *Filter) ElemMatchWithInterval(key string, interval *Interval) *Filter

func (*Filter) Eq

func (f *Filter) Eq(key string, val any) *Filter

func (*Filter) Exists

func (f *Filter) Exists(key string, val bool) *Filter

func (*Filter) Expr

func (f *Filter) Expr(expression any) *Filter

func (*Filter) Get

func (f *Filter) Get(key string) (any, bool)

func (*Filter) Gt

func (f *Filter) Gt(key string, val any) *Filter

func (*Filter) Gte

func (f *Filter) Gte(key string, val any) *Filter

func (*Filter) In

func (f *Filter) In(key string, items []any) *Filter

func (*Filter) Like

func (f *Filter) Like(key string, matcher *Matcher) *Filter

func (*Filter) Lt

func (f *Filter) Lt(key string, val any) *Filter

func (*Filter) Lte

func (f *Filter) Lte(key string, val any) *Filter

func (*Filter) MarshalBSON

func (f *Filter) MarshalBSON() ([]byte, error)

func (*Filter) MarshalJSON

func (f *Filter) MarshalJSON() ([]byte, error)

func (*Filter) Mod

func (f *Filter) Mod(key string, divisor, remainder float64) *Filter

func (*Filter) Ne

func (f *Filter) Ne(key string, val any) *Filter

func (*Filter) Nin

func (f *Filter) Nin(key string, items []any) *Filter

func (*Filter) Nor

func (f *Filter) Nor(others ...*Filter) *Filter

func (*Filter) Not

func (f *Filter) Not(key string, sub *Filter) *Filter

func (*Filter) Or

func (f *Filter) Or(others ...*Filter) *Filter

func (*Filter) Raw

func (f *Filter) Raw() rawbson.D

func (*Filter) Size

func (f *Filter) Size(key string, size int64) *Filter

func (*Filter) Text

func (f *Filter) Text(search *text.Search) *Filter

func (*Filter) ToMap

func (f *Filter) ToMap() map[string]any

func (*Filter) Type

func (f *Filter) Type(key string, val *DataType) *Filter

func (*Filter) UnmarshalBSON

func (f *Filter) UnmarshalBSON(bytes []byte) error

func (*Filter) UnmarshalJSON

func (f *Filter) UnmarshalJSON(bytes []byte) error

func (*Filter) Where

func (f *Filter) Where(key, expression string) *Filter

func (*Filter) WithInterval added in v0.0.26

func (f *Filter) WithInterval(key string, val *Interval) *Filter

type Interval added in v0.0.26

type Interval struct {
	// contains filtered or unexported fields
}

func ClosedInterval added in v0.0.26

func ClosedInterval(left, right any) *Interval

func LeftHalfOpen added in v0.0.26

func LeftHalfOpen(left, right any) *Interval

func LeftHalfUnboundInterval added in v0.0.26

func LeftHalfUnboundInterval(left any) *Interval

func LeftUnboundInterval added in v0.0.26

func LeftUnboundInterval(left any) *Interval

func OpenInterval added in v0.0.26

func OpenInterval(left, right any) *Interval

func RightHalfOpen added in v0.0.26

func RightHalfOpen(left, right any) *Interval

func RightHalfUnboundInterval added in v0.0.26

func RightHalfUnboundInterval(right any) *Interval

func RightUnboundInterval added in v0.0.26

func RightUnboundInterval(right any) *Interval

type Matcher added in v0.0.26

type Matcher struct {
	// contains filtered or unexported fields
}

func NewMatcher added in v0.0.26

func NewMatcher(pattern string) *Matcher

func (*Matcher) AllowDotChar added in v0.0.26

func (m *Matcher) AllowDotChar() *Matcher

func (*Matcher) Compile added in v0.0.26

func (m *Matcher) Compile() primitive.Regex

func (*Matcher) Extended added in v0.0.26

func (m *Matcher) Extended() *Matcher

func (*Matcher) IgnoreCase added in v0.0.26

func (m *Matcher) IgnoreCase() *Matcher

func (*Matcher) MarshalBSON added in v0.0.26

func (m *Matcher) MarshalBSON() ([]byte, error)

func (*Matcher) MarshalJSON added in v0.0.26

func (m *Matcher) MarshalJSON() ([]byte, error)

func (*Matcher) MultilineMatch added in v0.0.26

func (m *Matcher) MultilineMatch() *Matcher

func (*Matcher) UnmarshalBSON added in v0.0.26

func (m *Matcher) UnmarshalBSON(bytes []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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