|
|
@ -92,9 +92,10 @@ const appendWhereCondition = function( |
|
|
|
knexRef, |
|
|
|
knexRef, |
|
|
|
isHaving = false |
|
|
|
isHaving = false |
|
|
|
) { |
|
|
|
) { |
|
|
|
|
|
|
|
const clientType = knexRef?.client?.config?.client; |
|
|
|
const opMapping = { |
|
|
|
const opMapping = { |
|
|
|
...opMappingGen, |
|
|
|
...opMappingGen, |
|
|
|
...(knexRef?.client?.config?.client === 'pg' ? { like: 'ilike' } : {}) |
|
|
|
...(clientType === 'pg' ? { like: 'ilike' } : {}) |
|
|
|
}; |
|
|
|
}; |
|
|
|
const camKey = isHaving ? 'Having' : 'Where'; |
|
|
|
const camKey = isHaving ? 'Having' : 'Where'; |
|
|
|
const key = isHaving ? 'having' : 'where'; |
|
|
|
const key = isHaving ? 'having' : 'where'; |
|
|
@ -430,11 +431,19 @@ const appendWhereCondition = function( |
|
|
|
); |
|
|
|
); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case '': |
|
|
|
case '': |
|
|
|
knexRef[`${key}`]( |
|
|
|
const column = columnAliases[matches[2]] || matches[2]; |
|
|
|
columnAliases[matches[2]] || matches[2], |
|
|
|
const operator = opMapping[matches[3]]; |
|
|
|
opMapping[matches[3]], |
|
|
|
const target = matches[4]; |
|
|
|
matches[4] |
|
|
|
if (matches[3] == 'like' && clientType === 'pg') { |
|
|
|
); |
|
|
|
// handle uuid case
|
|
|
|
|
|
|
|
knexRef[`${key}`]( |
|
|
|
|
|
|
|
knexRef?.client.raw(`??::TEXT ${operator} '${target}'`, [ |
|
|
|
|
|
|
|
column |
|
|
|
|
|
|
|
]) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
knexRef[`${key}`](column, operator, target); |
|
|
|
|
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
throw new Error(`${matches[1] || ''} Invalid operation.`); |
|
|
|
throw new Error(`${matches[1] || ''} Invalid operation.`); |
|
|
@ -991,6 +1000,7 @@ export { Knex }; |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Naveen MR <oof1lab@gmail.com> |
|
|
|
* @author Naveen MR <oof1lab@gmail.com> |
|
|
|
* @author Pranav C Balan <pranavxc@gmail.com> |
|
|
|
* @author Pranav C Balan <pranavxc@gmail.com> |
|
|
|
|
|
|
|
* @author Wing-Kam Wong <wingkwong.code@gmail.com> |
|
|
|
* |
|
|
|
* |
|
|
|
* @license GNU AGPL version 3 or any later version |
|
|
|
* @license GNU AGPL version 3 or any later version |
|
|
|
* |
|
|
|
* |
|
|
|