MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / TestTable_Get

Function TestTable_Get

internal/utils/kvstore/table_test.go:60–92  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

58}
59
60func TestTable_Get(t *testing.T) {
61 store, err := kvstore.OpenStore("test")
62 if err != nil {
63 t.Fatal(err)
64 }
65 defer func() {
66 _ = store.Close()
67 }()
68
69 db, err := store.NewDB("TEST_DB")
70 if err != nil {
71 t.Fatal(err)
72 }
73
74 table, err := kvstore.NewTable[string]("users", kvstore.NewStringValueEncoder[string]())
75 if err != nil {
76 t.Fatal(err)
77 }
78
79 db.AddTable(table)
80
81 for _, key := range []string{"a", "b", "c"} {
82 value, getErr := table.Get(key)
83 if getErr != nil {
84 if kvstore.IsNotFound(getErr) {
85 t.Log("not found key", key)
86 continue
87 }
88 t.Fatal(getErr)
89 }
90 t.Log(key, "=>", "value:", value)
91 }
92}
93
94func TestTable_Exist(t *testing.T) {
95 store, err := kvstore.OpenStore("test")

Callers

nothing calls this directly

Calls 7

AddTableMethod · 0.95
OpenStoreFunction · 0.92
IsNotFoundFunction · 0.92
NewDBMethod · 0.80
LogMethod · 0.80
CloseMethod · 0.65
GetMethod · 0.45

Tested by

no test coverage detected