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 ¶ added in v2.2.4
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 ¶ added in v2.2.4
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 ¶ added in v2.2.4
func CWithDB(dbName, cName string) *mgo.Collection
CWithDB use the new db get collection
func DBWithName ¶ added in v2.2.4
func DBWithName(dbName string) *mgo.Database
DBWithName get database with name
func LoadHandler ¶ added in v2.2.3
func LoadHandler(url, dbName string)
LoadHandler load global handler
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 ¶ added in v2.0.4
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 ¶ added in v2.0.4
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 ¶ added in v2.0.4
DBWithName get database with name