![](/img/trans.png)
[英]Error:could not find implicit value for parameter p: scala.slick.jdbc.SetParameter[java.util.UUID]
[英]implicit value for slick.jdbc.SetParameter[List[Int]]
我有一個由 PostgreSQL 支持的原始光滑查詢。 我想運行這樣的查詢: select something from my_table where action in (1,2,3)
。 注意 action 是my_table
一個integer
字段
我在下面的方法中遇到編譯錯誤:
找不到參數 e 的隱式值:slick.jdbc.SetParameter[List[Int]]
def myMethod(actions: List[Int]]) {
sql"""select something from my_table
where action in (${actions})""".as[MyType]
}
題
如何顯式設置List[Int]
參數以便我可以成功運行in
查詢?
嘗試
def myMethod(actions: List[Int]) =
sql"""select something from my_table
where action in #${actions.mkString("(", ",", ")")}""".as[MyType]
http://slick.lightbend.com/doc/3.3.0/sql.html#splicing-literal-values
使用 slick-postgreSQL 擴展: https : //github.com/tminglei/slick-pg
更多信息: 如何將數組傳遞給光滑的 SQL 純查詢?
implicit val setIntArray: SetParameter[Array[Int]] = mkArraySetParameter[Int](...)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.