How to make SQL "NOT LIKE" in Slick

I am new to both Scala and Slick. The query "LIKE" was easy to do.

query.filter(_.name like "%kjelle%") 

but I don’t have time to make the request "DOES NOT LIKE". I couldn’t find an operator that wasn’t like, so my first thought was to try

 query.filter(_.name !like "%kjelle%") 

or

 query.filter(!(_.name like "%kjelle%")) 

but without success.

How can I do this in Slick?

+6
source share
1 answer

You can try using filterNot :

 query.filterNot(_.name like "%kjelle%") 
+6
source

Source: https://habr.com/ru/post/985936/


All Articles