You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
feat: add support for vector sets (#2998)
* wip * improve the vadd api * resp3 tests * fix some tests * extract json helper functions in client package * use transformJsonReply * remove the CACHEABLE flag for all vector set commands currently, client side caching is not supported for vector set commands by the server * properly transform vinfo result * add resp3 test for vlinks * add more tests for vrandmember * fix vrem return types * fix vsetattr return type * fix vsim_withscores * implement vlinks_withscores * set minimum docker image version to 8 * align return types * add RAW variant for VEMB -> VEMB_RAW * use the new parseCommand api
This commit is contained in:
committed by
GitHub
parent
b52177752e
commit
c5b4f47975
43
packages/client/lib/commands/VDIM.spec.ts
Normal file
43
packages/client/lib/commands/VDIM.spec.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import { strict as assert } from 'node:assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import VDIM from './VDIM';
|
||||
import { BasicCommandParser } from '../client/parser';
|
||||
|
||||
describe('VDIM', () => {
|
||||
it('parseCommand', () => {
|
||||
const parser = new BasicCommandParser();
|
||||
VDIM.parseCommand(parser, 'key');
|
||||
assert.deepEqual(
|
||||
parser.redisArgs,
|
||||
['VDIM', 'key']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testAll('vDim', async client => {
|
||||
await client.vAdd('key', [1.0, 2.0, 3.0], 'element');
|
||||
|
||||
assert.equal(
|
||||
await client.vDim('key'),
|
||||
3
|
||||
);
|
||||
}, {
|
||||
client: { ...GLOBAL.SERVERS.OPEN, minimumDockerVersion: [8, 0] },
|
||||
cluster: { ...GLOBAL.CLUSTERS.OPEN, minimumDockerVersion: [8, 0] }
|
||||
});
|
||||
|
||||
testUtils.testWithClient('vDim with RESP3', async client => {
|
||||
await client.vAdd('resp3-5d', [1.0, 2.0, 3.0, 4.0, 5.0], 'elem5d');
|
||||
|
||||
assert.equal(
|
||||
await client.vDim('resp3-5d'),
|
||||
5
|
||||
);
|
||||
|
||||
}, {
|
||||
...GLOBAL.SERVERS.OPEN,
|
||||
clientOptions: {
|
||||
RESP: 3
|
||||
},
|
||||
minimumDockerVersion: [8, 0]
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user