在 slick 的文档中,据说这java.sql.Blob
是开箱即用支持的类型之一,我正在尝试使用它来表示bytea
列。但是下面的代码给了我一个错误:
import scala.slick.driver.PostgresDriver.simple._
import java.sql.{ Timestamp, Blob }
case class Test(id: Int, last_updated: Timestamp, data: Blob)
class Tests(tag: Tag) extends Table[Test](tag, "tests") {
def data = column[Blob]("data")
def last_updated = column[Timestamp]("last_updated")
def id = column[Int]("id", O.PrimaryKey)
def * = (id, last_updated, data)
}
错误信息是:
Multiple markers at this line
- No matching Shape found. Slick does not know how to map the given types. Possible causes: T in Table[T] does not match your * projection. Or you use an unsupported
type in a Query (e.g. scala List). Required level: scala.slick.lifted.ShapeLevel.Flat Source type: (scala.slick.lifted.Column[Int], scala.slick.lifted.Column[java.sql.Timestamp],
scala.slick.lifted.Column[java.sql.Blob]) Unpacked type: utils.Test Packed type: Any
- implements scala.slick.lifted.AbstractTable.$times
- type mismatch; found : (scala.slick.lifted.Column[Int], scala.slick.lifted.Column[java.sql.Timestamp], scala.slick.lifted.Column[java.sql.Blob]) required:
scala.slick.lifted.ProvenShape[utils.Test]
- type mismatch; found : (scala.slick.lifted.Column[Int], scala.slick.lifted.Column[java.sql.Timestamp], scala.slick.lifted.Column[java.sql.Blob]) required:
scala.slick.lifted.ProvenShape[utils.Test]
发生了什么事,我怎样才能正确地bytea
用 slick 表示?