Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TestDb ¶
type TestDb struct { Session *mgo.Session *mgo.Database // contains filtered or unexported fields }
TestDb create a connection to mongodb, and delete the database in reset. Also provide mongodb operation methods, so we do not need to deal with returned error. *mgo.Databae is nested in, so all Database method con be used directly from TestDb, such as:
db := testdb.New("blah_test") db.C("tbl").Insert(...
Instead of:
db.Session.DB("").C("tbl").Insert(...
Click to show internal directories.
Click to hide internal directories.