mgos

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 28, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FromQueryTag tag标记
	FromQueryTag = "search"
)

Variables

This section is empty.

Functions

func MakeCondition

func MakeCondition(q interface{}) (bson.M, bson.D)

MakeCondition make condition

func ResolveSearchQuery

func ResolveSearchQuery(q interface{}, condition Condition)

ResolveSearchQuery 解析 *

  • exact / iexact 等于
  • contains / icontains 包含
  • gt / gte 大于 / 大于等于
  • lt / lte 小于 / 小于等于
  • startswith / istartswith 以…起始
  • endswith / iendswith 以…结束
  • in
  • isnull
  • order 排序 e.g. order[key]=desc order[key]=asc

Types

type Condition

type Condition interface {
	SetAnd(bson.M)
	SetOr(bson.M)
	SetOrder(string, int8)
}

Condition interface

type Public

type Public struct {
	And   []bson.M
	Or    []bson.M
	Order bson.D
}

Public mongodb public

func (*Public) SetAnd

func (e *Public) SetAnd(m bson.M)

SetAnd set and

func (*Public) SetOr

func (e *Public) SetOr(m bson.M)

SetOr set or

func (*Public) SetOrder

func (e *Public) SetOrder(key string, t int8)

SetOrder set order

Jump to

Keyboard shortcuts

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