2017-09-13 53 views
1

我的问题是:如何创建一个漂亮的编译的查询等同于以下SQL:斯卡拉油滑编译的查询相当于“select * from表,其中词(字)”

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。 Scala 2.12.3

回答