【发布时间】:2014-05-27 08:15:12
【问题描述】:
我只是想检查是否存在满足某些条件的行:
// 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)并检查它的长度,但我不应该这样做。我在列上找不到任何方法来帮助我提取值。
【问题讨论】: