MCPcopy
hub / github.com/redis/node-redis / createCommand

Function createCommand

packages/client/lib/sentinel/utils.ts:66–78  ·  view source on GitHub ↗
(command: Command, resp: RespVersions)

Source from the content-addressed store, hash-verified

64}
65
66export function createCommand<T extends ProxySentinel | ProxySentinelClient>(command: Command, resp: RespVersions) {
67 const transformReply = getTransformReply(command, resp);
68
69 return async function (this: T, ...args: Array<unknown>) {
70 const parser = new BasicCommandParser(this._self._keyPrefix);
71 command.parseCommand(parser, ...args);
72
73 return this._self._execute(
74 command.IS_READ_ONLY,
75 client => client._executeCommand(command, parser, this.commandOptions, transformReply)
76 );
77 };
78}
79
80export function createFunctionCommand<T extends NamespaceProxySentinel | NamespaceProxySentinelClient>(name: string, fn: RedisFunction, resp: RespVersions) {
81 const prefix = functionArgumentsPrefix(name, fn);

Callers 1

attachConfigFunction · 0.85

Calls 3

getTransformReplyFunction · 0.90
_executeCommandMethod · 0.80
_executeMethod · 0.45

Tested by

no test coverage detected