当前位置: 首页>>代码示例>>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;未经允许,请勿转载。