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

Function NewDB

internal/utils/kvstore/db.go:21–32  ·  view source on GitHub ↗
(store *Store, dbName string)

Source from the content-addressed store, hash-verified

19}
20
21func NewDB(store *Store, dbName string) (*DB, error) {
22 if !IsValidName(dbName) {
23 return nil, errors.New("invalid database name '" + dbName + "'")
24 }
25
26 return &DB{
27 store: store,
28 name: dbName,
29 namespace: "$" + dbName + "$",
30 tableMap: map[string]TableInterface{},
31 }, nil
32}
33
34func (this *DB) AddTable(table TableInterface) {
35 table.SetNamespace([]byte(this.Namespace() + table.Name() + "$"))

Callers 1

NewDBMethod · 0.70

Calls 1

IsValidNameFunction · 0.85

Tested by

no test coverage detected