Criteria4s is a simple domain-specific language (DSL) to define criteria and predicate expressions for any data stores by using Scala type class mechanisms in a type-safe way. It pretends to be agnostic to any data store, and it is extensible to support any kind of data stores.
If you use a sub-type of SQL criteria tag, for a simple expression like col[T]("id") === lit(1) you got the following representation: (id = '1'). However, if you inject that expression after a where sql, like s"WHERE ${col[T]("id") === lit(1)}" you will get WHERE (id = '1'), and its will fail.
The problem is that you just use parenthesis when needs to operate two predicates by using a conjunction operator (or /and).
If you use a sub-type of SQL criteria tag, for a simple expression like
col[T]("id") === lit(1)
you got the following representation:(id = '1')
. However, if you inject that expression after awhere
sql, likes"WHERE ${col[T]("id") === lit(1)}"
you will getWHERE (id = '1')
, and its will fail.The problem is that you just use parenthesis when needs to operate two predicates by using a conjunction operator (or /and).