通过 greaterEqual 或 smallerEqual 平滑过滤 nscala-time DateTime

Slick filter nscala-time DateTime by greaterEqual or smallerEqual

我正在尝试使用 Slick

过滤 nscala-time DateTime
package models.repositories.tables

import java.sql.Timestamp
import com.github.nscala_time.time.Imports._
import models.entities.User
import slick.lifted.ProvenShape
import slick.jdbc.MySQLProfile.api._

class UserTable (tag: Tag)  extends Table[User](tag, "users") {
  def id = column[Long]("id", O.PrimaryKey, O.AutoInc)
  def name = column[String]("name")
  def createdAt = column[DateTime]("createdAt", O.SqlType("TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP"))
  def updatedAt = column[DateTime]("updatedAt", O.SqlType("TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP"))
  override def * : ProvenShape[User] = (
    id,
    name,
    createdAt,
    updatedAt
  ) <> (User.tupled, User.unapply)
}

object UserTable extends GenericTableQuery[User, UserTable] {
  val userQuery = tableQuery

  implicit def dateTimeMapping: BaseColumnType[DateTime] = MappedColumnType.base[DateTime, Timestamp](
    dateTime => new Timestamp(dateTime.getMillis),
    timeStamp => new DateTime(timeStamp.getTime)
  )

}

但是当我尝试使用

进行过滤时
def getUsers(from: DateTime, end: DateTime, offset: Int) = {
  val usersQuery = UserTable.userQuery.filter(p => p.createdAt >= from && p.createdAt <= end).sortBy(_.createdAt.desc)
  users.drop(offset).take(25)
}

我得到符号>=<=无法解析

我只需要在需要使用它的地方显式导入 implicit def dateTimeMapping

import models.repositories.tables.UserTable.dateTimeMapping