You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
WIP
This commit is contained in:
@@ -1,54 +1,61 @@
|
||||
import { NullReply, TuplesReply, BlobStringReply, DoubleReply, ArrayReply, Resp2Reply, Command } from '../RESP/types';
|
||||
import { pushVariadicArgument, RedisVariadicArgument, SortedSetSide } from './generic-transformers';
|
||||
// import { NullReply, TuplesReply, BlobStringReply, DoubleReply, ArrayReply, Resp2Reply, Command, RedisArgument } from '../RESP/types';
|
||||
// import { pushVariadicArgument, RedisVariadicArgument, SortedSetSide } from './generic-transformers';
|
||||
|
||||
export interface ZMPopOptions {
|
||||
COUNT?: number;
|
||||
}
|
||||
// export interface ZMPopOptions {
|
||||
// COUNT?: number;
|
||||
// }
|
||||
|
||||
export type ZMPopRawReply = NullReply | TuplesReply<[
|
||||
key: BlobStringReply,
|
||||
elements: ArrayReply<TuplesReply<[
|
||||
member: BlobStringReply,
|
||||
score: DoubleReply
|
||||
]>>
|
||||
]>;
|
||||
// export type ZMPopRawReply = NullReply | TuplesReply<[
|
||||
// key: BlobStringReply,
|
||||
// elements: ArrayReply<TuplesReply<[
|
||||
// member: BlobStringReply,
|
||||
// score: DoubleReply
|
||||
// ]>>
|
||||
// ]>;
|
||||
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 2,
|
||||
IS_READ_ONLY: false,
|
||||
transformArguments(
|
||||
keys: RedisVariadicArgument,
|
||||
side: SortedSetSide,
|
||||
options?: ZMPopOptions
|
||||
) {
|
||||
const args = pushVariadicArgument(['ZMPOP'], keys);
|
||||
// export function pushZMPopArguments(
|
||||
// args: Array<RedisArgument>,
|
||||
// keys: RedisVariadicArgument,
|
||||
// side: SortedSetSide,
|
||||
// options: ZMPopOptions
|
||||
// )
|
||||
|
||||
args.push(side);
|
||||
// export default {
|
||||
// FIRST_KEY_INDEX: 2,
|
||||
// IS_READ_ONLY: false,
|
||||
// transformArguments(
|
||||
// keys: RedisVariadicArgument,
|
||||
// side: SortedSetSide,
|
||||
// options?: ZMPopOptions
|
||||
// ) {
|
||||
// const args = pushVariadicArgument(['ZMPOP'], keys);
|
||||
|
||||
if (options?.COUNT) {
|
||||
args.push('COUNT', options.COUNT.toString());
|
||||
}
|
||||
// args.push(side);
|
||||
|
||||
return args;
|
||||
},
|
||||
transformReply: {
|
||||
2: (reply: Resp2Reply<ZMPopRawReply>) => {
|
||||
return reply === null ? null : {
|
||||
key: reply[0],
|
||||
elements: reply[1].map(([member, score]) => ({
|
||||
member,
|
||||
score: Number(score)
|
||||
}))
|
||||
};
|
||||
},
|
||||
3: (reply: ZMPopRawReply) => {
|
||||
return reply === null ? null : {
|
||||
key: reply[0],
|
||||
elements: reply[1].map(([member, score]) => ({
|
||||
member,
|
||||
score
|
||||
}))
|
||||
};
|
||||
},
|
||||
}
|
||||
} as const satisfies Command;
|
||||
// if (options?.COUNT) {
|
||||
// args.push('COUNT', options.COUNT.toString());
|
||||
// }
|
||||
|
||||
// return args;
|
||||
// },
|
||||
// transformReply: {
|
||||
// 2: (reply: Resp2Reply<ZMPopRawReply>) => {
|
||||
// return reply === null ? null : {
|
||||
// key: reply[0],
|
||||
// elements: reply[1].map(([member, score]) => ({
|
||||
// member,
|
||||
// score: Number(score)
|
||||
// }))
|
||||
// };
|
||||
// },
|
||||
// 3: (reply: ZMPopRawReply) => {
|
||||
// return reply === null ? null : {
|
||||
// key: reply[0],
|
||||
// elements: reply[1].map(([member, score]) => ({
|
||||
// member,
|
||||
// score
|
||||
// }))
|
||||
// };
|
||||
// },
|
||||
// }
|
||||
// } as const satisfies Command;
|
||||
|
Reference in New Issue
Block a user