• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang leveldb.CloseAndDeleteDB函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/abhishekkr/levigoNS/leveldb.CloseAndDeleteDB函数的典型用法代码示例。如果您正苦于以下问题:Golang CloseAndDeleteDB函数的具体用法?Golang CloseAndDeleteDB怎么用?Golang CloseAndDeleteDB使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了CloseAndDeleteDB函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: TestReadNSRecursive

func TestReadNSRecursive(t *testing.T) {
	_parentKey, _key, _childKey := "abc", "abc:name", "abc:name:last"
	expectedParentKeyVal := "abc:name,ABC XYZ\nabc:name:first,ABC\nabc:name:last,XYZ"
	expectedKeyVal := "abc:name,ABC XYZ\nabc:name:first,ABC\nabc:name:last,XYZ"
	expectedChildKeyVal := "abc:name:last,XYZ"

	db := abkleveldb.CreateDB(dbpath)
	setupTestData(db)

	resultParentKeyVal := golhashmap.HashMapToCSV(ReadNSRecursive(_parentKey, db))
	resultKeyVal := golhashmap.HashMapToCSV(ReadNSRecursive(_key, db))
	resultChildKeyVal := golhashmap.HashMapToCSV(ReadNSRecursive(_childKey, db))

	golassert.AssertEqualStringArray(
		strings.Split(expectedParentKeyVal, "\n"),
		strings.Split(resultParentKeyVal, "\n"),
	)
	golassert.AssertEqualStringArray(
		strings.Split(expectedKeyVal, "\n"),
		strings.Split(resultKeyVal, "\n"),
	)
	golassert.AssertEqualStringArray(
		strings.Split(expectedChildKeyVal, "\n"),
		strings.Split(resultChildKeyVal, "\n"),
	)

	abkleveldb.CloseAndDeleteDB(dbpath, db)
}
开发者ID:carriercomm,项目名称:levigoNS,代码行数:28,代码来源:levigoNS_test.go


示例2: TestAppendKey

func TestAppendKey(t *testing.T) {
	db := abkleveldb.CreateDB(dbpath)

	status := appendKey("abc:name:first", "title", db)
	expectedVal := "key::abc:name:first:title"
	resultVal := abkleveldb.GetVal("key::abc:name:first", db)
	if resultVal != expectedVal {
		t.Error("Fail: Get", resultVal, "instead of", expectedVal)
	}
	if !status {
		t.Error("Fail: Failed Status for", expectedVal)
	}

	status = appendKey("abc", "name", db)
	expectedVal = "key::abc:name"
	resultVal = abkleveldb.GetVal("key::abc", db)
	if resultVal != expectedVal {
		t.Error("Fail: Get", resultVal, "instead of", expectedVal)
	}
	if !status {
		t.Error("Fail: Failed Status for", expectedVal)
	}

	status = appendKey("abc", "age", db)
	expectedVal = "key::abc:name,key::abc:age"
	resultVal = abkleveldb.GetVal("key::abc", db)
	if resultVal != expectedVal {
		t.Error("Fail: Get", resultVal, "instead of", expectedVal)
	}
	if !status {
		t.Error("Fail: Failed Status for", expectedVal)
	}

	abkleveldb.CloseAndDeleteDB(dbpath, db)
}
开发者ID:carriercomm,项目名称:levigoNS,代码行数:35,代码来源:levigoNS_test.go


示例3: TestCreateNS

func TestCreateNS(t *testing.T) {
	db := abkleveldb.CreateDB(dbpath)

	status := CreateNS("abc:name:first", db)
	expectedVal := "key::abc:name:first"
	resultVal := abkleveldb.GetVal("key::abc:name", db)
	if expectedVal != resultVal {
		t.Error("Fail: Get", resultVal, "instead of", expectedVal)
	}
	if !status {
		t.Error("Fail: Failed Status for", expectedVal)
	}

	status = CreateNS("abc:name:last", db)
	expectedVal = "key::abc:name:first,key::abc:name:last"
	resultVal = abkleveldb.GetVal("key::abc:name", db)
	if expectedVal != resultVal {
		t.Error("Fail: Get", resultVal, "instead of", expectedVal)
	}
	if !status {
		t.Error("Fail: Failed Status for", expectedVal)
	}

	status = CreateNS("abc:name:last", db)
	expectedVal = "key::abc:name:first,key::abc:name:last"
	resultVal = abkleveldb.GetVal("key::abc:name", db)
	if expectedVal != resultVal {
		t.Error("Fail: Get", resultVal, "instead of", expectedVal)
	}
	if !status {
		t.Error("Fail: Failed Status for", expectedVal)
	}

	abkleveldb.CloseAndDeleteDB(dbpath, db)
}
开发者ID:carriercomm,项目名称:levigoNS,代码行数:35,代码来源:levigoNS_test.go


