You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
23 lines
736 B
TypeScript
23 lines
736 B
TypeScript
import { CommandParser } from '@redis/client/dist/lib/client/parser';
|
|
import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/lib/RESP/types';
|
|
import { RedisJSON, transformRedisJsonArgument } from '.';
|
|
|
|
export interface JsonMSetItem {
|
|
key: RedisArgument;
|
|
path: RedisArgument;
|
|
value: RedisJSON;
|
|
}
|
|
|
|
export default {
|
|
IS_READ_ONLY: false,
|
|
parseCommand(parser: CommandParser, items: Array<JsonMSetItem>) {
|
|
parser.push('JSON.MSET');
|
|
|
|
for (let i = 0; i < items.length; i++) {
|
|
parser.pushKey(items[i].key);
|
|
parser.push(items[i].path, transformRedisJsonArgument(items[i].value));
|
|
}
|
|
},
|
|
transformReply: undefined as unknown as () => SimpleStringReply<'OK'>
|
|
} as const satisfies Command;
|