Untitled
unknown
javascript
3 years ago
391 B
6
Indexable
const whereClause = $filters$
.map(({ field, value, exactMatch }) => {
let operator = '=';
let useValue = value;
if (!exactMatch) {
operator = 'LIKE';
useValue = `%${useValue}%`;
}
if (typeof(value) === 'string')
useValue = `'${useValue}'`;
const result = `${field} ${operator} ${useValue}`;
return result;
})
.join(' AND ');
whereClause;
Editor is loading...