right usage of slick filter

血红的双手。 提交于 2019-12-04 09:15:26
cvogt

Use slick.lifted.LiteralColumn(true)

Scala's type infer limitation

As it is mentioned in this answer, you can use the following API since Slick 3.3.0:

def findCouponBy(couponId: Long, shopId: Option[String]) = {
  val query = 
    this
      .filter(_.couponId === couponId)
      .filterOpt(shopId){ case (table, sid) =>
        table.filter(_.shopId === sid)
      }

  db run query.result
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!