我正在为 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