How do I filter rows in Slick if a column is null?
val employees = Queryable[Employees]
// Error
val query = employees.filter( _.terminationDate == Nil )
Might be important to note that
terminationDate: Option[String]
I am using Direct Embedding.
Slick has its own why of checking for null values in a column:
val query = employees.filter(_.terminationDate.isNull)
The opposite is isNotNull
.
Or in newer versions of Slick:
val query = employees.filter(_.terminationDate.isEmpty)
and
val query = employees.filter(_.terminationDate.isDefined)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With