You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Support new cluster commands (#2050)
* Support new cluster commands * clean code Co-authored-by: leibale <leibale1998@gmail.com>
This commit is contained in:
@@ -422,3 +422,33 @@ export function transformCommandReply(
|
||||
categories: new Set(categories)
|
||||
};
|
||||
}
|
||||
|
||||
export interface SlotRange {
|
||||
start: number;
|
||||
end: number;
|
||||
}
|
||||
|
||||
function pushSlotRangeArguments(
|
||||
args: RedisCommandArguments,
|
||||
range: SlotRange
|
||||
): void {
|
||||
args.push(
|
||||
range.start.toString(),
|
||||
range.end.toString()
|
||||
);
|
||||
}
|
||||
|
||||
export function pushSlotRangesArguments(
|
||||
args: RedisCommandArguments,
|
||||
ranges: SlotRange | Array<SlotRange>
|
||||
): RedisCommandArguments {
|
||||
if (Array.isArray(ranges)) {
|
||||
for (const range of ranges) {
|
||||
pushSlotRangeArguments(args, range);
|
||||
}
|
||||
} else {
|
||||
pushSlotRangeArguments(args, ranges);
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
Reference in New Issue
Block a user