使用Slick-pg时,无法找到类似TimeStamp日期和点的类型

时间:2015-04-15 12:16:14

标签: postgresql scala slick slick-2.0

我正在使用slick-pg来访问像Point这样的类型。 但是在关注github页面使用部分的示例之后,我仍然无法获得像Point类这样的访问类型。

这就是我所拥有的

CustomPostgresDriver.scala

package app.utils

import slick.driver.PostgresDriver
import com.github.tminglei.slickpg._

trait CustomPostgresDriver extends PostgresDriver
with PgArraySupport
with PgDateSupport
with PgRangeSupport
with PgHStoreSupport
with PgPlayJsonSupport
with PgSearchSupport
with PgPostGISSupport {
  override val pgjson = "jsonb" //to keep back compatibility, pgjson's value was "json" by default

  override lazy val Implicit = new ImplicitsPlus {}
  override val simple = new SimpleQLPlus {}

  //////
  trait ImplicitsPlus extends Implicits
  with ArrayImplicits
  with DateTimeImplicits
  with RangeImplicits
  with HStoreImplicits
  with JsonImplicits
  with SearchImplicits
  with PostGISImplicits

  trait SimpleQLPlus extends SimpleQL
  with ImplicitsPlus
  with SearchAssistants
  with PostGISAssistants
}

object CustomPostgresDriver extends CustomPostgresDriver

Users.scala

package app.models

import app.utils.CustomPostgresDriver.simple._

case class User(
    id              : Long,
    firstName       : String,
    lastName        : String,
    phone           : String,
    lat             : Point,
    long            : Point,
    updatedAt       : Timestamp,
    createdAt       : Timestamp,
)

class Users(tag: Tag) extends Table[User](tag, "USERS") {
    def id        = column[Long]("USER_ID", O.PrimaryKey, O.AutoInc)
    def firstName = column[String]("FIRST_NAME", O.NotNull)
    def lastName  = column[String]("LAST_NAME", O.NotNull)
    def phone     = column[String]("PHONE_NUMBER", O.NotNull)
    def lat       = column[Point]("LATITUDE", O.NotNull)
    def long      = column[Point]("LONGITUDE", O.NotNull)
    def updatedAt = column[Timestamp]("UPDATED_AT")
    def createdAt = column[Timestamp]("CREATED_AT")
    def *         = (id.?, firstName, lastName, phone, lat, long, updatedAt, createdAt) <> (User.tupled, User.unapply)
}

val users = TableQuery[Users]

但找不到Point,intellij给出的建议时间戳为java.sql.Timestamp

我做错了什么? 这已经阻止了我好几天了,任何帮助都会非常感激。 谢谢大家

1 个答案:

答案 0 :(得分:0)

您的代码无法找到明显的问题,请提供更多详细信息。

但你最好在github slick-pg 中提出问题,因为我无法始终成功访问stackoverflow,这在我们国家/地区经常被阻止。