Add Str convenience method for KV items

This commit is contained in:
Tobie Morgan Hitchcock 2016-07-18 22:59:08 +01:00
parent 3c8b68b503
commit fd09bebedc
4 changed files with 16 additions and 0 deletions

View file

@ -35,3 +35,8 @@ func (kv *KV) Key() []byte {
func (kv *KV) Val() []byte { func (kv *KV) Val() []byte {
return kv.val return kv.val
} }
// Str returns a string of the value
func (kv *KV) Str() string {
return string(kv.val)
}

View file

@ -19,4 +19,5 @@ type KV interface {
Exists() bool Exists() bool
Key() []byte Key() []byte
Val() []byte Val() []byte
Str() string
} }

View file

@ -35,3 +35,8 @@ func (kv *KV) Key() []byte {
func (kv *KV) Val() []byte { func (kv *KV) Val() []byte {
return kv.val return kv.val
} }
// Str returns a string of the value
func (kv *KV) Str() string {
return string(kv.val)
}

View file

@ -35,3 +35,8 @@ func (kv *KV) Key() []byte {
func (kv *KV) Val() []byte { func (kv *KV) Val() []byte {
return kv.val return kv.val
} }
// Str returns a string of the value
func (kv *KV) Str() string {
return string(kv.val)
}