How to make the filter "OR" in the spot
In slick we can use
query.filter( m => (m.state === state1 && m.status === status1) || (m.state === state2 && m.status == status2)) for the OR clause in the where clause. However, my requirement is that I have an βORβ condition in the list (passed by the user as part of the URL). The list of conditions includes tuples of state and type status
List[(state1, status1),(state2, status2),(state3, status3)] So I wanted to either be able to build || inside the filter so that I can use each of the conditions from the list to generate a request, but I'm not sure how to achieve this. Or if there is something like
query.applyOrFilters.orFilter(condition1).orFilter(condition2) which actually fulfills condition 1 OR condition 2 in the request object. Is this possible with Slick or for understanding at the moment?
While playing with him, I finally found a way to do this: -
query.filter { m => conditions.map(n => m._13 === n._1 && m._14 === n._2).reduceLeft(_ || _) } where conditions is of the form List[(String,String)] , m._13 displays the status and m._14 displays the status.
Hope this helps someone experience the same thing.