1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-03 04:01:40 +03:00
Files
node-redis/packages/client/lib/commands/CONFIG_SET.ts
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

33 lines
1.1 KiB
TypeScript

import { CommandParser } from '../client/parser';
import { SimpleStringReply, Command, RedisArgument } from '../RESP/types';
type SingleParameter = [parameter: RedisArgument, value: RedisArgument];
type MultipleParameters = [config: Record<string, RedisArgument>];
export default {
NOT_KEYED_COMMAND: true,
IS_READ_ONLY: true,
/**
* Sets configuration parameters to the specified values
* @param parser - The Redis command parser
* @param parameterOrConfig - Either a single parameter name or a configuration object
* @param value - Value for the parameter (when using single parameter format)
*/
parseCommand(
parser: CommandParser,
...[parameterOrConfig, value]: SingleParameter | MultipleParameters
) {
parser.push('CONFIG', 'SET');
if (typeof parameterOrConfig === 'string' || parameterOrConfig instanceof Buffer) {
parser.push(parameterOrConfig, value!);
} else {
for (const [key, value] of Object.entries(parameterOrConfig)) {
parser.push(key, value);
}
}
},
transformReply: undefined as unknown as () => SimpleStringReply
} as const satisfies Command;