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) {
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);