2017-09-13 58 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

回答