本文整理汇总了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;未经允许,请勿转载。 |
请发表评论