You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-09 00:22:08 +03:00
26 lines
663 B
TypeScript
26 lines
663 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: true,
|
|
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;
|