Skip to content

Commit edd250c

Browse files
committed
feat: added support for new bitop operations
1 parent 20c16e0 commit edd250c

File tree

4 files changed

+31
-3
lines changed

4 files changed

+31
-3
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
fail-fast: false
2323
matrix:
2424
node-version: ["18", "20", "22"]
25-
redis-version: ["rs-7.2.0-v13", "rs-7.4.0-v1", "8.0.1-pre"]
25+
redis-version: ["rs-7.2.0-v13", "rs-7.4.0-v1", "8.0.1-pre", "8.2-M01-pre"]
2626
steps:
2727
- uses: actions/checkout@v4
2828
with:

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,32 @@ describe('BITOP', () => {
2929
client: GLOBAL.SERVERS.OPEN,
3030
cluster: GLOBAL.CLUSTERS.OPEN
3131
});
32+
33+
testUtils.testWithClientIfVersionWithinRange([[8, 2], 'LATEST'], 'bitOp DIFF', async client => {
34+
assert.equal(
35+
await client.bitOp('DIFF', '{tag}destKey', ['{tag}key', '{tag}key2']),
36+
0
37+
);
38+
}, GLOBAL.SERVERS.OPEN);
39+
40+
testUtils.testWithClientIfVersionWithinRange([[8, 2], 'LATEST'], 'bitOp DIFF1', async client => {
41+
assert.equal(
42+
await client.bitOp('DIFF1', '{tag}destKey', ['{tag}key', '{tag}key2']),
43+
0
44+
);
45+
}, GLOBAL.SERVERS.OPEN);
46+
47+
testUtils.testWithClientIfVersionWithinRange([[8, 2], 'LATEST'], 'bitOp ANDOR', async client => {
48+
assert.equal(
49+
await client.bitOp('ANDOR', '{tag}destKey', ['{tag}key', '{tag}key2', '{tag}key3']),
50+
0
51+
);
52+
}, GLOBAL.SERVERS.OPEN);
53+
54+
testUtils.testWithClientIfVersionWithinRange([[8, 2], 'LATEST'], 'bitOp ONE', async client => {
55+
assert.equal(
56+
await client.bitOp('ONE', '{tag}destKey', ['{tag}key', '{tag}key2']),
57+
0
58+
);
59+
}, GLOBAL.SERVERS.OPEN);
3260
});

packages/client/lib/commands/BITOP.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { CommandParser } from '../client/parser';
22
import { NumberReply, Command, RedisArgument } from '../RESP/types';
33
import { RedisVariadicArgument } from './generic-transformers';
44

5-
export type BitOperations = 'AND' | 'OR' | 'XOR' | 'NOT';
5+
export type BitOperations = 'AND' | 'OR' | 'XOR' | 'NOT' | 'DIFF' | 'DIFF1' | 'ANDOR' | 'ONE';
66

77
export default {
88
IS_READ_ONLY: false,

packages/client/lib/test-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import RedisBloomModules from '@redis/bloom';
99
const utils = TestUtils.createFromConfig({
1010
dockerImageName: 'redislabs/client-libs-test',
1111
dockerImageVersionArgument: 'redis-version',
12-
defaultDockerVersion: '8.0-M05-pre'
12+
defaultDockerVersion: '8.2-M01-pre'
1313
});
1414

1515
export default utils;

0 commit comments

Comments
 (0)