Skip to content

Commit b893772

Browse files
authored
fix: set a prefix to the kv keys request via WithPrefix (#84)
fix: set a prefix to the kv keys function via WithPrefix
1 parent c165e3d commit b893772

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

api/keyvalue/store.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,16 @@ import (
2424
v1 "github.com/nitrictech/nitric/core/pkg/proto/kvstore/v1"
2525
)
2626

27-
type ScanKeysOption = func(*v1.KvStoreScanKeysRequest)
27+
type ScanKeysRequest = v1.KvStoreScanKeysRequest
28+
29+
type ScanKeysOption = func(*ScanKeysRequest)
30+
31+
// Apply a prefix to the scan keys request
32+
func WithPrefix(prefix string) ScanKeysOption {
33+
return func(req *ScanKeysRequest) {
34+
req.Prefix = prefix
35+
}
36+
}
2837

2938
// TODO: maybe move keystream to separate file
3039
type KeyStream struct {

0 commit comments

Comments
 (0)