示例4: TestDeleteNSRecursive

func TestDeleteNSRecursive(t *testing.T) {
	db := abkleveldb.CreateDB(dbpath)
	setupTestData(db)

	status := DeleteNSRecursive("abc", db)

	expectedVal := ""
	resultVal := abkleveldb.GetVal("key::abc", db)
	if resultVal != expectedVal {
		t.Error("Fail: Get", resultVal, "instead of", expectedVal)
	}
	if !status {
		t.Error("Fail: Failed Status for", expectedVal)
	}

	expectedVal = ""
	resultVal = abkleveldb.GetVal("key::abc:name", db)
	if resultVal != expectedVal {
		t.Error("Fail: Get", resultVal, "instead of", expectedVal)
	}

	expectedVal = ""
	resultVal = abkleveldb.GetVal("val::abc:name:first", db)
	if resultVal != expectedVal {
		t.Error("Fail: Get", resultVal, "instead of", expectedVal)
	}

	expectedVal = ""
	resultVal = abkleveldb.GetVal("val::abc:name:last", db)
	if resultVal != expectedVal {
		t.Error("Fail: Get", resultVal, "instead of", expectedVal)
	}

	abkleveldb.CloseAndDeleteDB(dbpath, db)
}
开发者ID:carriercomm,项目名称:levigoNS,代码行数:35,代码来源:levigoNS_test.go


示例5: TestDeleteNSKey

func TestDeleteNSKey(t *testing.T) {
	db := abkleveldb.CreateDB(dbpath)
	setupTestData(db)

	status := DeleteNSKey("abc:name:last", db)

	expectedVal := ""
	resultVal := abkleveldb.GetVal("val::abc:name:last", db)
	if resultVal != expectedVal {
		t.Error("Fail: Get", resultVal, "instead of", expectedVal)
	}
	if !status {
		t.Error("Fail: Failed Status for", expectedVal)
	}

	expectedVal = "ABC"
	resultVal = abkleveldb.GetVal("val::abc:name:first", db)
	if resultVal != expectedVal {
		t.Error("Fail: Get", resultVal, "instead of", expectedVal)
	}

	status = DeleteNSKey("abc:name:last", db)
	if !status {
		t.Error("Fail: Success in deleting non-existent key.")
	}

	abkleveldb.CloseAndDeleteDB(dbpath, db)
}
开发者ID:carriercomm,项目名称:levigoNS,代码行数:28,代码来源:levigoNS_test.go


示例6: TestReadKey

func TestReadKey(t *testing.T) {
	setupTestData()

	expected_val := "upstate:2014:January:2:12:1:20,down"
	result_val := golhashmap.HashMapToCSV(ReadKey("upstate:2014:January:2:12:1:20"))
	golassert.AssertEqual(expected_val, result_val)

	abkleveldb.CloseAndDeleteDB(test_dbpath, db)
}
开发者ID:WIZARD-CXY,项目名称:golang-devops-stuff,代码行数:9,代码来源:dbtasks_test.go


示例7: TestGetVal

func TestGetVal(t *testing.T) {
	setupTestData()

	expected_val := "down"
	result_val := GetVal("upstate:2014:January:2:12:1:20")
	if expected_val != result_val {
		t.Error("Fail: Get", result_val, "instead of", expected_val)
	}

	abkleveldb.CloseAndDeleteDB(test_dbpath, db)
}
开发者ID:ChaacMonitoring,项目名称:goshare,代码行数:11,代码来源:dbtasks_test.go


示例8: TestDelKeyNS

func TestDelKeyNS(t *testing.T) {
	setupTestData()

	status := DelKeyNS("upstate:2014")
	expected_val := ""
	result_val := abkleveldb.GetVal("val::upstate:2014:January:2:12:1:20", db)
	if expected_val != result_val {
		t.Error("Fail: Get", result_val, "instead of", expected_val)
	}
	if !status {
		t.Error("Fail: Wrong status returned by DelKeyNS")
	}

	abkleveldb.CloseAndDeleteDB(test_dbpath, db)
}
开发者ID:WIZARD-CXY,项目名称:golang-devops-stuff,代码行数:15,代码来源:dbtasks_test.go


示例9: TestPushKeyValNS

func TestPushKeyValNS(t *testing.T) {
	setupTestData()

	expected_val := "right"
	status := PushKeyValNS("oh:yeah", expected_val)
	result_val := abkleveldb.GetVal("val::oh:yeah", db)
	if expected_val != result_val {
		t.Error("Fail: Get", result_val, "instead of", expected_val)
	}
	if !status {
		t.Error("Fail: Wrong status returned by PushKeyValNS")
	}

	abkleveldb.CloseAndDeleteDB(test_dbpath, db)
}
开发者ID:WIZARD-CXY,项目名称:golang-devops-stuff,代码行数:15,代码来源:dbtasks_test.go


