You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
(docs) add jsdoc comments to command parsers (#2984)
* (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
This commit is contained in:
@@ -2,10 +2,23 @@ import { CommandParser } from '../client/parser';
|
||||
import { RedisArgument, ArrayReply, UnwrapReply, Command, TypeMapping } from '../RESP/types';
|
||||
import { StreamMessageRawReply, transformStreamMessageReply } from './generic-transformers';
|
||||
|
||||
/**
|
||||
* Options for the XRANGE command
|
||||
*
|
||||
* @property COUNT - Limit the number of entries returned
|
||||
*/
|
||||
export interface XRangeOptions {
|
||||
COUNT?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to build XRANGE command arguments
|
||||
*
|
||||
* @param start - Start of ID range (use '-' for minimum ID)
|
||||
* @param end - End of ID range (use '+' for maximum ID)
|
||||
* @param options - Additional options for the range query
|
||||
* @returns Array of arguments for the XRANGE command
|
||||
*/
|
||||
export function xRangeArguments(
|
||||
start: RedisArgument,
|
||||
end: RedisArgument,
|
||||
@@ -23,11 +36,28 @@ export function xRangeArguments(
|
||||
export default {
|
||||
CACHEABLE: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Constructs the XRANGE command to read stream entries in a specific range
|
||||
*
|
||||
* @param parser - The command parser
|
||||
* @param key - The stream key
|
||||
* @param args - Arguments tuple containing start ID, end ID, and options
|
||||
* @returns Array of messages in the specified range
|
||||
* @see https://redis.io/commands/xrange/
|
||||
*/
|
||||
parseCommand(parser: CommandParser, key: RedisArgument, ...args: Parameters<typeof xRangeArguments>) {
|
||||
parser.push('XRANGE');
|
||||
parser.pushKey(key);
|
||||
parser.pushVariadic(xRangeArguments(args[0], args[1], args[2]));
|
||||
},
|
||||
/**
|
||||
* Transforms the raw XRANGE reply into structured message objects
|
||||
*
|
||||
* @param reply - Raw reply from Redis
|
||||
* @param preserve - Preserve options (unused)
|
||||
* @param typeMapping - Type mapping for message fields
|
||||
* @returns Array of structured message objects
|
||||
*/
|
||||
transformReply(
|
||||
reply: UnwrapReply<ArrayReply<StreamMessageRawReply>>,
|
||||
preserve?: any,
|
||||
|
Reference in New Issue
Block a user