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

cluster multi

This commit is contained in:
Leibale
2023-05-30 19:23:14 +03:00
parent 2fa33dbbac
commit fcb3a011b5
6 changed files with 352 additions and 230 deletions

View File

@@ -1,5 +1,15 @@
import { CommandArguments, RedisScript, TransformReply } from './RESP/types';
// TODO: enum?
export type MULTI_REPLY = {
GENERIC: 'generic';
TYPED: 'typed';
};
export type MultiReply = MULTI_REPLY[keyof MULTI_REPLY];
export type MultiReplyType<T extends MultiReply, REPLIES> = T extends MULTI_REPLY['TYPED'] ? REPLIES : Array<unknown>;
export interface RedisMultiQueuedCommand {
args: CommandArguments;
transformReply?: TransformReply;
@@ -15,7 +25,6 @@ export default class RedisMultiCommand {
args,
transformReply
});
return this;
}
addScript(script: RedisScript, args: CommandArguments, transformReply?: TransformReply) {
@@ -34,7 +43,7 @@ export default class RedisMultiCommand {
redisArgs.push(...args);
redisArgs.preserve = args.preserve;
return this.addCommand(redisArgs, transformReply);
this.addCommand(redisArgs, transformReply);
}
transformReplies(rawReplies: Array<unknown>): Array<unknown> {