enable delete files
This commit is contained in:
3
files.go
3
files.go
@@ -58,6 +58,9 @@ func (b *Files) Get(key string, ns ...string) ([]byte, error) {
|
||||
func (b *Files) Set(key string, value []byte, ns ...string) error {
|
||||
namespace := resolveNamespace(ns)
|
||||
dir := path.Join(b.root, namespace)
|
||||
if value == nil {
|
||||
return os.Remove(path.Join(dir, key))
|
||||
}
|
||||
if err := os.MkdirAll(dir, os.ModePerm); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user