Scala “~”:&引用;在slick中是什么意思?为什么DateTime没有识别
我使用slick和playframework 2.1 为什么“~”不能识别为运算符,为什么Scala “~”:&引用;在slick中是什么意思?为什么DateTime没有识别,scala,playframework-2.1,slick,Scala,Playframework 2.1,Slick,我使用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[Us
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)
}
为什么~operator无法应用?它投诉的操作员是
~:
,而不是~
。该错误可能只是DateTime错误的结果。Slick不支持joda开箱即用的时间。这应该会有帮助:您的slick
版本是什么?似乎~:
在1.0.0
[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]