1
0
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:
Bobby I.
2025-06-03 14:38:07 +03:00
committed by GitHub
parent e4a1ca467f
commit 20c16e0c2c
491 changed files with 3861 additions and 1 deletions

View File

@@ -2,6 +2,9 @@ import { CommandParser } from '../client/parser';
import { RedisArgument, Command } from '../RESP/types';
import { SortedSetMember, transformDoubleArgument, transformDoubleReply } from './generic-transformers';
/**
* Options for the ZADD command
*/
export interface ZAddOptions {
condition?: 'NX' | 'XX';
/**
@@ -24,7 +27,20 @@ export interface ZAddOptions {
CH?: boolean;
}
/**
* Command for adding members to a sorted set
*/
export default {
/**
* Constructs the ZADD command to add one or more members to a sorted set
*
* @param parser - The command parser
* @param key - The sorted set key
* @param members - One or more members to add with their scores
* @param options - Additional options for adding members
* @returns Number of new members added (or changed members if CH is set)
* @see https://redis.io/commands/zadd/
*/
parseCommand(
parser: CommandParser,
key: RedisArgument,
@@ -59,6 +75,12 @@ export default {
transformReply: transformDoubleReply
} as const satisfies Command;
/**
* Helper function to push sorted set members to the command
*
* @param parser - The command parser
* @param members - One or more members with their scores
*/
export function pushMembers(
parser: CommandParser,
members: SortedSetMember | Array<SortedSetMember>) {
@@ -71,6 +93,12 @@ export function pushMembers(
}
}
/**
* Helper function to push a single sorted set member to the command
*
* @param parser - The command parser
* @param member - Member with its score
*/
function pushMember(
parser: CommandParser,
member: SortedSetMember