[英]Missing implicit TypedType[JsonString] with slick-pg
I am using slick-pg 0.8.2 with Slick 2.1.0 and am having problems with a JSON-typed column. 我在Slick 2.1.0中使用slick-pg 0.8.2,并且在JSON类型的列上遇到问题。
My Driver is defined as follows: 我的驱动程序定义如下:
trait PgsqlDriver extends PostgresDriver
with PgJsonSupport
with array.PgArrayJdbcTypes
with PgDateSupportJoda
with PgSearchSupport {
override val pgjson = "jsonb"
override lazy val Implicit = new ImplicitsPlus { }
override val simple = new SimpleQLPlus {}
trait ImplicitsPlus extends Implicits
with DateTimeImplicits
with JsonImplicits
with SearchImplicits
trait SimpleQLPlus extends SimpleQL
with ImplicitsPlus
with SearchAssistants
}
object PgsqlDriver extends PostgresDriver
This is my Table class (it's abstract since I have several tables with the same structure and I subclass from this one): 这是我的Table类(这是抽象的,因为我有几个结构相同的表,并且我从这个表中继承了子类):
private[ pgsql ] abstract class PgsqlTable[ D <: DomainObject[ D ] ](tag: Tag, tableName: String)
extends Table[ JsonBean ](tag, tableName) {
import PgsqlDriver.simple._
def id = column[ String ]("ID", O.PrimaryKey)
def json = column[ JsonString ]("JSON", O.NotNull)
override def * = (id, json) <> (JsonBean.tupled, JsonBean.unapply)
}
As far as I can see, this is all according to the tests, examples and the docs on the slick-pg site. 据我所知,所有这些都是根据slick-pg网站上的测试,示例和文档完成的。 However, I'm getting the following compilation error on the
def json =
line: 但是,在
def json =
行上出现以下编译错误:
Error:(23, 34) could not find implicit value for parameter tm: scala.slick.ast.TypedType[com.github.tminglei.slickpg.JsonString]
def json = column[ JsonString ]("JSON", O.NotNull)
^
Got it! 得到它了! My problem was in the last line,
object PgsqlDriver extends PostgresDriver
instead of extends PgsqlDriver
. 我的问题是在最后一行,
object PgsqlDriver extends PostgresDriver
而不是extends PgsqlDriver
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.