query

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All added in v0.3.0

func All[T any](values ...T) bson.D

func And added in v0.3.0

func And(conditions ...any) bson.D

func ElemMatch added in v0.3.0

func ElemMatch(key string, cond any) bson.D

func Eq added in v0.3.0

func Eq(key string, value any) bson.D

func Exists added in v0.3.0

func Exists(key string, value bool) bson.D

func Expr added in v0.3.0

func Expr(value any) bson.D

func Gt added in v0.3.0

func Gt(key string, value any) bson.D

func Gte added in v0.3.0

func Gte(key string, value any) bson.D

func Id added in v0.3.0

func Id(value any) bson.D

func In added in v0.3.0

func In[T any](key string, values ...T) bson.D

func JsonSchema added in v0.3.0

func JsonSchema(value any) bson.D

func Lt added in v0.3.0

func Lt(key string, value any) bson.D

func Lte added in v0.3.0

func Lte(key string, value any) bson.D

func Mod added in v0.3.0

func Mod(key string, divisor any, remainder int) bson.D

func NIn added in v0.3.0

func NIn[T any](key string, values ...T) bson.D

func Ne added in v0.3.0

func Ne(key string, value any) bson.D

func Nor added in v0.3.0

func Nor(conditions ...any) bson.D

func Not added in v0.3.0

func Not(cond any) bson.D

func Or added in v0.3.0

func Or(conditions ...any) bson.D

func Regex added in v0.3.0

func Regex(key, value string) bson.D

func RegexOptions added in v0.3.0

func RegexOptions(key, value, options string) bson.D

func Size added in v0.3.0

func Size(key string, value int) bson.D

func Slice added in v0.3.0

func Slice(key string, number int) bson.D

func SliceRanger added in v0.3.0

func SliceRanger(key string, start, end int) bson.D

func Text added in v0.3.0

func Text(search string, opt *types.TextOptions) bson.D

func Type added in v0.3.0

func Type(key string, value bsontype.Type) bson.D

func TypeAlias added in v0.3.0

func TypeAlias(key string, value string) bson.D

func TypeArray added in v0.3.0

func TypeArray(key string, values ...bsontype.Type) bson.D

func TypeArrayAlias added in v0.3.0

func TypeArrayAlias(key string, values ...string) bson.D

func Where added in v0.3.0

func Where(value string) bson.D

Types

type Builder

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

func BsonBuilder

func BsonBuilder() *Builder

func (*Builder) Add

func (b *Builder) Add(key string, value any) *Builder

Add appends given types.KeyValue elements to the builder's data slice. Each types.KeyValue is converted into a bson.E before appending.

func (*Builder) All

func (b *Builder) All(key string, values ...any) *Builder

All appends an element with '$all' key and given value to the builder's data slice.

func (*Builder) AllFloat32

func (b *Builder) AllFloat32(key string, values ...float32) *Builder

AllFloat32 appends an element with '$all' key and given value to the builder's data slice.

func (*Builder) AllFloat64

func (b *Builder) AllFloat64(key string, values ...float64) *Builder

AllFloat64 appends an element with '$all' key and given value to the builder's data slice.

func (*Builder) AllInt

func (b *Builder) AllInt(key string, values ...int) *Builder

AllInt appends an element with '$all' key and given value to the builder's data slice.

func (*Builder) AllInt16

func (b *Builder) AllInt16(key string, values ...int16) *Builder

AllInt16 appends an element with '$all' key and given value to the builder's data slice.

func (*Builder) AllInt32

func (b *Builder) AllInt32(key string, values ...int32) *Builder

AllInt32 appends an element with '$all' key and given value to the builder's data slice.

func (*Builder) AllInt64

func (b *Builder) AllInt64(key string, values ...int64) *Builder

AllInt64 appends an element with '$all' key and given value to the builder's data slice.

func (*Builder) AllInt8

func (b *Builder) AllInt8(key string, values ...int8) *Builder

AllInt8 appends an element with '$all' key and given value to the builder's data slice.

func (*Builder) AllString

func (b *Builder) AllString(key string, values ...string) *Builder

AllString appends an element with '$all' key and given value to the builder's data slice.

func (*Builder) AllUint

func (b *Builder) AllUint(key string, values ...uint) *Builder

AllUint appends an element with '$all' key and given value to the builder's data slice.

func (*Builder) AllUint16

func (b *Builder) AllUint16(key string, values ...uint16) *Builder

AllUint16 appends an element with '$all' key and given value to the builder's data slice.

func (*Builder) AllUint32

func (b *Builder) AllUint32(key string, values ...uint32) *Builder

AllUint32 appends an element with '$all' key and given value to the builder's data slice.

func (*Builder) AllUint64

func (b *Builder) AllUint64(key string, values ...uint64) *Builder

AllUint64 appends an element with '$all' key and given value to the builder's data slice.

func (*Builder) AllUint8

func (b *Builder) AllUint8(key string, values ...uint8) *Builder

AllUint8 appends an element with '$all' key and given value to the builder's data slice.

func (*Builder) And

func (b *Builder) And(conditions ...any) *Builder

And 对于 conditions 参数,你同样可以使用 QueryBuilder 去生成

func (*Builder) Build

func (b *Builder) Build() bson.D

func (*Builder) ElemMatch

func (b *Builder) ElemMatch(key string, condition any) *Builder

ElemMatch appends an element with '$elemMatch' key and given value to the builder's data slice.

func (*Builder) Eq

func (b *Builder) Eq(key string, value any) *Builder

func (*Builder) Exists

func (b *Builder) Exists(key string, exists bool) *Builder

