Implement namespace optional arg

This commit is contained in:
Bel LaPointe
2019-03-20 09:54:26 -06:00
parent b79cb97ba6
commit b7a231feaf
10 changed files with 101 additions and 45 deletions

12
db.go
View File

@@ -5,8 +5,8 @@ import (
)
type DB interface {
Get(string) ([]byte, error)
Set(string, []byte) error
Get(string, ...string) ([]byte, error)
Set(string, []byte, ...string) error
Close() error
}
@@ -38,3 +38,11 @@ func New(key Type, params ...string) (db DB, err error) {
}
return
}
func resolveNamespace(ns []string) string {
namespace := DefaultNamespace
if len(ns) > 0 {
namespace = ns[0]
}
return namespace
}