Search code examples
scalaquill

Scala, Quill - how to compare values with case-insensitive?


I created a quill query, which should find some data in database by given parameter:

val toFind = "SomeName"
val query = query.find(value => infix"$value = ${lift(toFind)}".as[Boolean])

It works fine when for example I have data in database "SomeName", but if I want to have same results by passing there "somename" I found nothing. The problem is with data case-sensitive. Is it possible to always find values with case-insensitive way? In quill docs I have not found anything about it.


Solution

  • Ok, I found a solution. It is enough to add LOWER() sql function to infix:

    val query = query.find(value => infix"LOWER($value) = ${lift(toFind.toLowerCase)}".as[Boolean])