Add delete method for kvstore

This commit is contained in:
Sam
2020-01-22 08:35:24 -05:00
parent 3b4b5b66fd
commit b83a1e0227
2 changed files with 21 additions and 0 deletions

View File

@ -103,3 +103,23 @@ func (kv KV) Put(namespace string, key string, value string) (KVAPI, error) {
} }
return r, nil return r, nil
} }
// Delete removes an entry
func (kv KV) Delete(namespace string, key string) (KVAPI, error) {
m := KVAPI{
Params: &kvParams{},
}
m.Params.Options = kvOptions{
Team: kv.Team,
Namespace: namespace,
EntryKey: key,
}
m.Method = "del"
r, err := kvAPIOut(kv.keybase, m)
if err != nil {
return r, err
}
return r, nil
}

View File

@ -894,6 +894,7 @@ type kvInterface interface {
Keys(namespace string) (KVAPI, error) Keys(namespace string) (KVAPI, error)
Get(namespace string, key string) (KVAPI, error) Get(namespace string, key string) (KVAPI, error)
Put(namespace string, key string, value string) (KVAPI, error) Put(namespace string, key string, value string) (KVAPI, error)
Delete(namespace string, key string) (KVAPI, error)
} }
type keybase interface { type keybase interface {