0

我正在为 postgres 使用 pg-slick 扩展。我尝试在 where 子句中进行计算,但我没有得到它的工作。它总是说:

value - is not a member of java.sql.Timestamp

过滤子句:

 .filter(r => Timestamp.from(Instant.now()) - r.lastActivity < Duration.ofMinutes(30))

lastActivity 是:

def lastActivity = column[Timestamp]("last_activity")

我的 postgres 驱动程序是:

trait MyPostgresDriver extends ExPostgresProfile
  with PgPostGISSupport
  with PgDate2Support
  with PgEnumSupport {

  override val api: API = new API {}

  ///
  trait API extends super.API
    with PostGISImplicits
    with DateTimeImplicits
    with PostGISAssistants {
  }
}
object MyPostgresDriver extends MyPostgresDriver
4

1 回答 1

0

添加:

val plainAPI = new API
    with Date2DateTimePlainImplicits {}

似乎解决了这个问题。也不要忘记添加with DateTimeImplicitswith PgDateSupport

于 2017-07-29T07:09:39.633 回答