dimanche 19 avril 2015

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.

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):

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. However, I'm getting the following compilation error on the def json = line:

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)

Aucun commentaire:

Enregistrer un commentaire