1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-03 04:01:40 +03:00
Files
Bobby I. 20c16e0c2c (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
2025-06-03 14:38:07 +03:00

40 lines
1006 B
TypeScript

import { CommandParser } from '../client/parser';
import { RedisArgument, ReplyUnion, Command } from '../RESP/types';
export interface EvalOptions {
keys?: Array<RedisArgument>;
arguments?: Array<RedisArgument>;
}
export function parseEvalArguments(
parser: CommandParser,
script: RedisArgument,
options?: EvalOptions
) {
parser.push(script);
if (options?.keys) {
parser.pushKeysLength(options.keys);
} else {
parser.push('0');
}
if (options?.arguments) {
parser.push(...options.arguments)
}
}
export default {
IS_READ_ONLY: false,
/**
* Executes a Lua script server side
* @param parser - The Redis command parser
* @param script - Lua script to execute
* @param options - Script execution options including keys and arguments
*/
parseCommand(...args: Parameters<typeof parseEvalArguments>) {
args[0].push('EVAL');
parseEvalArguments(...args);
},
transformReply: undefined as unknown as () => ReplyUnion
} as const satisfies Command;