【发布时间】:2018-02-22 10:54:58
【问题描述】:
我的问题是:如何创建与以下 SQL 等效的 Slick 编译查询:
select * from table where word in ('word1', 'word2', 'word3')
我目前遇到的代码如下所示:
val findByWords = Compiled { words: Set[String] =>
keywords.filter(_.word inSet words)
}
编译时出现如下错误:
Set[String] => slick.lifted.Query[com.company.business.db.CensoredKeyWords,com.company.business.db.CensoredKeyWords#TableElementType,Seq] 类型的计算无法编译(作为类型 C) val findByWords = 已编译 { 字词:Set[String] => ^注意箭头指向一个花括号。
我使用的是 Slick 3.2.1。斯卡拉 2.12.3
【问题讨论】: