mongo

package
v2.2.7+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2016 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func C

func C(cName string) *mgo.Collection

C use the default db get collection

func CHandle

func CHandle(cName string, handle func(c *mgo.Collection))

CHandle use the default DB processing with a set of callback functions, the session will be closed down after processing is completed

func CHandleWithDB

func CHandleWithDB(dbName, cName string, handle func(c *mgo.Collection))

CHandleWithDB use the new DB processing with a set of callback functions, the session will be closed down after processing is completed

func CWithDB

func CWithDB(dbName, cName string) *mgo.Collection

CWithDB use the new db get collection

func CloneSession

func CloneSession() *mgo.Session

CloneSession clone session

func DB

func DB() *mgo.Database

DB get database

func DBWithName

func DBWithName(dbName string) *mgo.Database

DBWithName get database with name

func IncrID

func IncrID(cName string, storeCName ...string) (id int64, err error)

IncrID get increase id

func LoadHandler

func LoadHandler(url, dbName string)

LoadHandler load global handler

func Session

func Session() *mgo.Session

Session get current session

Types

type Handler

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

Handler Provide the mongo's operation

var (
	GH *Handler
)

define global handler

func InitHandler

func InitHandler(url string) (*Handler, error)

InitHandler initialize the Handler

func InitHandlerWithDB

func InitHandlerWithDB(url, dbName string) (*Handler, error)

InitHandlerWithDB initialize the Handler with db name

func (*Handler) C

func (h *Handler) C(cName string) *mgo.Collection

C use the default db get collection

func (*Handler) CHandle

func (h *Handler) CHandle(cName string, handle func(c *mgo.Collection))

CHandle use the default DB processing with a set of callback functions, the session will be closed down after processing is completed

func (*Handler) CHandleWithDB

func (h *Handler) CHandleWithDB(dbName, cName string, handle func(c *mgo.Collection))

CHandleWithDB use the new DB processing with a set of callback functions, the session will be closed down after processing is completed

func (*Handler) CWithDB

func (h *Handler) CWithDB(dbName, cName string) *mgo.Collection

CWithDB use the new db get collection

func (*Handler) CloneSession

func (h *Handler) CloneSession() *mgo.Session

CloneSession clone session

func (*Handler) Close

func (h *Handler) Close()

Close terminates the session

func (*Handler) DB

func (h *Handler) DB() *mgo.Database

DB get database

func (*Handler) DBWithName

func (h *Handler) DBWithName(dbName string) *mgo.Database

DBWithName get database with name

func (*Handler) IncrID

func (h *Handler) IncrID(cName string, storeCName ...string) (id int64, err error)

IncrID get increase id

func (*Handler) Session

func (h *Handler) Session() *mgo.Session

Session get current session

Jump to

Keyboard shortcuts

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