📅  最后修改于: 2022-03-11 15:04:11.448000             🧑  作者: Mango
public async getFilteredItems(searchCriteria): Promise {
const table = 'items';
const columns = ['itemName', 'itemType', 'category'];
const qb = (query) => {
for (const col of columns) {
query.orWhere(`${table}.${col}`, 'like', `%${searchCriteria[col]}%`);
}
}
return await knex(table).where(qb);
}