1
我正在尝试使用Slick的贴图投影(版本1.0.0-RC1)。但下面的代码,以下的网站上的例子(因为似乎没有是任何适当的文件,也没有可用scaladocs)产生了一个类型错误:尝试使用Slick的映射投影时输入错误
object PDFDocs extends Table[(String,Option[String],String)]("DOCUMENTS"){
def id = column[String]("ID", O.PrimaryKey)
def title = column[Option[String]]("TITLE")
def tags = column[String]("TAGS")
def * = (id ~ title ~ tags).<>[PDFDocument](PDFDocument,PDFDocument unapply _)
}
case class PDFDocument(name: String,
title: Option[String],
tags: String)
这里是产生错误:
error: type mismatch;
found: scala.slick.lifted.MappedProjection[docman.rdb.PDFDocument,(String,Option[String], String)]
required: scala.slick.lifted.ColumnBase[(String, Option[String], String)]
def * = (id ~ title ~ tags).<>[PDFDocument](PDFDocument,PDFDocument unapply _)
这就是“甚至”漂亮和作品。谢谢,我在示例中忽略了这一点。 – ziggystar
+1刚刚发生在我身上的同样的问题,谢谢:) – stephanos
+100。我一直在寻找答案,我看到的所有样本都有基于成员参数化的表类,而不是整个模型案例类。我整天都把头撞在墙上。谢谢。 –