我有一个案例类UserAccount
case class UserAccount(Id: Option[Long], Name: String, occupation: Occupation)
和一个对象Occupation
sealed trait Occupation
object Occupation {
case object Teacher extends Occupation
case object Student extends Occupation
case object Others extends Occupation
}
我使用 play slick 3 创建了一个模式
class AccountSchema(tag: Tag) extends Table[UserAccount](tag, "user_account") {
def id = column[Long]("id", O.PrimaryKey, O.AutoInc)
def name = column[String]("name")
def occupation = column[Occupation]("occupation")
def * = (id.?, name, occupation) <>((UserAccount.apply _).tupled, UserAccount.unapply)
}
当我尝试运行该项目时。由于该列,我收到错误Occupation
如何在光滑的表格列中使用对象职业?