I use slick 2.0 rc
I have defined field UserId
:
trait TypedId extends Any {
def value: Long
}
trait HasId[ID <: TypedId] {
_: Table[_] =>
def id: Column[ID]
}
case class UserId(value:Long) extends AnyVal with TypedId
case class User(id: Option[UserId],
email: String,
firstName: String,
lastName: String,
phone:String)
when I use it:
class Users(tag: Tag) extends Table[User](tag, "users") with HasId[Option[UserId]] {
def * = (id.?, email, firstName , lastName , phone )<> (User.tupled, User.unapply)
def id= column[Option[UserId]]("ID", O.AutoInc, O.PrimaryKey)
def email = column[String]("EMAIL", O.NotNull)
def firstName = column[String]("FIRST_NAME", O.NotNull)
def lastName = column[String]("LAST_NAME", O.NotNull)
def phone =column[String]("PHONE", O.NotNull)
}
it give me compile error as:
[error] C:\assigment\slick-advanced\app\models\User.scala:27: could not find imp
licit value for parameter tm: scala.slick.ast.TypedType[Option[models.UserId]]
[error] def id= column[Option[UserId]]("ID", O.AutoInc, O.PrimaryKey)