db

package
v0.0.0-...-b4e6114 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2015 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlterDoc

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

func Convert

func Convert(doc M, out interface{})

func InArray

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

Types

type BaseInterface

type BaseInterface interface {
	PrepareSave(conn *MConn)
}

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(conn *MConn)

type M

type M bson.M

type MConn

type MConn struct {
	// contains filtered or unexported fields
}
var DbConnection *MConn

func GetConn

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

func (*MConn) Aggregate

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

func (*MConn) Count

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

func (*MConn) Delete

func (self *MConn) Delete(table string, query 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 M, doc M, result interface{}) error

func (*MConn) FindAndUpsert

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

func (*MConn) Get

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

func (*MConn) GetCursor

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

func (*MConn) GetOne

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

func (*MConn) HintedCount

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

func (*MConn) HintedGetOne

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

func (*MConn) Insert

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

func (*MConn) InsertMulti

func (self *MConn) InsertMulti(table string, docs ...M) error

func (*MConn) InternalConn

func (self *MConn) InternalConn() *mgo.Database

func (*MConn) MapReduce

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

func (*MConn) ScopeCheck

func (self *MConn) ScopeCheck()

func (*MConn) Update

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

func (*MConn) Upsert

func (self *MConn) Upsert(table string, query M, doc 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