From e26953ae407b954b7b751e79f6f2d282a95cbbf9 Mon Sep 17 00:00:00 2001 From: David Moore Date: Thu, 27 Jun 2024 13:18:27 +1000 Subject: [PATCH] fix: set a prefix to the kv keys function via WithPrefix --- api/keyvalue/store.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/api/keyvalue/store.go b/api/keyvalue/store.go index 45fd7cf..e745297 100644 --- a/api/keyvalue/store.go +++ b/api/keyvalue/store.go @@ -24,7 +24,16 @@ import ( v1 "github.com/nitrictech/nitric/core/pkg/proto/kvstore/v1" ) -type ScanKeysOption = func(*v1.KvStoreScanKeysRequest) +type ScanKeysRequest = v1.KvStoreScanKeysRequest + +type ScanKeysOption = func(*ScanKeysRequest) + +// Apply a prefix to the scan keys request +func WithPrefix(prefix string) ScanKeysOption { + return func(req *ScanKeysRequest) { + req.Prefix = prefix + } +} // TODO: maybe move keystream to separate file type KeyStream struct {