Documentation ¶
Index ¶
- func C(cName string) *mgo.Collection
- func CHandle(cName string, handle func(c *mgo.Collection))
- func CHandleWithDB(dbName, cName string, handle func(c *mgo.Collection))
- func CWithDB(dbName, cName string) *mgo.Collection
- func CloneSession() *mgo.Session
- func DB() *mgo.Database
- func DBWithName(dbName string) *mgo.Database
- func IncrID(cName string, storeCName ...string) (id int64, err error)
- func LoadHandler(url, dbName string)
- func Session() *mgo.Session
- type Handler
- func (h *Handler) C(cName string) *mgo.Collection
- func (h *Handler) CHandle(cName string, handle func(c *mgo.Collection))
- func (h *Handler) CHandleWithDB(dbName, cName string, handle func(c *mgo.Collection))
- func (h *Handler) CWithDB(dbName, cName string) *mgo.Collection
- func (h *Handler) CloneSession() *mgo.Session
- func (h *Handler) Close()
- func (h *Handler) DB() *mgo.Database
- func (h *Handler) DBWithName(dbName string) *mgo.Database
- func (h *Handler) IncrID(cName string, storeCName ...string) (id int64, err error)
- func (h *Handler) Session() *mgo.Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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
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 ¶
InitHandler initialize the Handler
func InitHandlerWithDB ¶
InitHandlerWithDB initialize the Handler with db name
func (*Handler) CHandle ¶
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 ¶
CHandleWithDB use the new DB processing with a set of callback functions, the session will be closed down after processing is completed
func (*Handler) CloneSession ¶
func (h *Handler) CloneSession() *mgo.Session
CloneSession clone session
func (*Handler) DBWithName ¶
DBWithName get database with name