MCPcopy Index your code
hub / github.com/redis/node-redis / parseCommand

Function parseCommand

packages/client/lib/commands/HSETEX.ts:23–56  ·  view source on GitHub ↗
(
    parser: CommandParser,
    key: RedisArgument,
    fields: HSETEXObject | HSETEXMap | HSETEXTuples,
    options?: HSetExOptions
  )

Source from the content-addressed store, hash-verified

21
22export default {
23 parseCommand(
24 parser: CommandParser,
25 key: RedisArgument,
26 fields: HSETEXObject | HSETEXMap | HSETEXTuples,
27 options?: HSetExOptions
28 ) {
29 parser.push('HSETEX');
30 parser.pushKey(key);
31
32 if (options?.mode) {
33 parser.push(options.mode)
34 }
35 if (options?.expiration) {
36 if (typeof options.expiration === 'string') {
37 parser.push(options.expiration);
38 } else if (options.expiration.type === 'KEEPTTL') {
39 parser.push('KEEPTTL');
40 } else {
41 parser.push(
42 options.expiration.type,
43 options.expiration.value.toString()
44 );
45 }
46 }
47
48 parser.push('FIELDS')
49 if (fields instanceof Map) {
50 pushMap(parser, fields);
51 } else if (Array.isArray(fields)) {
52 pushTuples(parser, fields);
53 } else {
54 pushObject(parser, fields);
55 }
56 },
57 transformReply: undefined as unknown as () => NumberReply<0 | 1>
58} as const satisfies Command;
59

Callers

nothing calls this directly

Calls 6

pushKeyMethod · 0.80
pushMapFunction · 0.70
pushTuplesFunction · 0.70
pushObjectFunction · 0.70
toStringMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected