Skip to content

Commit

Permalink
Merge pull request #2078 from fermyon/backport-2075-to-v2.0
Browse files Browse the repository at this point in the history
[Backport v2.0] sdk/go/kv: add missing GetKeys() function
  • Loading branch information
adamreese authored Nov 9, 2023
2 parents b6c39f4 + 04f0742 commit 512552a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions sdk/go/kv/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,17 @@ func (s *Store) Exists(key string) (bool, error) {
return *(*bool)(unsafe.Pointer(&ret.val)), nil
}

// GetKeys retrieves the list of keys from Store.
func (s *Store) GetKeys() ([]string, error) {
var ret C.key_value_expected_list_string_error_t
C.key_value_get_keys(C.uint32_t(s.ptr), &ret)
if ret.is_err {
return nil, toErr((*C.key_value_error_t)(unsafe.Pointer(&ret.val)))
}
list := (*C.key_value_list_string_t)(unsafe.Pointer(&ret.val))
return fromCStrList(list), nil
}

func (s *Store) open() error {
if s.active {
return nil
Expand Down

0 comments on commit 512552a

Please sign in to comment.