mgo

package
v0.0.0-...-ee0865d Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Find = options.Find

Functions

func Transaction

func Transaction(ctx ezcache.IContextRequest)

Types

type CacheContext

type CacheContext struct {
	ezcache.Context
}

func NewCacheContext

func NewCacheContext() *CacheContext

func (*CacheContext) GetCacheRequest

func (ctx *CacheContext) GetCacheRequest() *ezcache.Cache

type Confirmed

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

type FindOneOptions

type FindOneOptions = options.FindOneOptions

type FindOptions

type FindOptions = options.FindOptions

type IObject

type IObject interface {
	maputil.IToMapAll
	maputil.IFromMap
}

type IndexKey

type IndexKey struct {
	// 要创建的索引字段
	Key string
	// 方向
	Direction IndexKeyDirection
}

type IndexKeyDirection

type IndexKeyDirection int32
const (
	// 按升序创建索引
	IndexKeyDirection_Ascending IndexKeyDirection = 1
	// 按降序来创建索引
	IndexKeyDirection_Descending = -1
)

type QueryIndex

type QueryIndex struct {
	Index  *TableIndex
	Params []interface{}
}

func NewQueryIndex

func NewQueryIndex() *QueryIndex

func (*QueryIndex) GetKey

func (t *QueryIndex) GetKey() string

func (*QueryIndex) ToMap

func (t *QueryIndex) ToMap() (r bson.M)

type RequestContext

type RequestContext struct {

	// 表信息
	Table *database.Table
	// contains filtered or unexported fields
}

func Request

func Request(ctx ezcache.IContextRequest, table *database.Table) *RequestContext

请求

func (*RequestContext) Cols

func (req *RequestContext) Cols(cols []string)

func (*RequestContext) ContainsCollection

func (req *RequestContext) ContainsCollection(name string) (has bool, err error)

func (*RequestContext) Create

func (req *RequestContext) Create(columns map[string]interface{}) (err error)

func (*RequestContext) CreateByObject

func (req *RequestContext) CreateByObject(data IObject) (err error)

func (*RequestContext) CreateIndexs

func (req *RequestContext) CreateIndexs(model mongo.IndexModel, opts ...*options.CreateIndexesOptions) (err error)

func (*RequestContext) Delete

func (req *RequestContext) Delete(columns map[string]interface{}) (err error)

func (*RequestContext) Find

func (req *RequestContext) Find(opts ...*FindOptions) (list *arrayutil.ArrayList, err error)

func (*RequestContext) FindInIds

func (req *RequestContext) FindInIds(keys []database.Ident, subkeys []database.Ident, opts ...*options.FindOptions) (list *arrayutil.ArrayList, err error)

func (*RequestContext) First

func (req *RequestContext) First(opts ...*FindOneOptions) (data interface{}, err error)

func (*RequestContext) Index

func (req *RequestContext) Index(index int, params ...interface{}) *RequestContext

func (*RequestContext) Init

func (req *RequestContext) Init() (err error)

func (*RequestContext) Query

func (req *RequestContext) Query(val bson.M) *RequestContext

func (*RequestContext) SubKey

func (req *RequestContext) SubKey(key database.Ident) *RequestContext

func (*RequestContext) UpdateByObject

func (req *RequestContext) UpdateByObject(data maputil.IToMapAll) (err error)

func (*RequestContext) UpdateColumns

func (req *RequestContext) UpdateColumns(columns bson.M, opts ...*UpdateOptions) (err error)

func (*RequestContext) WithSubKeyTime

func (req *RequestContext) WithSubKeyTime(time time.Time) *RequestContext

todo: 按照指定的月份

type TableIndex

type TableIndex struct {
	//
	Fields []*TableIndexItem
	//
	Options *options.IndexOptions
}

func (*TableIndex) GetParams

func (ti *TableIndex) GetParams(data interface{}) (x []interface{})

type TableIndexItem

type TableIndexItem struct {
	//
	Name string
	//1 为升序;-1为降序
	Sequence int
}

type UpdateOptions

type UpdateOptions = options.UpdateOptions

Jump to

Keyboard shortcuts

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