Работа над WebWorker и DbSearcher

This commit is contained in:
Book Pauk
2022-08-18 18:54:56 +07:00
parent 61975b6f2b
commit 676e6f6909
4 changed files with 303 additions and 10 deletions

28
server/core/DbSearcher.js Normal file
View File

@@ -0,0 +1,28 @@
class DbSearcher {
constructor(db) {
this.db = db;
}
async search(query) {
const db = this.db;
let result = [];
if (query.author) {
//
} else {
result = await db.select({
table: 'author',
map: `(r) => ({id: r.id, author: r.author})`
});
}
if (query.limit) {
result = result.slice(0, query.limit);
}
return result;
}
}
module.exports = DbSearcher;