Add put method for kvstore

This commit is contained in:
Sam
2020-01-22 07:58:32 -05:00
parent 63f9ef1ee2
commit 3b4b5b66fd
2 changed files with 22 additions and 0 deletions

View File

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

View File

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