You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-03 04:01:40 +03:00
* (docs) bloom: add jsdocs for all commands * (docs) json: add jsdocs * (docs) search: add jsdocs for all commands * (docs) jsdocs for std commands * (docs) jsdoc comments to time series commands
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import { CommandParser } from '../client/parser';
|
|
import { NullReply, TuplesReply, BlobStringReply, Command } from '../RESP/types';
|
|
import { ListSide, RedisVariadicArgument, Tail } from './generic-transformers';
|
|
|
|
export interface LMPopOptions {
|
|
COUNT?: number;
|
|
}
|
|
|
|
export function parseLMPopArguments(
|
|
parser: CommandParser,
|
|
keys: RedisVariadicArgument,
|
|
side: ListSide,
|
|
options?: LMPopOptions
|
|
) {
|
|
parser.pushKeysLength(keys);
|
|
parser.push(side);
|
|
|
|
if (options?.COUNT !== undefined) {
|
|
parser.push('COUNT', options.COUNT.toString());
|
|
}
|
|
}
|
|
|
|
export type LMPopArguments = Tail<Parameters<typeof parseLMPopArguments>>;
|
|
|
|
export default {
|
|
IS_READ_ONLY: false,
|
|
/**
|
|
* Constructs the LMPOP command
|
|
*
|
|
* @param parser - The command parser
|
|
* @param args - Arguments including keys, side (LEFT or RIGHT), and options
|
|
* @see https://redis.io/commands/lmpop/
|
|
*/
|
|
parseCommand(parser: CommandParser, ...args: LMPopArguments) {
|
|
parser.push('LMPOP');
|
|
parseLMPopArguments(parser, ...args);
|
|
},
|
|
transformReply: undefined as unknown as () => NullReply | TuplesReply<[
|
|
key: BlobStringReply,
|
|
elements: Array<BlobStringReply>
|
|
]>
|
|
} as const satisfies Command;
|