neato
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"local/rproxy3/storage/packable"
|
||||
)
|
||||
@@ -46,7 +45,7 @@ func (m Map) Get(ns, key string, value packable.Packable) error {
|
||||
m[ns] = make(map[string][]byte)
|
||||
}
|
||||
if _, ok := m[ns][key]; !ok {
|
||||
return errors.New("not found")
|
||||
return ErrNotFound
|
||||
}
|
||||
return value.Decode(m[ns][key])
|
||||
}
|
||||
@@ -55,6 +54,12 @@ func (m Map) Set(ns, key string, value packable.Packable) error {
|
||||
if _, ok := m[ns]; !ok {
|
||||
m[ns] = make(map[string][]byte)
|
||||
}
|
||||
if value == nil {
|
||||
if _, ok := m[ns][key]; ok {
|
||||
delete(m[ns], key)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
b, err := value.Encode()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user