enable delete files
parent
963e302cb4
commit
4115b7b603
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 {
|
func (b *Files) Set(key string, value []byte, ns ...string) error {
|
||||||
namespace := resolveNamespace(ns)
|
namespace := resolveNamespace(ns)
|
||||||
dir := path.Join(b.root, namespace)
|
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 {
|
if err := os.MkdirAll(dir, os.ModePerm); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue