@rivascva/dt-idl 1.1.162 → 1.1.163
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/go/redis/baserdb.go +3 -1
- package/go/redis/utils.go +14 -1
- package/package.json +1 -1
package/go/redis/baserdb.go
CHANGED
|
@@ -203,7 +203,9 @@ func (r *BaseRDB) GetKeysWithPattern(ctx context.Context, pattern string, window
|
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
// add the keys to the result
|
|
206
|
-
|
|
206
|
+
for _, k := range keys {
|
|
207
|
+
result = append(result, UnformatKey(r.database, k))
|
|
208
|
+
}
|
|
207
209
|
|
|
208
210
|
// update the cursor
|
|
209
211
|
cursor = nextCursor
|
package/go/redis/utils.go
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
package redis
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import (
|
|
4
|
+
"fmt"
|
|
5
|
+
"strings"
|
|
6
|
+
)
|
|
4
7
|
|
|
5
8
|
// FormatKey formats the key by combining the database and the given key.
|
|
6
9
|
// The key is prefixed with the database name to avoid collisions with other keys.
|
|
7
10
|
func FormatKey(database string, key string) string {
|
|
8
11
|
return fmt.Sprintf("%s:%s", database, key)
|
|
9
12
|
}
|
|
13
|
+
|
|
14
|
+
// UnformatKey removes the database prefix from a formatted key.
|
|
15
|
+
// If the key does not have the expected prefix, it is returned unchanged.
|
|
16
|
+
func UnformatKey(database string, formattedKey string) string {
|
|
17
|
+
prefix := database + ":"
|
|
18
|
+
if strings.HasPrefix(formattedKey, prefix) {
|
|
19
|
+
return formattedKey[len(prefix):]
|
|
20
|
+
}
|
|
21
|
+
return formattedKey
|
|
22
|
+
}
|