Zincrybulk (#9975)

* feat: zincry bulk

* feat: psql bulk incr placeholder

* test: redis test fix

* test: redis test
This commit is contained in:
Barış Soner Uşaklı
2021-11-30 19:59:47 -05:00
committed by GitHub
parent d9c42c000c
commit 6ea3b51f12
4 changed files with 78 additions and 0 deletions

View File

@@ -1024,6 +1024,47 @@ describe('Sorted Set methods', () => {
});
});
});
it('should increment fields of sorted sets with a single call', async () => {
const data = await db.sortedSetIncrByBulk([
['sortedIncrBulk1', 1, 'value1'],
['sortedIncrBulk2', 2, 'value2'],
['sortedIncrBulk3', 3, 'value3'],
['sortedIncrBulk3', 4, 'value4'],
]);
assert.deepStrictEqual(data, [1, 2, 3, 4]);
assert.deepStrictEqual(
await db.getSortedSetRangeWithScores('sortedIncrBulk1', 0, -1),
[{ value: 'value1', score: 1 }],
);
assert.deepStrictEqual(
await db.getSortedSetRangeWithScores('sortedIncrBulk2', 0, -1),
[{ value: 'value2', score: 2 }],
);
assert.deepStrictEqual(
await db.getSortedSetRangeWithScores('sortedIncrBulk3', 0, -1),
[
{ value: 'value3', score: 3 },
{ value: 'value4', score: 4 },
],
);
});
it('should increment the same field', async () => {
const data1 = await db.sortedSetIncrByBulk([
['sortedIncrBulk5', 5, 'value5'],
]);
const data2 = await db.sortedSetIncrByBulk([
['sortedIncrBulk5', 5, 'value5'],
]);
assert.deepStrictEqual(
await db.getSortedSetRangeWithScores('sortedIncrBulk5', 0, -1),
[
{ value: 'value5', score: 10 },
],
);
});
});