1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00

fix XSETID

This commit is contained in:
dovi
2023-05-02 16:06:14 -04:00
parent 449d9c40ae
commit afa394e35d
4 changed files with 71 additions and 24 deletions

View File

@@ -1,28 +1,29 @@
// import { RedisCommandArgument, RedisCommandArguments } from '.';
import { RedisArgument, SimpleStringReply, Command } from '../RESP/types';
export interface XSetIdOptions {
ENTRIESADDED?: number;
MAXDELETEDID?: RedisArgument;
}
// export const FIRST_KEY_INDEX = 1;
export default {
FIRST_KEY_INDEX: 1,
IS_READ_ONLY: false,
transformArguments(
key: RedisArgument,
lastId: RedisArgument,
options?: XSetIdOptions
) {
const args = ['XSETID', key, lastId];
// interface XSetIdOptions {
// ENTRIESADDED?: number;
// MAXDELETEDID?: RedisCommandArgument;
// }
if (options?.ENTRIESADDED) {
args.push('ENTRIESADDED', options.ENTRIESADDED.toString());
}
// export function transformArguments(
// key: RedisCommandArgument,
// lastId: RedisCommandArgument,
// options?: XSetIdOptions
// ): RedisCommandArguments {
// const args = ['XSETID', key, lastId];
if (options?.MAXDELETEDID) {
args.push('MAXDELETEDID', options.MAXDELETEDID);
}
// if (options?.ENTRIESADDED) {
// args.push('ENTRIESADDED', options.ENTRIESADDED.toString());
// }
return args;
},
transformReply: undefined as unknown as () => SimpleStringReply<'OK'>
} as const satisfies Command;
// if (options?.MAXDELETEDID) {
// args.push('MAXDELETEDID', options.MAXDELETEDID);
// }
// return args;
// }
// export declare function transformReply(): 'OK';