Dynamic OR filtering - Slick

前端 未结 2 1352
执笔经年
执笔经年 2021-01-15 14:12

Ok, I\'ve got a method with multiple optional arguments like this

def(username: Option[String], petname: Option[String], favouritefood: Option[String])
         


        
2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-15 14:56

    The thoefer is nice for simple use cases but has some limits. Like if all your options are None's the list is empty and you can't reduce an empty list :)

    If you need something more composable, based on predicate, conjunctions and disjunctions (a bit like Hibernate/JPA Criteria API), you can check my answer in Slick: create query conjunctions/disjunctions dynamically

提交回复
热议问题