1

Slickのマップされたプロジェクション(バージョン1.0.0-RC1)を使用しようとしています。ただし、Webサイトの例に従う次のコード(適切なドキュメントや使用可能なscaladocsがないように見えるため)は、タイプエラーを生成します。

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 _)
4

1 に答える 1

9

私の頭のてっぺんから、最初の行は次のようにすべきではありません:

object PDFDocs extends Table[PDFDocument]("DOCUMENTS") {
于 2013-02-04T21:01:58.160 に答える