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

Function createFunctionCommand

packages/client/lib/sentinel/utils.ts:80–94  ·  view source on GitHub ↗
(name: string, fn: RedisFunction, resp: RespVersions)

Source from the content-addressed store, hash-verified

78}
79
80export function createFunctionCommand<T extends NamespaceProxySentinel | NamespaceProxySentinelClient>(name: string, fn: RedisFunction, resp: RespVersions) {
81 const prefix = functionArgumentsPrefix(name, fn);
82 const transformReply = getTransformReply(fn, resp);
83
84 return async function (this: T, ...args: Array<unknown>) {
85 const parser = new BasicCommandParser(this._self._keyPrefix);
86 parser.push(...prefix);
87 fn.parseCommand(parser, ...args);
88
89 return this._self._execute(
90 fn.IS_READ_ONLY,
91 client => client._executeCommand(fn, parser, this._self.commandOptions, transformReply)
92 );
93 }
94};
95
96export function createModuleCommand<T extends NamespaceProxySentinel | NamespaceProxySentinelClient>(command: Command, resp: RespVersions) {
97 const transformReply = getTransformReply(command, resp);

Callers 1

attachConfigFunction · 0.85

Calls 5

pushMethod · 0.95
functionArgumentsPrefixFunction · 0.90
getTransformReplyFunction · 0.90
_executeCommandMethod · 0.80
_executeMethod · 0.45

Tested by

no test coverage detected