本文整理匯總了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()
}