From 631d5f5c0ec3b8c495e1013cb65cec18ec89d11a Mon Sep 17 00:00:00 2001 From: David Haukeness Date: Mon, 30 Mar 2020 22:32:32 +0000 Subject: [PATCH] documenation --- kvstore.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kvstore.go b/kvstore.go index 4eafe7c..d4d3569 100644 --- a/kvstore.go +++ b/kvstore.go @@ -7,7 +7,7 @@ import ( "samhofi.us/x/keybase/types/chat1" ) -// mashals an interface to JSON and sends to kvstore +// KvStorePutStruct marshals an interface to JSON and sends to kvstore func (b *bot) KVStorePutStruct(convIDstr chat1.ConvIDStr, v interface{}) error { // marshal the struct to JSON kvstoreDataString, err := encodeStructToJSONString(v) @@ -22,6 +22,7 @@ func (b *bot) KVStorePutStruct(convIDstr chat1.ConvIDStr, v interface{}) error { return nil } +// KVStoreGetStruct gets a string from kvstore and unmarshals the JSON to a struct func (b *bot) KVStoreGetStruct(convIDstr chat1.ConvIDStr, v interface{}) error { // get the string from kvstore result, err := b.KVStoreGet(string(convIDstr), getTypeName(v)) @@ -40,6 +41,7 @@ func (b *bot) KVStoreGetStruct(convIDstr chat1.ConvIDStr, v interface{}) error { return nil } +// KVStorePut puts a string into kvstore given a key and namespace func (b *bot) KVStorePut(namespace string, key string, value string) error { _, err := b.k.KVPut(&b.config.KVStoreTeam, namespace, key, value) if err != nil { @@ -48,6 +50,7 @@ func (b *bot) KVStorePut(namespace string, key string, value string) error { return nil } +// KVStoreGet gets a string from kvstore given a key and namespace func (b *bot) KVStoreGet(namespace string, key string) (string, error) { kvResult, err := b.k.KVGet(&b.config.KVStoreTeam, namespace, key) if err != nil {