query

package
v0.0.0-...-41edef4 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Query

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

查询条件 https://docs.mongodb.com/manual/reference/operator/query-comparison/

func NewQuery

func NewQuery() *Query

func (*Query) All

func (q *Query) All(key string, values []interface{}) *Query

匹配所有

func (*Query) Eq

func (q *Query) Eq(key string, value interface{}) *Query

等于

func (*Query) Exists

func (q *Query) Exists(key string, value bool) *Query

判断字段是否存在

func (*Query) Gt

func (q *Query) Gt(key string, value interface{}) *Query

大于

func (*Query) Gte

func (q *Query) Gte(key string, value interface{}) *Query

大于或等于

func (*Query) In

func (q *Query) In(key string, values []interface{}) *Query

字段值在给定数组中

func (*Query) Lt

func (q *Query) Lt(key string, value interface{}) *Query

小于

func (*Query) Lte

func (q *Query) Lte(key string, value interface{}) *Query

小于或等于

func (*Query) Magic

func (q *Query) Magic(key string, value interface{}) *Query

魔法方法

如 Magic("$and", []bson.M{bson.M{"app_id": bson.M{"$regex": "1"}},bson.M{"phone": bson.M{"$regex": "2"}}})

func (*Query) Mod

func (q *Query) Mod(key string, m, result int64) *Query

取模运算

func (*Query) Neq

func (q *Query) Neq(key string, value interface{}) *Query

不等于

func (*Query) Nin

func (q *Query) Nin(key string, values []interface{}) *Query

字段值不在给定数组中

func (*Query) Regex

func (q *Query) Regex(key string, value string) *Query

模糊匹配

func (*Query) ToString

func (q *Query) ToString() string

输出字符串

func (*Query) Type

func (q *Query) Type(key string, value bool) *Query

判断字段是否存在

Jump to

Keyboard shortcuts

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