Documentation ¶
Index ¶
- Variables
- func Dial(host string, mode int, syncTimeoutInS int64) (session *mgo.Session, err error)
- func InitCollections(ret interface{}, db *mgo.Database) (err error)
- func Open(ret interface{}, cfg *Config) (session *mgo.Session, err error)
- func SetMode(s *mgo.Session, mode int, refresh bool)
- type Collection
- type Config
Constants ¶
This section is empty.
Variables ¶
View Source
var MgoMode = struct { Eventual int Monotonic int Strong int }{ Eventual: 0, Monotonic: 1, Strong: 2, }
MgoMode ...
Functions ¶
func Dial ¶
Dial establishes a new session to the cluster identified by the given seed server(s). The session will enable communication with all of the servers in the cluster, so the seed servers are used only to find out about the cluster topology.
func InitCollections ¶
InitCollections initialize a set of collections
Types ¶
type Collection ¶
type Collection struct {
*mgo.Collection
}
Collection ...
func (Collection) CloseSession ¶
func (c Collection) CloseSession() (err error)
CloseSession close session
func (Collection) CopySession ¶
func (c Collection) CopySession() Collection
CopySession copy a session
func (Collection) EnsureIndexes ¶
func (c Collection) EnsureIndexes(indexes ...string)
EnsureIndexes ensure indexes for a collection
eg. c.EnsureIndexes(
"uid :unique", "email :unique", "serial_num", "uid,status,delete :sparse,background")
Click to show internal directories.
Click to hide internal directories.