Documentation ¶
Overview ¶
Package testdb helps unit test with mongo db, by recreate mongo db.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type TestDB ¶
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.