1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-10 11:43:01 +03:00
Files
node-redis/packages/search/lib/commands/SUGADD.ts
2023-07-06 15:51:12 -04:00

26 lines
664 B
TypeScript

import { RedisArgument, NumberReply, Command } from '@redis/client/dist/lib/RESP/types';
export interface FtSugAddOptions {
INCR?: boolean;
PAYLOAD?: RedisArgument;
}
export default {
FIRST_KEY_INDEX: undefined,
IS_READ_ONLY: false,
transformArguments(key: RedisArgument, string: RedisArgument, score: number, options?: FtSugAddOptions) {
const args = ['FT.SUGADD', key, string, score.toString()];
if (options?.INCR) {
args.push('INCR');
}
if (options?.PAYLOAD) {
args.push('PAYLOAD', options.PAYLOAD);
}
return args;
},
transformReply: undefined as unknown as () => NumberReply
} as const satisfies Command;