Scala Slick 编译查询等同于 "select * from table where word in (words)"
Scala Slick compiled query equivalent to "select * from table where word in (words)"
我的问题是:如何创建等同于以下内容的 Slick 编译查询 SQL:
select * from table where word in ('word1', 'word2', 'word3')
我目前遇到的代码如下所示:
val findByWords = Compiled { words: Set[String] =>
keywords.filter(_.word inSet words)
}
编译时出现如下错误:
Computation of type Set[String] => slick.lifted.Query[com.company.business.db.CensoredKeyWords,com.company.business.db.CensoredKeyWords#TableElementType,Seq] cannot be compiled (as type C)
val findByWords = Compiled { words: Set[String] =>
^
注意箭头指向花括号。
我正在使用 Slick 3.2.1。斯卡拉 2.12.3
好像不能用inSet编译。
查看此处的解释:https://groups.google.com/forum/#!msg/scalaquery/2d_r4DEthfY/QqhtrR9mJdcJ
我的问题是:如何创建等同于以下内容的 Slick 编译查询 SQL:
select * from table where word in ('word1', 'word2', 'word3')
我目前遇到的代码如下所示:
val findByWords = Compiled { words: Set[String] =>
keywords.filter(_.word inSet words)
}
编译时出现如下错误:
Computation of type Set[String] => slick.lifted.Query[com.company.business.db.CensoredKeyWords,com.company.business.db.CensoredKeyWords#TableElementType,Seq] cannot be compiled (as type C) val findByWords = Compiled { words: Set[String] => ^
注意箭头指向花括号。
我正在使用 Slick 3.2.1。斯卡拉 2.12.3
好像不能用inSet编译。
查看此处的解释:https://groups.google.com/forum/#!msg/scalaquery/2d_r4DEthfY/QqhtrR9mJdcJ