clause

package
v1.0.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	MongoPrimaryName     = "_id"
	QueryOperationPrefix = "$"
)
View Source
const (
	QueryOperationOR  = "or"
	QueryOperationAND = "and"
	QueryOperationNOT = "not"
	QueryOperationNOR = "nor"
)

Variables

This section is empty.

Functions

func IsQueryFormat

func IsQueryFormat(s string) bool

func Multiple

func Multiple(query Filter) bool

Multiple 使用主键判断是批量操作还是单个文档操作

Types

type Filter

type Filter bson.M

func (Filter) AND

func (this Filter) AND(v interface{})

AND $and performs a logical AND operation on an array of one or more expressions (e.g. <expression1>, <expression2>, etc.) and selects the documents that satisfy all the expressions in the array. The $and operator uses short-circuit evaluation. If the first expression (e.g. <expression1>) evaluates to false, MongoDB will not evaluate the remaining expressions.

func (Filter) Any

func (this Filter) Any(t, k string, v interface{})

func (Filter) Eq

func (this Filter) Eq(k string, v interface{})

Eq 等于(=)

func (Filter) Gt

func (this Filter) Gt(k string, v interface{})

Gt 大于(>)

func (Filter) Gte

func (this Filter) Gte(k string, v interface{})

Gte 大于等于(>=)

func (Filter) In

func (this Filter) In(k string, v interface{})

In The $in operator selects the documents where the value of a field equals any value in the specified array

func (Filter) Lt

func (this Filter) Lt(k string, v interface{})

Lt 小于(<)

func (Filter) Lte

func (this Filter) Lte(k string, v interface{})

Lte 小于等于(<=)

func (Filter) Marshal

func (this Filter) Marshal() ([]byte, error)

func (Filter) Match

func (this Filter) Match(t string, v interface{})

Match 特殊匹配 or,not,and,nor

func (Filter) NOR

func (this Filter) NOR(v interface{})

NOR $nor performs a logical NOR operation on an array of one or more query expression and selects the documents that fail all the query expressions in the array.

func (Filter) NOT

func (this Filter) NOT(v interface{})

NOT $not performs a logical NOT operation on the specified <operator-expression> and selects the documents that do not match the <operator-expression>. This includes documents that do not contain the field.

func (Filter) Ne

func (this Filter) Ne(k string, v interface{})

Ne 不等于(!=)

func (Filter) Nin

func (this Filter) Nin(k string, v ...interface{})

Nin selects the documents where: the field value is not in the specified array or the field does not exist.

func (Filter) OR

func (this Filter) OR(v interface{})

OR The $or operator performs a logical OR operation on an array of two or more <expressions> and selects the documents that satisfy at least one of the <expressions>.

func (Filter) Primary

func (this Filter) Primary(v interface{})

func (Filter) String

func (this Filter) String() string

type Node

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

type Query

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

func New

func New() *Query

func (Query) AND

func (this Query) AND(v ...*Node)

AND $and performs a logical AND operation on an array of one or more expressions (e.g. <expression1>, <expression2>, etc.) and selects the documents that satisfy all the expressions in the array. The $and operator uses short-circuit evaluation. If the first expression (e.g. <expression1>) evaluates to false, MongoDB will not evaluate the remaining expressions.

func (*Query) Build

func (q *Query) Build(model *schema.Schema) Filter

Build 生成mongo查询条件

func (*Query) Eq

func (q *Query) Eq(k string, v interface{})

Eq 等于(=)

func (*Query) Gt

func (q *Query) Gt(k string, v interface{})

Gt 大于(>)

func (*Query) Gte

func (q *Query) Gte(k string, v interface{})

Gte 大于等于(>=)

func (*Query) In

func (q *Query) In(k string, v interface{})

In The $in operator selects the documents where the value of a field equals any value in the specified array

func (*Query) Len

func (q *Query) Len() (r int)

func (*Query) Lt

func (q *Query) Lt(k string, v interface{})

Lt 小于(<)

func (*Query) Lte

func (q *Query) Lte(k string, v interface{})

Lte 小于等于(<=)

func (*Query) Marshal

func (q *Query) Marshal() ([]byte, error)

func (Query) NOR

func (this Query) NOR(v ...*Node)

NOR $nor performs a logical NOR operation on an array of one or more query expression and selects the documents that fail all the query expressions in the array.

func (Query) NOT

func (this Query) NOT(v ...*Node)

NOT $not performs a logical NOT operation on the specified <operator-expression> and selects the documents that do not match the <operator-expression>. This includes documents that do not contain the field.

func (*Query) Ne

func (q *Query) Ne(k string, v interface{})

Ne 不等于(!=)

func (*Query) Nin

func (q *Query) Nin(k string, v interface{})

Nin selects the documents where: the field value is not in the specified array or the field does not exist.

func (Query) OR

func (this Query) OR(v ...*Node)

OR The $or operator performs a logical OR operation on an array of two or more <expressions> and selects the documents that satisfy at least one of the <expressions>.

func (*Query) Primary

func (q *Query) Primary(v interface{})

Primary 使用主键匹配 一个值或者数组

func (*Query) String

func (q *Query) String() string

func (*Query) Where

func (q *Query) Where(format interface{}, cons ...interface{})

Jump to

Keyboard shortcuts

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