You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
25 lines
828 B
TypeScript
25 lines
828 B
TypeScript
import { CommandParser } from '@redis/client/dist/lib/client/parser';
|
|
import { RedisArgument, NumberReply, ArrayReply, NullReply, Command } from '@redis/client/dist/lib/RESP/types';
|
|
import { RedisJSON, transformRedisJsonArgument } from '.';
|
|
|
|
export default {
|
|
IS_READ_ONLY: false,
|
|
parseCommand(
|
|
parser: CommandParser,
|
|
key: RedisArgument,
|
|
path: RedisArgument,
|
|
index: number,
|
|
json: RedisJSON,
|
|
...jsons: Array<RedisJSON>
|
|
) {
|
|
parser.push('JSON.ARRINSERT');
|
|
parser.pushKey(key);
|
|
parser.push(path, index.toString(), transformRedisJsonArgument(json));
|
|
|
|
for (let i = 0; i < jsons.length; i++) {
|
|
parser.push(transformRedisJsonArgument(jsons[i]));
|
|
}
|
|
},
|
|
transformReply: undefined as unknown as () => NumberReply | ArrayReply<NumberReply | NullReply>
|
|
} as const satisfies Command;
|