@rivascva/dt-idl 1.1.160 → 1.1.162

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.
@@ -72,17 +72,17 @@ func (r *BaseRDB) Set(ctx context.Context, key string, value any) error {
72
72
 
73
73
  func (r *BaseRDB) MSet(ctx context.Context, entries map[string]any) error {
74
74
  // format the entries
75
- formattedEntries := make(map[string][]byte, len(entries))
75
+ args := make([]any, 0, len(entries)*2)
76
76
  for key, value := range entries {
77
77
  bytes, err := json.Marshal(value)
78
78
  if err != nil {
79
79
  return fmt.Errorf("failed to marshal the value for key %s: %w", key, err)
80
80
  }
81
- formattedEntries[FormatKey(r.database, key)] = bytes
81
+ args = append(args, FormatKey(r.database, key), bytes)
82
82
  }
83
83
 
84
84
  // set the entries in the redis client
85
- err := r.client.MSet(ctx, formattedEntries).Err()
85
+ err := r.client.MSet(ctx, args...).Err()
86
86
  if err != nil {
87
87
  return fmt.Errorf("failed to set the entries in the redis client: %w", err)
88
88
  }
@@ -197,7 +197,7 @@ func (r *BaseRDB) GetKeysWithPattern(ctx context.Context, pattern string, window
197
197
 
198
198
  for {
199
199
  // scan the database for keys matching the given pattern
200
- keys, cursor, err := r.client.Scan(ctx, cursor, FormatKey(r.database, pattern), int64(window)).Result()
200
+ keys, nextCursor, err := r.client.Scan(ctx, cursor, FormatKey(r.database, pattern), int64(window)).Result()
201
201
  if err != nil {
202
202
  return nil, fmt.Errorf("failed to scan the database: %w", err)
203
203
  }
@@ -205,6 +205,9 @@ func (r *BaseRDB) GetKeysWithPattern(ctx context.Context, pattern string, window
205
205
  // add the keys to the result
206
206
  result = append(result, keys...)
207
207
 
208
+ // update the cursor
209
+ cursor = nextCursor
210
+
208
211
  // if the cursor is 0, we have scanned all the keys
209
212
  if cursor == 0 {
210
213
  break
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivascva/dt-idl",
3
- "version": "1.1.160",
3
+ "version": "1.1.162",
4
4
  "description": "Dream Trade - Interface Definition Language",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",