func (*Builder) Expr

func (b *Builder) Expr(d bson.D) *Builder

func (*Builder) Gt

func (b *Builder) Gt(key string, value any) *Builder

func (*Builder) Gte

func (b *Builder) Gte(key string, value any) *Builder

func (*Builder) Id

func (b *Builder) Id(v any) *Builder

Id appends an element with '_id' key and given value to the builder's data slice.

func (*Builder) In

func (b *Builder) In(key string, values ...any) *Builder

func (*Builder) InFloat32

func (b *Builder) InFloat32(key string, values ...float32) *Builder

func (*Builder) InFloat64

func (b *Builder) InFloat64(key string, values ...float64) *Builder

func (*Builder) InInt

func (b *Builder) InInt(key string, values ...int) *Builder

func (*Builder) InInt16

func (b *Builder) InInt16(key string, values ...int16) *Builder

func (*Builder) InInt32

func (b *Builder) InInt32(key string, values ...int32) *Builder

func (*Builder) InInt64

func (b *Builder) InInt64(key string, values ...int64) *Builder

func (*Builder) InInt8

func (b *Builder) InInt8(key string, values ...int8) *Builder

func (*Builder) InString

func (b *Builder) InString(key string, values ...string) *Builder

func (*Builder) InUint

func (b *Builder) InUint(key string, values ...uint) *Builder

func (*Builder) InUint16

func (b *Builder) InUint16(key string, values ...uint16) *Builder

func (*Builder) InUint32

func (b *Builder) InUint32(key string, values ...uint32) *Builder

func (*Builder) InUint64

func (b *Builder) InUint64(key string, values ...uint64) *Builder

func (*Builder) InUint8

func (b *Builder) InUint8(key string, values ...uint8) *Builder

func (*Builder) JsonSchema

func (b *Builder) JsonSchema(value any) *Builder

func (*Builder) Lt

func (b *Builder) Lt(key string, value any) *Builder

func (*Builder) Lte

func (b *Builder) Lte(key string, value any) *Builder

func (*Builder) Mod

func (b *Builder) Mod(key string, divisor any, remainder int) *Builder

func (*Builder) Ne

func (b *Builder) Ne(key string, value any) *Builder

func (*Builder) Nin

func (b *Builder) Nin(key string, values ...any) *Builder

func (*Builder) NinFloat32

func (b *Builder) NinFloat32(key string, values ...float32) *Builder

func (*Builder) NinFloat64

func (b *Builder) NinFloat64(key string, values ...float64) *Builder

func (*Builder) NinInt

func (b *Builder) NinInt(key string, values ...int) *Builder

func (*Builder) NinInt16

func (b *Builder) NinInt16(key string, values ...int16) *Builder

func (*Builder) NinInt32

func (b *Builder) NinInt32(key string, values ...int32) *Builder

func (*Builder) NinInt64

func (b *Builder) NinInt64(key string, values ...int64) *Builder

func (*Builder) NinInt8

func (b *Builder) NinInt8(key string, values ...int8) *Builder

func (*Builder) NinString

func (b *Builder) NinString(key string, values ...string) *Builder

func (*Builder) NinUint

func (b *Builder) NinUint(key string, values ...uint) *Builder

func (*Builder) NinUint16

func (b *Builder) NinUint16(key string, values ...uint16) *Builder

func (*Builder) NinUint32

func (b *Builder) NinUint32(key string, values ...uint32) *Builder

func (*Builder) NinUint64

func (b *Builder) NinUint64(key string, values ...uint64) *Builder

func (*Builder) NinUint8

func (b *Builder) NinUint8(key string, values ...uint8) *Builder

func (*Builder) Nor

func (b *Builder) Nor(conditions ...any) *Builder

Nor 对于 conditions 参数,你同样可以使用 QueryBuilder 去生成

func (*Builder) Not

func (b *Builder) Not(condition any) *Builder

func (*Builder) Or

func (b *Builder) Or(conditions ...any) *Builder

Or 对于 conditions 参数,你同样可以使用 QueryBuilder 去生成

func (*Builder) Regex

func (b *Builder) Regex(key, value string) *Builder

func (*Builder) RegexOptions

func (b *Builder) RegexOptions(key, value, options string) *Builder

func (*Builder) Size

func (b *Builder) Size(key string, size int) *Builder

Size appends an element with '$size' key and given value to the builder's data slice.

func (*Builder) Slice

func (b *Builder) Slice(key string, number int) *Builder

func (*Builder) SliceRanger

func (b *Builder) SliceRanger(key string, start, end int) *Builder

func (*Builder) Text

func (b *Builder) Text(value, language string, caseSensitive, diacriticSensitive bool) *Builder

Text 如果 language 的值为零值,则不作为查询条件 If the value of language is zero, it is not used as a query condition 如果 caseSensitive 的值为零值,则不作为查询条件 If the value of caseSensitive is zero, it is not used as a query condition 如果 diacriticSensitive 的值为零值,则不作为查询条件 If the value of diacriticSensitive is zero, it is not used as a query condition

func (*Builder) Type

func (b *Builder) Type(key string, t bsontype.Type) *Builder

func (*Builder) TypeAlias

func (b *Builder) TypeAlias(key string, alias string) *Builder

func (*Builder) TypeArray

func (b *Builder) TypeArray(key string, ts ...bsontype.Type) *Builder

func (*Builder) TypeArrayAlias

func (b *Builder) TypeArrayAlias(key string, aliases ...string) *Builder

func (*Builder) Where

func (b *Builder) Where(value string) *Builder

Jump to

Keyboard shortcuts

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