You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
38 lines
1.0 KiB
TypeScript
38 lines
1.0 KiB
TypeScript
import { CommandArguments, NullReply, TuplesReply, BlobStringReply, Command } from '../RESP/types';
|
|
import { ListSide, RedisVariadicArgument, pushVariadicArgument } from './generic-transformers';
|
|
|
|
export interface LMPopOptions {
|
|
COUNT?: number;
|
|
}
|
|
|
|
export function transformLMPopArguments(
|
|
args: CommandArguments,
|
|
keys: RedisVariadicArgument,
|
|
side: ListSide,
|
|
options?: LMPopOptions
|
|
): CommandArguments {
|
|
args = pushVariadicArgument(args, keys);
|
|
|
|
args.push(side);
|
|
|
|
if (options?.COUNT !== undefined) {
|
|
args.push('COUNT', options.COUNT.toString());
|
|
}
|
|
|
|
return args;
|
|
}
|
|
|
|
export type LMPopArguments = typeof transformLMPopArguments extends (_: any, ...args: infer T) => any ? T : never;
|
|
|
|
export default {
|
|
FIRST_KEY_INDEX: 2,
|
|
IS_READ_ONLY: false,
|
|
transformArguments(...args: LMPopArguments) {
|
|
return transformLMPopArguments(['LMPOP'], ...args);
|
|
},
|
|
transformReply: undefined as unknown as () => NullReply | TuplesReply<[
|
|
key: BlobStringReply,
|
|
elements: Array<BlobStringReply>
|
|
]>
|
|
} as const satisfies Command;
|