You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
stream commands + some more
This commit is contained in:
@@ -1,28 +1,31 @@
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { RedisArgument, ArrayReply, TuplesToMapReply, BlobStringReply, NumberReply, Resp2Reply, Command } from '../RESP/types';
|
||||
|
||||
// export const FIRST_KEY_INDEX = 2;
|
||||
export type XInfoConsumersReply = ArrayReply<TuplesToMapReply<[
|
||||
[BlobStringReply<'name'>, BlobStringReply],
|
||||
[BlobStringReply<'pending'>, NumberReply],
|
||||
[BlobStringReply<'idle'>, NumberReply],
|
||||
/** added in 7.2 */
|
||||
[BlobStringReply<'inactive'>, NumberReply]
|
||||
]>>;
|
||||
|
||||
// export const IS_READ_ONLY = true;
|
||||
|
||||
// export function transformArguments(
|
||||
// key: RedisCommandArgument,
|
||||
// group: RedisCommandArgument
|
||||
// ): RedisCommandArguments {
|
||||
// return ['XINFO', 'CONSUMERS', key, group];
|
||||
// }
|
||||
|
||||
// type XInfoConsumersReply = Array<{
|
||||
// name: RedisCommandArgument;
|
||||
// pending: number;
|
||||
// idle: number;
|
||||
// inactive: number;
|
||||
// }>;
|
||||
|
||||
// export function transformReply(rawReply: Array<any>): XInfoConsumersReply {
|
||||
// return rawReply.map(consumer => ({
|
||||
// name: consumer[1],
|
||||
// pending: consumer[3],
|
||||
// idle: consumer[5],
|
||||
// inactive: consumer[7]
|
||||
// }));
|
||||
// }
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 2,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(
|
||||
key: RedisArgument,
|
||||
group: RedisArgument
|
||||
) {
|
||||
return ['XINFO', 'CONSUMERS', key, group];
|
||||
},
|
||||
transformReply: {
|
||||
2: (reply: Resp2Reply<XInfoConsumersReply>) => {
|
||||
return reply.map(consumer => ({
|
||||
name: consumer[1],
|
||||
pending: consumer[3],
|
||||
idle: consumer[5],
|
||||
inactive: consumer[7]
|
||||
}));
|
||||
},
|
||||
3: undefined as unknown as () => XInfoConsumersReply
|
||||
}
|
||||
} as const satisfies Command;
|
||||
|
Reference in New Issue
Block a user