1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-09 00:22:08 +03:00
Files
node-redis/packages/json/lib/commands/MSET.ts
Rowan Trollope 132599332f Added MSET command
MSET command added. Requires all keys to have the same JSON Path, which might fit most use cases, but is a limitation.  Optionally we could make the path an array as well to support all use cases.
2023-08-29 10:31:34 -07:00

25 lines
704 B
TypeScript

import { RedisJSON, transformRedisJsonArgument } from ".";
export const FIRST_KEY_INDEX = 1;
export function transformArguments(
keys: Array<string>,
path: string,
json: Array<RedisJSON>
): Array<string> {
if (keys.length != json.length)
throw new Error("Number of keys and json objects must be equal");
let args: Array<string> = ["JSON.SET"];
// walk through the key array, adding the key, the path and the json objects, calling transformRedisJsonArgument for each
for (let i = 0; i < keys.length; i++) {
args.push(keys[i], path, transformRedisJsonArgument(json[i]));
}
return args;
}
export declare function transformReply(): "OK" | null;