我正在为我在 Scala 中使用 Play 2.1.1 和 PlaySlick 作为数据库映射器编写的程序编写案例类。该申请涉及引文。我们有一个超过 22 个字段的引文表,因此我们将这些字段缩小到 22 个,这是我们真正需要做的大多数事情。代码如下:
package models
import play.api.db.slick.Config.driver._
case class Citation(citation_id: Int, pubtype: String, abs: String, keywords: String,
doi: String, url: String, booktitle: String, chapter: String, edition: String, editor:
String, translator: String, journal: String, month: String, number: String, pages:
String, publisher: String, location: String, title: String, volume: String, year:
String, raw: String, owner: String)
object Citations extends Table[Citation]("citations") {
def citation_id = column[Int]("citation_id", O.PrimaryKey, O.AutoInc)
def pubtype = column[String]("pubtype")
def abs = column[String]("abstract")
def keywords = column[String]("keywords")
def doi = column[String]("doi")
def url = column[String]("url")
def booktitle = column[String]("booktitle")
def chapter = column[Int]("chapter")
def edition = column[String]("edition")
def editor = column[String]("editor")
def translator = column[String]("translator")
def journal = column[String]("journal")
def month = column[Int]("month")
def number = column[Int]("number")
def pages = column[String]("pages")
def publisher = column[String]("publisher")
def location = column[String]("location")
def title = column[String]("title")
def volume = column[String]("volume")
def year = column[String]("year")
def raw = column[String]("raw")
def owner = column[String]("owner")
def * = (citation_id ~ pubtype ~ abs ~ keywords ~ doi ~ url ~ booktitle ~ chapter ~ edition ~ editor ~ translator ~ journal ~ month ~ number ~ pages ~ publisher ~ location ~ title ~ volume ~ year ~ raw ~ owner).<>[Citation](Citation,Citation unapply _)
}
然而,我们在上面的代码中得到了这个令人讨厌的错误:
Description Resource Path Location Type
overloaded method value <> with alternatives: (f: (Int, String, String, String, String, String, String, Int, String, String, String, String, Int, Int, String, String, String, String, String, String, String, String) => models.Citation,g: models.Citation => Option[(Int, String, String, String, String, String, String, Int, String, String, String, String, Int, Int, String, String, String, String, String, String, String, String)])scala.slick.lifted.MappedProjection[models.Citation,(Int, String, String, String, String, String, String, Int, String, String, String, String, Int, Int, String, String, String, String, String, String, String, String)] <and> (f: ((Int, String, String, String, String, String, String, Int, String, String, String, String, Int, Int, String, String, String, String, String, String, String, String)) => models.Citation,g: models.Citation => Option[(Int, String, String, String, String, String, String, Int, String, String, String, String, Int, Int, String, String, String, String, String, String, String, String)])scala.slick.lifted.MappedProjection[models.Citation,(Int, String, String, String, String, String, String, Int, String, String, String, String, Int, Int, String, String, String, String, String, String, String, String)] cannot be applied to (models.Citation.type, models.Citation => Option[(Int, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String)]) Citations.scala /myapp/app/models line 39 Scala Problem`
默认投影有问题,但我不确定它是什么。我们正处于 22 arg 限制,但如果我们将其缩小到 21 或 20,我们仍然会得到相同的错误。
任何帮助将不胜感激。谢谢!