2
我只是想檢查是否符合特定條件的行存在:如何提取浮動聚合查詢的結果?
// Method defined on type T
def exists(some_data : Long, other_data : Long) : Boolean = DB.withSession { implicit session : Session =>
(for {
row <- table // table is a Table[T]
if row.some_data =!= some_data
if row.other_data === other_data
} yield row).length > 0
}
我收到此錯誤:
polymorphic expression cannot be instantiated to expected type;
[error] found : [R]scala.slick.lifted.Column[R]
[error] required: Boolean
任何想法是怎麼回事?現在我只是把結果變成一個scala列表(而不是.length
,我有.list.length
)並檢查它的長度,但我不應該那樣做。我無法在列上找到任何方法來幫助我提取值。