本文整理汇总了Golang中github.com/coralproject/shelf/internal/platform/db.DB.CloseMGO方法的典型用法代码示例。如果您正苦于以下问题:Golang DB.CloseMGO方法的具体用法?Golang DB.CloseMGO怎么用?Golang DB.CloseMGO使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/coralproject/shelf/internal/platform/db.DB
的用法示例。
在下文中一共展示了DB.CloseMGO方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
app.Init(cfg.EnvProvider{Namespace: Namespace})
// Pull options from the config.
var conn *db.DB
if _, errHost := cfg.String(cfgWebHost); errHost != nil {
xenia.Println("Configuring MongoDB")
mongoURI := cfg.MustURL(cfgMongoURI)
err := db.RegMasterSession("startup", mongoURI.Path, mongoURI.String(), 0)
if err != nil {
xenia.Println("Unable to initialize MongoDB")
os.Exit(1)
}
conn, err = db.NewMGO("startup", mongoURI.Path)
if err != nil {
xenia.Println("Unable to get MongoDB session")
os.Exit(1)
}
defer conn.CloseMGO("startup")
}
xenia.AddCommand(
cmddb.GetCommands(conn),
cmdquery.GetCommands(),
cmdscript.GetCommands(),
cmdregex.GetCommands(),
cmdmask.GetCommands(),
cmdrelationship.GetCommands(),
cmdview.GetCommands(),
)
xenia.Execute()
}
示例2: teardownAgg
func teardownAgg(t *testing.T, db *db.DB) {
if err := aggfix.Remove(tests.Context, db, aggPrefix); err != nil {
t.Fatalf("%s\tShould be able to remove the forms and submissions : %v", tests.Failed, err)
}
t.Logf("%s\tShould be able to remove the forms and submissions.", tests.Success)
db.CloseMGO(tests.Context)
tests.DisplayLog()
}
示例3: teardown
func teardown(t *testing.T, db *db.DB) {
if err := galleryfix.Remove(tests.Context, db, prefix); err != nil {
t.Fatalf("%s\tShould be able to remove the galleries : %v", tests.Failed, err)
}
t.Logf("%s\tShould be able to remove the galleries.", tests.Success)
db.CloseMGO(tests.Context)
tests.DisplayLog()
}
示例4: teardown
// teardown deinitializes for each indivdual test.
func teardown(t *testing.T, db *db.DB) {
if err := mfix.Remove(db, collection); err != nil {
t.Fatalf("%s\tShould be able to remove the query mask : %v", tests.Failed, err)
}
t.Logf("%s\tShould be able to remove the query mask.", tests.Success)
db.CloseMGO(tests.Context)
tests.DisplayLog()
}
示例5: teardown
// teardown deinitializes for each indivdual test.
func teardown(t *testing.T, db *db.DB) {
relationshipfix.Remove(tests.Context, db, "RTEST_")
viewfix.Remove(tests.Context, db, "VTEST_")
rfix.Remove(db, "RTEST_")
unloadItems(tests.Context, db)
unloadTestData(t, db)
db.CloseMGO(tests.Context)
db.CloseCayley(tests.Context)
tests.DisplayLog()
}
示例6: teardown
func teardown(t *testing.T, db *db.DB) {
if err := formfix.Remove(tests.Context, db, prefix); err != nil {
t.Fatalf("%s\tShould be able to remove the form fixtures from the database : %v", tests.Failed, err)
}
t.Logf("%s\tShould be able to remove the form fixtures from the database.", tests.Success)
if err := galleryfix.Remove(tests.Context, db, prefix); err != nil {
t.Fatalf("%s\tShould be able to remove the gallery fixtures from the database : %v", tests.Failed, err)
}
t.Logf("%s\tShould be able to remove the gallery fixtures from the database.", tests.Success)
if err := submissionfix.Remove(tests.Context, db, prefix); err != nil {
t.Fatalf("%s\tShould be able to remove the submission fixtures from the database : %v", tests.Failed, err)
}
t.Logf("%s\tShould be able to remove the submission fixtures from the database.", tests.Success)
db.CloseMGO(tests.Context)
tests.DisplayLog()
}
示例7: teardown
// teardown deinitializes for each indivdual test.
func teardown(t *testing.T, db *db.DB, store *cayley.Handle) {
db.CloseMGO(tests.Context)
store.Close()
tests.DisplayLog()
}