示例10: TestPushKeyValTSDS

func TestPushKeyValTSDS(t *testing.T) {
	setupTestData()

	ohtime := goltime.Timestamp{
		Year: 2014, Month: 1, Day: 2, Hour: 12, Min: 1, Sec: 20,
	}
	status := PushKeyValTSDS("oh", "yeah", ohtime)
	expected_val := "yeah"
	result_val := abkleveldb.GetVal("val::oh:2014:January:2:12:1:20", db)
	if expected_val != result_val {
		t.Error("Fail: Get", result_val, "instead of", expected_val)
	}
	if !status {
		t.Error("Fail: Wrong status returned by PushKeyValTSDS")
	}

	abkleveldb.CloseAndDeleteDB(test_dbpath, db)
}
开发者ID:ChaacMonitoring,项目名称:goshare,代码行数:18,代码来源:dbtasks_test.go


示例11: TestDeleteNSChildren

func TestDeleteNSChildren(t *testing.T) {
	db := abkleveldb.CreateDB(dbpath)
	setupTestData(db)

	expectedVal := "ABC XYZ"
	resultVal := abkleveldb.GetVal("val::abc:name", db)
	if resultVal != expectedVal {
		t.Error("Fail: Pre-req is bad.")
	}

	status := deleteNSChildren("key::abc:name", db)
	expectedVal = ""
	resultVal = abkleveldb.GetVal("val::abc:name", db)
	if resultVal != expectedVal {
		t.Error("Fail: Get", resultVal, "instead of", expectedVal)
	}
	if !status {
		t.Error("Fail: Failed Status for", expectedVal)
	}

	expectedVal = ""
	resultVal = abkleveldb.GetVal("key::abc:name", db)
	if resultVal != expectedVal {
		t.Error("Fail: Get", resultVal, "instead of", expectedVal)
	}

	expectedVal = "XYZ"
	resultVal = abkleveldb.GetVal("val::abc:name:last", db)
	if resultVal != expectedVal {
		t.Error("Fail: Get", resultVal, "instead of", expectedVal)
	}

	status = deleteNSChildren("key::abc:name:first,key::abc:name:last", db)
	expectedVal = ""
	resultVal = abkleveldb.GetVal("val::abc:name:first", db)
	if resultVal != expectedVal {
		t.Error("Fail: Get", resultVal, "instead of", expectedVal)
	}
	if !status {
		t.Error("Fail: Failed Status for", expectedVal)
	}

	abkleveldb.CloseAndDeleteDB(dbpath, db)
}
开发者ID:carriercomm,项目名称:levigoNS,代码行数:44,代码来源:levigoNS_test.go


示例12: TestPushNS

func TestPushNS(t *testing.T) {
	db := abkleveldb.CreateDB(dbpath)

	status := PushNS("abc:name", "ABC XYZ", db)
	expectedVal := "ABC XYZ"
	resultVal := abkleveldb.GetVal("val::abc:name", db)
	if resultVal != expectedVal {
		t.Error("Fail: Get", resultVal, "instead of", expectedVal)
	}
	if !status {
		t.Error("Fail: Failed Status for", expectedVal)
	}

	expectedVal = "key::abc:name"
	resultVal = abkleveldb.GetVal("key::abc", db)
	if resultVal != expectedVal {
		t.Error("Fail: Get", resultVal, "instead of", expectedVal)
	}

	abkleveldb.CloseAndDeleteDB(dbpath, db)
}
开发者ID:carriercomm,项目名称:levigoNS,代码行数:21,代码来源:levigoNS_test.go


示例13: TestPushKeyValTSDS

func TestPushKeyValTSDS(t *testing.T) {
	setupTestData()
	packet := Packet{}
	packet.HashMap = make(golhashmap.HashMap)
	packet.HashMap["oh"] = "yeah"
	packet.ParentNS = "phrase"
	packet.TimeDot = goltime.Timestamp{
		Year: 2014, Month: 1, Day: 2, Hour: 12, Min: 1, Sec: 20,
	}
	packet.KeyType = "tsds"

	status := PushFromPacket(packet)
	expected_val := "yeah"
	result_val := abkleveldb.GetVal("val::oh:2014:January:2:12:1:20", db)
	golassert.AssertEqual(expected_val, result_val)
	if !status {
		t.Error("Fail: Wrong status returned by PushKeyValTSDS")
	}

	abkleveldb.CloseAndDeleteDB(test_dbpath, db)
}
开发者ID:WIZARD-CXY,项目名称:golang-devops-stuff,代码行数:21,代码来源:dbtasks_test.go



注:本文中的github.com/abhishekkr/levigoNS/leveldb.CloseAndDeleteDB函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang codelocation.New函数代码示例发布时间:2022-05-24
下一篇:
Golang geoip.GeoIP类代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap