【发布时间】:2013-12-27 05:36:26
【问题描述】:
我使用 slick 和 playframework 2.1 为什么“~”不能被识别为操作符,为什么?
object Comments extends IdTable[CommentId, Comment]("COMMENTS") {
def text = column[String]("TEXT")
// you can use your type-safe ID here - it will be mapped to long in database
def authorId = column[UserId]("AUTHOR")
def author = foreignKey("COMMENTS_AUTHOR_FK", authorId, Users)(_.id)
def date = column[DateTime]("DATE")
def base = text ~ authorId ~ date
override def * = id.? ~: base <> (Comment.apply _, Comment.unapply _) //the error happens here.
override def insertOne(elem: Comment)(implicit session: Session): CommentId =
saveBase(base, Comment.unapply _)(elem)
}
错误是:
[error] C:\assigment\slick-advanced\app\models\Comment.scala:30: value ~: is not
a member of scala.slick.lifted.Projection3[String,models.UserId,org.joda.time.DateTime]
为什么~操作符不能应用?
【问题讨论】:
-
您的
slick版本是什么?看来~:appears在1.0.0
标签: scala playframework-2.1 slick