繁体   English   中英

编译表定义时出现光滑错误:无法找到参数tm的隐含值

[英]Slick error while compiling table definitions: could not find implicit value for parameter tm

我对Slick来说是全新的。 我试图创建一个基本的表类型,但它只是不编译。 这是我的代码:

import scala.slick.driver.PostgresDriver._
import scala.slick.lifted.Tag
import scala.slick.lifted.Column
import scala.slick.lifted.ProvenShape

class Documents(tag: Tag) extends Table[(Long, String, String)](tag, "DOCUMENTS") {
       def id: Column[Long] = column[Long]("ID", O.PrimaryKey)
       def `type`: Column[String] = column[String]("TYPE")
       def data: Column[String] = column[String]("DATA")

       def * : ProvenShape[(Long, String, String)] = (id, `type`, data)
}

我收到这些错误:

<console>:13: error: could not find implicit value for parameter tm: scala.slick.ast.TypedType[Long]
              def id: Column[Long] = column[Long]("ID", O.PrimaryKey)
                                           ^
<console>:14: error: could not find implicit value for parameter tm: scala.slick.ast.TypedType[String]
              def `type`: Column[String] = column[String]("TYPE")
                                                   ^
<console>:15: error: could not find implicit value for parameter tm: scala.slick.ast.TypedType[String]
              def data: Column[String] = column[String]("DATA")
                                                 ^

光滑2

好的,我在写这个问题时已经解决了。 使用

import scala.slick.driver.PostgresDriver.simple._

代替

import scala.slick.driver.PostgresDriver._


更新:感谢@lost_trekkie

对于Slick 3使用:

import slick.driver.PostgresDriver.api._


更新:感谢Dmytro Mitin

油滑3.2 slick.driver.PostgresDriver已过时, slick.jdbc.PostgresProfile应该使用:

import slick.jdbc.PostgresProfile.api._

仅供参考,使用Slick 3,上面提到的导入应该是

 import slick.driver.PostgresDriver.api._

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM