Implement namespace optional arg
This commit is contained in:
12
db.go
12
db.go
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user