You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-10 11:43:01 +03:00
26 lines
766 B
TypeScript
26 lines
766 B
TypeScript
import { RedisArgument, TuplesToMapReply, BlobStringReply, NumberReply, DoubleReply, Resp2Reply, Command } from '@redis/client/dist/lib/RESP/types';
|
|
|
|
export type TopKInfoReply = TuplesToMapReply<[
|
|
[BlobStringReply<'k'>, NumberReply],
|
|
[BlobStringReply<'width'>, NumberReply],
|
|
[BlobStringReply<'depth'>, NumberReply],
|
|
[BlobStringReply<'decay'>, DoubleReply]
|
|
]>;
|
|
|
|
export default {
|
|
FIRST_KEY_INDEX: 1,
|
|
IS_READ_ONLY: true,
|
|
transformArguments(key: RedisArgument) {
|
|
return ['TOPK.INFO', key];
|
|
},
|
|
transformReply: {
|
|
2: (reply: Resp2Reply<TopKInfoReply>) => ({
|
|
k: reply[1],
|
|
width: reply[3],
|
|
depth: reply[5],
|
|
decay: Number(reply[7])
|
|
}),
|
|
3: undefined as unknown as () => TopKInfoReply
|
|
}
|
|
} as const satisfies Command;
|