1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-03 04:01:40 +03:00
Files
node-redis/packages/json/lib/commands/STRAPPEND.ts
2023-09-05 18:19:31 -04:00

23 lines
702 B
TypeScript

import { RedisArgument, Command, NullReply, NumberReply, ArrayReply } from '@redis/client/dist/lib/RESP/types';
import { transformRedisJsonArgument } from '.';
export interface JsonStrAppendOptions {
path?: RedisArgument;
}
export default {
FIRST_KEY_INDEX: 1,
IS_READ_ONLY: false,
transformArguments(key: RedisArgument, append: string, options?: JsonStrAppendOptions) {
const args = ['JSON.STRAPPEND', key];
if (options?.path !== undefined) {
args.push(options.path);
}
args.push(transformRedisJsonArgument(append));
return args;
},
transformReply: undefined as unknown as () => NumberReply | ArrayReply<NullReply | NumberReply>
} as const satisfies Command;