mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 06:25:50 +01:00
feat: handle array of keys in psql exists for zsets
This commit is contained in:
@@ -20,6 +20,10 @@ module.exports = function (module) {
|
|||||||
// Redis/Mongo consider empty zsets as non-existent, match that behaviour
|
// Redis/Mongo consider empty zsets as non-existent, match that behaviour
|
||||||
const type = await module.type(key);
|
const type = await module.type(key);
|
||||||
if (type === 'zset') {
|
if (type === 'zset') {
|
||||||
|
if (Array.isArray(key)) {
|
||||||
|
const members = await Promise.all(key.map(key => module.getSortedSetRange(key, 0, 0)));
|
||||||
|
return members.map(member => member.length > 0);
|
||||||
|
}
|
||||||
const members = await module.getSortedSetRange(key, 0, 0);
|
const members = await module.getSortedSetRange(key, 0, 0);
|
||||||
return members.length > 0;
|
return members.length > 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user