UNPKG

dobo-knex

Version:
11 lines (9 loc) 319 B
async function applyFulltext (data, match) { const { forOwn, isEmpty } = this.app.lib._ const matches = [] forOwn(match, (v, k) => { if (!isEmpty(v)) matches.push(`@${k} ${v.join(' ')}`) }) if (!isEmpty(matches)) data.andWhereRaw(`match('${matches.join(' ')}')`) } export default applyFulltext