enable delete files

master
bel 2020-04-08 04:02:51 +00:00
parent 963e302cb4
commit 4115b7b603
1 changed files with 3 additions and 0 deletions

View File

@ -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
}