1
0
Fork 0
mirror of synced 2024-07-03 05:20:32 +12:00

make SQL startsWith queries case insensitive

This commit is contained in:
Martin McKeaveney 2021-08-20 15:20:52 +01:00
parent 3f705ebe98
commit e7f8454ad7
2 changed files with 2 additions and 2 deletions

View file

@ -52,7 +52,7 @@ function addFilters(
if (filters.string) {
iterate(filters.string, (key, value) => {
const fnc = allOr ? "orWhere" : "where"
query = query[fnc](key, "like", `${value}%`)
query = query[fnc](key, "ilike", `${value}%`)
})
}
if (filters.range) {

View file

@ -82,7 +82,7 @@ describe("SQL query builder", () => {
}))
expect(query).toEqual({
bindings: ["John%", limit],
sql: `select * from "${TABLE_NAME}" where "${TABLE_NAME}"."name" like $1 limit $2`
sql: `select * from "${TABLE_NAME}" where "${TABLE_NAME}"."name" ilike $1 limit $2`
})
})