Skip to content

Commit baf67fd

Browse files
authored
fix #1976 - XSETID (#2104)
1 parent 225524f commit baf67fd

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

packages/client/lib/cluster/commands.ts

+3
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ import * as XRANGE from '../commands/XRANGE';
155155
import * as XREAD from '../commands/XREAD';
156156
import * as XREADGROUP from '../commands/XREADGROUP';
157157
import * as XREVRANGE from '../commands/XREVRANGE';
158+
import * as XSETID from '../commands/XSETID';
158159
import * as XTRIM from '../commands/XTRIM';
159160
import * as ZADD from '../commands/ZADD';
160161
import * as ZCARD from '../commands/ZCARD';
@@ -508,6 +509,8 @@ export default {
508509
xReadGroup: XREADGROUP,
509510
XREVRANGE,
510511
xRevRange: XREVRANGE,
512+
XSETID,
513+
xSetId: XSETID,
511514
XTRIM,
512515
xTrim: XTRIM,
513516
ZADD,

packages/client/lib/commands/XSETID.spec.ts

Whitespace-only changes.
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { RedisCommandArgument, RedisCommandArguments } from '.';
2+
3+
export const FIRST_KEY_INDEX = 1;
4+
5+
interface XSetIdOptions {
6+
ENTRIESADDED?: number;
7+
MAXDELETEDID?: RedisCommandArgument;
8+
}
9+
10+
export function transformArguments(
11+
key: RedisCommandArgument,
12+
lastId: RedisCommandArgument,
13+
options?: XSetIdOptions
14+
): RedisCommandArguments {
15+
const args = ['XSETID', key, lastId];
16+
17+
if (options?.ENTRIESADDED) {
18+
args.push('ENTRIESADDED', options.ENTRIESADDED.toString());
19+
}
20+
21+
if (options?.MAXDELETEDID) {
22+
args.push('MAXDELETEDID', options.MAXDELETEDID);
23+
}
24+
25+
return args;
26+
}
27+
28+
export declare function transformReply(): 'OK';

0 commit comments

Comments
 (0)