db

package
v0.0.0-...-b75766b Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2015 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlterDoc

func AlterDoc(doc *utils.M, operator string, operation utils.M)

func Convert

func Convert(doc utils.M, out interface{})

func InArray

func InArray(key string, arrays ...[]string) bool

Types

type BaseInterface

type BaseInterface interface {
	PrepareSave()
}

type BaseModel

type BaseModel struct {
	Id         bson.ObjectId `json:"_id,omitempty" bson:"_id" required:"true"`
	CreatedOn  int64         `json:"created_on" bson:"created_on" required:"true"`
	ModifiedOn int64         `json:"updated_on" bson:"updated_on" required:"true"`
}

func (*BaseModel) PrepareSave

func (self *BaseModel) PrepareSave()

type MConn

type MConn struct {
	Session *mgo.Session
	Dbname  string
}
var Conn *MConn

func GetConn

func GetConn(db_name string, address string, creds ...string) *MConn

func (*MConn) Aggregate

func (self *MConn) Aggregate(session *mgo.Session, table string, doc []utils.M) *mgo.Pipe

func (*MConn) Count

func (self *MConn) Count(table string, query utils.M) int

func (*MConn) Delete

func (self *MConn) Delete(table string, query utils.M) error

func (*MConn) DropIndex

func (self *MConn) DropIndex(table string, key ...string) error

func (*MConn) DropIndices

func (self *MConn) DropIndices(table string) error

func (*MConn) EnsureIndex

func (self *MConn) EnsureIndex(table string, index mgo.Index) error

func (*MConn) FindAndUpdate

func (self *MConn) FindAndUpdate(table string, query utils.M, doc utils.M, result interface{}) error

func (*MConn) FindAndUpsert

func (self *MConn) FindAndUpsert(table string, query utils.M, doc utils.M, result interface{}) error

func (*MConn) Get

func (self *MConn) Get(session *mgo.Session, table string, query utils.M) *mgo.Iter

func (*MConn) GetCursor

func (self *MConn) GetCursor(session *mgo.Session, table string, query utils.M) *mgo.Query

func (*MConn) GetOne

func (self *MConn) GetOne(table string, query utils.M, result interface{}) error

func (*MConn) HintedCount

func (self *MConn) HintedCount(table string, query utils.M, hint string) int

func (*MConn) HintedGetOne

func (self *MConn) HintedGetOne(table string, query utils.M, result interface{}, hint string) error

func (*MConn) Insert

func (self *MConn) Insert(table string, arguments ...interface{}) (_id string)

func (*MConn) MapReduce

func (self *MConn) MapReduce(session *mgo.Session, table string, query utils.M, result interface{}, job *MapReduce) (*mgo.MapReduceInfo, error)

func (*MConn) Update

func (self *MConn) Update(table string, query utils.M, doc utils.M) error

func (*MConn) Upsert

func (self *MConn) Upsert(table string, query utils.M, doc utils.M) error

type MapReduce

type MapReduce mgo.MapReduce

Jump to

Keyboard shortcuts

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