feat: test psql without defineProperty (#7815)

* feat: test psql without defineProperty

* feat: refactor psql

remove .bind calls, use module.pool.query directly
move requires to top of file
move promisify to bottom so .init etc are promisified

* feat: mongodb

move requires to bottom

* feat: redis
This commit is contained in:
Barış Soner Uşaklı
2019-08-05 09:20:00 -04:00
committed by GitHub
parent 52a2e5d61d
commit af1f7249a7
33 changed files with 301 additions and 341 deletions

View File

@@ -1,6 +1,6 @@
'use strict';
module.exports = function (db, module) {
module.exports = function (module) {
var helpers = require('./helpers');
var _ = require('lodash');
@@ -16,11 +16,11 @@ module.exports = function (db, module) {
const writeData = helpers.serializeData(data);
if (isArray) {
var bulk = db.collection('objects').initializeUnorderedBulkOp();
var bulk = module.client.collection('objects').initializeUnorderedBulkOp();
key.forEach(key => bulk.find({ _key: key }).upsert().updateOne({ $set: writeData }));
await bulk.execute();
} else {
await db.collection('objects').updateOne({ _key: key }, { $set: writeData }, { upsert: true, w: 1 });
await module.client.collection('objects').updateOne({ _key: key }, { $set: writeData }, { upsert: true, w: 1 });
}
cache.delObjectCache(key);
@@ -58,7 +58,7 @@ module.exports = function (db, module) {
return cachedData[key].hasOwnProperty(field) ? cachedData[key][field] : null;
}
field = helpers.fieldToString(field);
const item = await db.collection('objects').findOne({ _key: key }, { projection: { _id: 0, [field]: 1 } });
const item = await module.client.collection('objects').findOne({ _key: key }, { projection: { _id: 0, [field]: 1 } });
if (!item) {
return null;
}
@@ -104,7 +104,7 @@ module.exports = function (db, module) {
if (unCachedKeys.length === 1) {
query._key = unCachedKeys[0];
}
let data = await db.collection('objects').find(query, { projection: { _id: 0 } }).toArray();
let data = await module.client.collection('objects').find(query, { projection: { _id: 0 } }).toArray();
data = data.map(helpers.deserializeData);
var map = helpers.toMap(data);
@@ -142,7 +142,7 @@ module.exports = function (db, module) {
data[field] = 1;
});
const item = await db.collection('objects').findOne({ _key: key }, { projection: data });
const item = await module.client.collection('objects').findOne({ _key: key }, { projection: data });
const results = fields.map(f => !!item && item[f] !== undefined && item[f] !== null);
return results;
};
@@ -166,7 +166,7 @@ module.exports = function (db, module) {
data[field] = '';
});
await db.collection('objects').updateOne({ _key: key }, { $unset: data });
await module.client.collection('objects').updateOne({ _key: key }, { $unset: data });
cache.delObjectCache(key);
};
@@ -189,7 +189,7 @@ module.exports = function (db, module) {
increment[field] = value;
if (Array.isArray(key)) {
var bulk = db.collection('objects').initializeUnorderedBulkOp();
var bulk = module.client.collection('objects').initializeUnorderedBulkOp();
key.forEach(function (key) {
bulk.find({ _key: key }).upsert().update({ $inc: increment });
});
@@ -199,7 +199,7 @@ module.exports = function (db, module) {
return result.map(data => data && data[field]);
}
const result = await db.collection('objects').findOneAndUpdate({ _key: key }, { $inc: increment }, { returnOriginal: false, upsert: true });
const result = await module.client.collection('objects').findOneAndUpdate({ _key: key }, { $inc: increment }, { returnOriginal: false, upsert: true });
cache.delObjectCache(key);
return result && result.value ? result.value[field] : null;
};

View File

@@ -1,6 +1,6 @@
'use strict';
module.exports = function (db, module) {
module.exports = function (module) {
var helpers = require('./helpers');
module.listPrepend = async function (key, value) {
@@ -12,7 +12,7 @@ module.exports = function (db, module) {
const exists = await module.isObjectField(key, 'array');
if (exists) {
await db.collection('objects').updateOne({ _key: key }, { $push: { array: { $each: [value], $position: 0 } } }, { upsert: true, w: 1 });
await module.client.collection('objects').updateOne({ _key: key }, { $push: { array: { $each: [value], $position: 0 } } }, { upsert: true, w: 1 });
} else {
await module.listAppend(key, value);
}
@@ -23,7 +23,7 @@ module.exports = function (db, module) {
return;
}
value = helpers.valueToString(value);
await db.collection('objects').updateOne({ _key: key }, { $push: { array: value } }, { upsert: true, w: 1 });
await module.client.collection('objects').updateOne({ _key: key }, { $push: { array: value } }, { upsert: true, w: 1 });
};
module.listRemoveLast = async function (key) {
@@ -31,7 +31,7 @@ module.exports = function (db, module) {
return;
}
const value = await module.getListRange(key, -1, -1);
db.collection('objects').updateOne({ _key: key }, { $pop: { array: 1 } });
module.client.collection('objects').updateOne({ _key: key }, { $pop: { array: 1 } });
return (value && value.length) ? value[0] : null;
};
@@ -41,7 +41,7 @@ module.exports = function (db, module) {
}
value = helpers.valueToString(value);
await db.collection('objects').updateOne({ _key: key }, { $pull: { array: value } });
await module.client.collection('objects').updateOne({ _key: key }, { $pull: { array: value } });
};
module.listTrim = async function (key, start, stop) {
@@ -49,7 +49,7 @@ module.exports = function (db, module) {
return;
}
const value = await module.getListRange(key, start, stop);
await db.collection('objects').updateOne({ _key: key }, { $set: { array: value } });
await module.client.collection('objects').updateOne({ _key: key }, { $set: { array: value } });
};
module.getListRange = async function (key, start, stop) {
@@ -57,7 +57,7 @@ module.exports = function (db, module) {
return;
}
const data = await db.collection('objects').findOne({ _key: key }, { array: 1 });
const data = await module.client.collection('objects').findOne({ _key: key }, { array: 1 });
if (!(data && data.array)) {
return [];
}
@@ -66,7 +66,7 @@ module.exports = function (db, module) {
};
module.listLength = async function (key) {
const result = await db.collection('objects').aggregate([
const result = await module.client.collection('objects').aggregate([
{ $match: { _key: key } },
{ $project: { count: { $size: '$array' } } },
]).toArray();

View File

@@ -1,12 +1,12 @@
'use strict';
module.exports = function (db, module) {
module.exports = function (module) {
module.flushdb = async function () {
await db.dropDatabase();
await module.client.dropDatabase();
};
module.emptydb = async function () {
await db.collection('objects').deleteMany({});
await module.client.collection('objects').deleteMany({});
module.objectCache.resetObjectCache();
};
@@ -15,7 +15,7 @@ module.exports = function (db, module) {
return;
}
if (Array.isArray(key)) {
const data = await db.collection('objects').find({ _key: { $in: key } }).toArray();
const data = await module.client.collection('objects').find({ _key: { $in: key } }).toArray();
var map = {};
data.forEach(function (item) {
map[item._key] = true;
@@ -23,7 +23,7 @@ module.exports = function (db, module) {
return key.map(key => !!map[key]);
}
const item = await db.collection('objects').findOne({ _key: key });
const item = await module.client.collection('objects').findOne({ _key: key });
return item !== undefined && item !== null;
};
@@ -31,7 +31,7 @@ module.exports = function (db, module) {
if (!key) {
return;
}
await db.collection('objects').deleteMany({ _key: key });
await module.client.collection('objects').deleteMany({ _key: key });
module.objectCache.delObjectCache(key);
};
@@ -39,7 +39,7 @@ module.exports = function (db, module) {
if (!Array.isArray(keys) || !keys.length) {
return;
}
await db.collection('objects').deleteMany({ _key: { $in: keys } });
await module.client.collection('objects').deleteMany({ _key: { $in: keys } });
module.objectCache.delObjectCache(keys);
};
@@ -48,7 +48,7 @@ module.exports = function (db, module) {
return;
}
const objectData = await db.collection('objects').findOne({ _key: key }, { projection: { _id: 0 } });
const objectData = await module.client.collection('objects').findOne({ _key: key }, { projection: { _id: 0 } });
// fallback to old field name 'value' for backwards compatibility #6340
var value = null;
@@ -74,17 +74,17 @@ module.exports = function (db, module) {
if (!key) {
return;
}
const result = await db.collection('objects').findOneAndUpdate({ _key: key }, { $inc: { data: 1 } }, { returnOriginal: false, upsert: true });
const result = await module.client.collection('objects').findOneAndUpdate({ _key: key }, { $inc: { data: 1 } }, { returnOriginal: false, upsert: true });
return result && result.value ? result.value.data : null;
};
module.rename = async function (oldKey, newKey) {
await db.collection('objects').updateMany({ _key: oldKey }, { $set: { _key: newKey } });
await module.client.collection('objects').updateMany({ _key: oldKey }, { $set: { _key: newKey } });
module.objectCache.delObjectCache([oldKey, newKey]);
};
module.type = async function (key) {
const data = await db.collection('objects').findOne({ _key: key });
const data = await module.client.collection('objects').findOne({ _key: key });
if (!data) {
return null;
}

View File

@@ -1,6 +1,6 @@
'use strict';
module.exports = function (db, module) {
module.exports = function (module) {
var helpers = require('./helpers');
module.setAdd = async function (key, value) {
@@ -10,7 +10,7 @@ module.exports = function (db, module) {
value = value.map(v => helpers.valueToString(v));
await db.collection('objects').updateOne({
await module.client.collection('objects').updateOne({
_key: key,
}, {
$addToSet: {
@@ -35,7 +35,7 @@ module.exports = function (db, module) {
value = value.map(v => helpers.valueToString(v));
var bulk = db.collection('objects').initializeUnorderedBulkOp();
var bulk = module.client.collection('objects').initializeUnorderedBulkOp();
for (var i = 0; i < keys.length; i += 1) {
bulk.find({ _key: keys[i] }).upsert().updateOne({ $addToSet: {
@@ -61,7 +61,7 @@ module.exports = function (db, module) {
value = value.map(v => helpers.valueToString(v));
await db.collection('objects').updateMany({ _key: Array.isArray(key) ? { $in: key } : key }, { $pullAll: { members: value } });
await module.client.collection('objects').updateMany({ _key: Array.isArray(key) ? { $in: key } : key }, { $pullAll: { members: value } });
};
module.setsRemove = async function (keys, value) {
@@ -70,7 +70,7 @@ module.exports = function (db, module) {
}
value = helpers.valueToString(value);
await db.collection('objects').updateMany({ _key: { $in: keys } }, { $pull: { members: value } });
await module.client.collection('objects').updateMany({ _key: { $in: keys } }, { $pull: { members: value } });
};
module.isSetMember = async function (key, value) {
@@ -79,7 +79,7 @@ module.exports = function (db, module) {
}
value = helpers.valueToString(value);
const item = await db.collection('objects').findOne({ _key: key, members: value }, { projection: { _id: 0, members: 0 } });
const item = await module.client.collection('objects').findOne({ _key: key, members: value }, { projection: { _id: 0, members: 0 } });
return item !== null && item !== undefined;
};
@@ -89,7 +89,7 @@ module.exports = function (db, module) {
}
values = values.map(v => helpers.valueToString(v));
const result = await db.collection('objects').findOne({ _key: key }, { projection: { _id: 0, _key: 0 } });
const result = await module.client.collection('objects').findOne({ _key: key }, { projection: { _id: 0, _key: 0 } });
const membersSet = new Set(result && Array.isArray(result.members) ? result.members : []);
return values.map(v => membersSet.has(v));
};
@@ -100,7 +100,7 @@ module.exports = function (db, module) {
}
value = helpers.valueToString(value);
const result = await db.collection('objects').find({ _key: { $in: sets }, members: value }, { projection: { _id: 0, members: 0 } }).toArray();
const result = await module.client.collection('objects').find({ _key: { $in: sets }, members: value }, { projection: { _id: 0, members: 0 } }).toArray();
var map = {};
result.forEach(function (item) {
@@ -115,7 +115,7 @@ module.exports = function (db, module) {
return [];
}
const data = await db.collection('objects').findOne({ _key: key }, { projection: { _id: 0, _key: 0 } });
const data = await module.client.collection('objects').findOne({ _key: key }, { projection: { _id: 0, _key: 0 } });
return data ? data.members : [];
};
@@ -123,7 +123,7 @@ module.exports = function (db, module) {
if (!Array.isArray(keys) || !keys.length) {
return [];
}
const data = await db.collection('objects').find({ _key: { $in: keys } }, { projection: { _id: 0 } }).toArray();
const data = await module.client.collection('objects').find({ _key: { $in: keys } }, { projection: { _id: 0 } }).toArray();
var sets = {};
data.forEach(function (set) {
@@ -137,7 +137,7 @@ module.exports = function (db, module) {
if (!key) {
return 0;
}
const data = await db.collection('objects').findOne({ _key: key }, { projection: { _id: 0 } });
const data = await module.client.collection('objects').findOne({ _key: key }, { projection: { _id: 0 } });
return data ? data.members.length : 0;
};
@@ -148,7 +148,7 @@ module.exports = function (db, module) {
};
module.setRemoveRandom = async function (key) {
const data = await db.collection('objects').findOne({ _key: key });
const data = await module.client.collection('objects').findOne({ _key: key });
if (!data) {
return;
}

View File

@@ -2,15 +2,15 @@
var utils = require('../../utils');
module.exports = function (db, module) {
module.exports = function (module) {
var helpers = require('./helpers');
const util = require('util');
const sleep = util.promisify(setTimeout);
require('./sorted/add')(db, module);
require('./sorted/remove')(db, module);
require('./sorted/union')(db, module);
require('./sorted/intersect')(db, module);
require('./sorted/add')(module);
require('./sorted/remove')(module);
require('./sorted/union')(module);
require('./sorted/intersect')(module);
module.getSortedSetRange = async function (key, start, stop) {
return await getSortedSetRange(key, start, stop, '-inf', '+inf', 1, false);
@@ -81,7 +81,7 @@ module.exports = function (db, module) {
limit = 0;
}
let data = await db.collection('objects').find(query, { projection: fields })
let data = await module.client.collection('objects').find(query, { projection: fields })
.sort({ score: sort })
.skip(start)
.limit(limit)
@@ -135,7 +135,7 @@ module.exports = function (db, module) {
query.score.$lte = max;
}
const count = await db.collection('objects').countDocuments(query);
const count = await module.client.collection('objects').countDocuments(query);
return count || 0;
};
@@ -143,7 +143,7 @@ module.exports = function (db, module) {
if (!key) {
return 0;
}
const count = await db.collection('objects').countDocuments({ _key: key });
const count = await module.client.collection('objects').countDocuments({ _key: key });
return parseInt(count, 10) || 0;
};
@@ -160,7 +160,7 @@ module.exports = function (db, module) {
return 0;
}
const count = await db.collection('objects').countDocuments({ _key: Array.isArray(keys) ? { $in: keys } : keys });
const count = await module.client.collection('objects').countDocuments({ _key: Array.isArray(keys) ? { $in: keys } : keys });
return parseInt(count, 10) || 0;
};
@@ -182,7 +182,7 @@ module.exports = function (db, module) {
return null;
}
return await db.collection('objects').countDocuments({
return await module.client.collection('objects').countDocuments({
$or: [
{
_key: key,
@@ -243,7 +243,7 @@ module.exports = function (db, module) {
return null;
}
value = helpers.valueToString(value);
const result = await db.collection('objects').findOne({ _key: key, value: value }, { projection: { _id: 0, _key: 0, value: 0 } });
const result = await module.client.collection('objects').findOne({ _key: key, value: value }, { projection: { _id: 0, _key: 0, value: 0 } });
return result ? result.score : null;
};
@@ -252,7 +252,7 @@ module.exports = function (db, module) {
return [];
}
value = helpers.valueToString(value);
const result = await db.collection('objects').find({ _key: { $in: keys }, value: value }, { projection: { _id: 0, value: 0 } }).toArray();
const result = await module.client.collection('objects').find({ _key: { $in: keys }, value: value }, { projection: { _id: 0, value: 0 } }).toArray();
var map = {};
result.forEach(function (item) {
if (item) {
@@ -271,7 +271,7 @@ module.exports = function (db, module) {
return [];
}
values = values.map(helpers.valueToString);
const result = await db.collection('objects').find({ _key: key, value: { $in: values } }, { projection: { _id: 0, _key: 0 } }).toArray();
const result = await module.client.collection('objects').find({ _key: key, value: { $in: values } }, { projection: { _id: 0, _key: 0 } }).toArray();
var valueToScore = {};
result.forEach(function (item) {
@@ -288,7 +288,7 @@ module.exports = function (db, module) {
return;
}
value = helpers.valueToString(value);
const result = await db.collection('objects').findOne({ _key: key, value: value }, { projection: { _id: 0, _key: 0, score: 0 } });
const result = await module.client.collection('objects').findOne({ _key: key, value: value }, { projection: { _id: 0, _key: 0, score: 0 } });
return !!result;
};
@@ -297,7 +297,7 @@ module.exports = function (db, module) {
return;
}
values = values.map(helpers.valueToString);
const results = await db.collection('objects').find({ _key: key, value: { $in: values } }, { projection: { _id: 0, _key: 0, score: 0 } }).toArray();
const results = await module.client.collection('objects').find({ _key: key, value: { $in: values } }, { projection: { _id: 0, _key: 0, score: 0 } }).toArray();
var isMember = {};
results.forEach(function (item) {
@@ -314,7 +314,7 @@ module.exports = function (db, module) {
return [];
}
value = helpers.valueToString(value);
const results = await db.collection('objects').find({ _key: { $in: keys }, value: value }, { projection: { _id: 0, score: 0 } }).toArray();
const results = await module.client.collection('objects').find({ _key: { $in: keys }, value: value }, { projection: { _id: 0, score: 0 } }).toArray();
var isMember = {};
results.forEach(function (item) {
@@ -331,7 +331,7 @@ module.exports = function (db, module) {
return [];
}
const data = await db.collection('objects').find({
const data = await module.client.collection('objects').find({
_key: keys.length === 1 ? keys[0] : { $in: keys },
}, { projection: { _id: 0, score: 0 } }).sort({ score: 1 }).toArray();
@@ -353,7 +353,7 @@ module.exports = function (db, module) {
data.score = parseFloat(increment);
try {
const result = await db.collection('objects').findOneAndUpdate({ _key: key, value: value }, { $inc: data }, { returnOriginal: false, upsert: true });
const result = await module.client.collection('objects').findOneAndUpdate({ _key: key, value: value }, { $inc: data }, { returnOriginal: false, upsert: true });
return result && result.value ? result.value.score : null;
} catch (err) {
// if there is duplicate key error retry the upsert
@@ -386,7 +386,7 @@ module.exports = function (db, module) {
count = count !== undefined ? count : 0;
buildLexQuery(query, min, max);
const data = await db.collection('objects').find(query, { projection: { _id: 0, _key: 0, score: 0 } })
const data = await module.client.collection('objects').find(query, { projection: { _id: 0, _key: 0, score: 0 } })
.sort({ value: sort })
.skip(start)
.limit(count === -1 ? 0 : count)
@@ -399,7 +399,7 @@ module.exports = function (db, module) {
var query = { _key: key };
buildLexQuery(query, min, max);
await db.collection('objects').deleteMany(query);
await module.client.collection('objects').deleteMany(query);
};
function buildLexQuery(query, min, max) {
@@ -432,7 +432,7 @@ module.exports = function (db, module) {
if (!options.withScores) {
project.score = 0;
}
var cursor = await db.collection('objects').find({ _key: setKey }, { projection: project })
var cursor = await module.client.collection('objects').find({ _key: setKey }, { projection: project })
.sort({ score: 1 })
.batchSize(options.batch);

View File

@@ -1,6 +1,6 @@
'use strict';
module.exports = function (db, module) {
module.exports = function (module) {
var helpers = require('../helpers');
var utils = require('../../../utils');
@@ -17,7 +17,7 @@ module.exports = function (db, module) {
value = helpers.valueToString(value);
try {
await db.collection('objects').updateOne({ _key: key, value: value }, { $set: { score: parseFloat(score) } }, { upsert: true, w: 1 });
await module.client.collection('objects').updateOne({ _key: key, value: value }, { $set: { score: parseFloat(score) } }, { upsert: true, w: 1 });
} catch (err) {
if (err && err.message.startsWith('E11000 duplicate key error')) {
return await module.sortedSetAdd(key, score, value);
@@ -40,7 +40,7 @@ module.exports = function (db, module) {
}
values = values.map(helpers.valueToString);
var bulk = db.collection('objects').initializeUnorderedBulkOp();
var bulk = module.client.collection('objects').initializeUnorderedBulkOp();
for (var i = 0; i < scores.length; i += 1) {
bulk.find({ _key: key, value: values[i] }).upsert().updateOne({ $set: { score: parseFloat(scores[i]) } });
}
@@ -62,7 +62,7 @@ module.exports = function (db, module) {
value = helpers.valueToString(value);
var bulk = db.collection('objects').initializeUnorderedBulkOp();
var bulk = module.client.collection('objects').initializeUnorderedBulkOp();
for (var i = 0; i < keys.length; i += 1) {
bulk.find({ _key: keys[i], value: value }).upsert().updateOne({ $set: { score: parseFloat(isArrayOfScores ? scores[i] : scores) } });
}
@@ -73,7 +73,7 @@ module.exports = function (db, module) {
if (!Array.isArray(data) || !data.length) {
return;
}
var bulk = db.collection('objects').initializeUnorderedBulkOp();
var bulk = module.client.collection('objects').initializeUnorderedBulkOp();
data.forEach(function (item) {
bulk.find({ _key: item[0], value: String(item[2]) }).upsert().updateOne({ $set: { score: parseFloat(item[1]) } });
});

View File

@@ -1,6 +1,6 @@
'use strict';
module.exports = function (db, module) {
module.exports = function (module) {
module.sortedSetIntersectCard = async function (keys) {
if (!Array.isArray(keys) || !keys.length) {
return 0;
@@ -13,7 +13,7 @@ module.exports = function (db, module) {
{ $group: { _id: null, count: { $sum: 1 } } },
];
const data = await db.collection('objects').aggregate(pipeline).toArray();
const data = await module.client.collection('objects').aggregate(pipeline).toArray();
return Array.isArray(data) && data.length ? data[0].count : 0;
};
@@ -87,7 +87,7 @@ module.exports = function (db, module) {
}
pipeline.push({ $project: project });
let data = await db.collection('objects').aggregate(pipeline).toArray();
let data = await module.client.collection('objects').aggregate(pipeline).toArray();
if (!params.withScores) {
data = data.map(item => item.value);

View File

@@ -1,6 +1,6 @@
'use strict';
module.exports = function (db, module) {
module.exports = function (module) {
var helpers = require('../helpers');
module.sortedSetRemove = async function (key, value) {
@@ -18,7 +18,7 @@ module.exports = function (db, module) {
value = helpers.valueToString(value);
}
await db.collection('objects').deleteMany({
await module.client.collection('objects').deleteMany({
_key: Array.isArray(key) ? { $in: key } : key,
value: isValueArray ? { $in: value } : value,
});
@@ -30,7 +30,7 @@ module.exports = function (db, module) {
}
value = helpers.valueToString(value);
await db.collection('objects').deleteMany({ _key: { $in: keys }, value: value });
await module.client.collection('objects').deleteMany({ _key: { $in: keys }, value: value });
};
module.sortedSetsRemoveRangeByScore = async function (keys, min, max) {
@@ -49,14 +49,14 @@ module.exports = function (db, module) {
query.score.$lte = parseFloat(max);
}
await db.collection('objects').deleteMany(query);
await module.client.collection('objects').deleteMany(query);
};
module.sortedSetRemoveBulk = async function (data) {
if (!Array.isArray(data) || !data.length) {
return;
}
var bulk = db.collection('objects').initializeUnorderedBulkOp();
var bulk = module.client.collection('objects').initializeUnorderedBulkOp();
data.forEach(item => bulk.find({ _key: item[0], value: String(item[1]) }).remove());
await bulk.execute();
};

View File

@@ -1,12 +1,12 @@
'use strict';
module.exports = function (db, module) {
module.exports = function (module) {
module.sortedSetUnionCard = async function (keys) {
if (!Array.isArray(keys) || !keys.length) {
return 0;
}
const data = await db.collection('objects').aggregate([
const data = await module.client.collection('objects').aggregate([
{ $match: { _key: { $in: keys } } },
{ $group: { _id: { value: '$value' } } },
{ $group: { _id: null, count: { $sum: 1 } } },
@@ -61,7 +61,7 @@ module.exports = function (db, module) {
}
pipeline.push({ $project: project });
let data = await db.collection('objects').aggregate(pipeline).toArray();
let data = await module.client.collection('objects').aggregate(pipeline).toArray();
if (!params.withScores) {
data = data.map(item => item.value);
}

View File

@@ -1,8 +1,8 @@
'use strict';
module.exports = function (db, module) {
module.exports = function (module) {
// TODO
module.transaction = function (perform, callback) {
perform(db, callback);
perform(module.client, callback);
};
};