當前位置: 首頁>>代碼示例>>Golang>>正文


Golang DB.CloseMGO方法代碼示例

本文整理匯總了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()
}
開發者ID:coralproject,項目名稱:xenia,代碼行數:35,代碼來源:main.go

示例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()
}
開發者ID:coralproject,項目名稱:xenia,代碼行數:9,代碼來源:aggregation_test.go

示例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()
}
開發者ID:coralproject,項目名稱:xenia,代碼行數:9,代碼來源:gallery_test.go

示例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()
}
開發者ID:coralproject,項目名稱:xenia,代碼行數:11,代碼來源:mask_test.go

示例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()
}
開發者ID:coralproject,項目名稱:xenia,代碼行數:11,代碼來源:xenia_test.go

示例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()
}
開發者ID:coralproject,項目名稱:xenia,代碼行數:19,代碼來源:ask_test.go

示例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()
}
開發者ID:coralproject,項目名稱:xenia,代碼行數:6,代碼來源:wire_test.go


注:本文中的github.com/coralproject/shelf/internal/platform/db.DB.CloseMGO方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。