我是 playframework 2.0 的新用户。我想将用户对象映射到表单
我了解在 slick 1.0 中有:
val userForm = Form(
mapping(
"name" -> text,
"age" -> number
)(UserData.apply)(UserData.unapply)
)
但在 slick 2.0 中,用户是对象:
class User(tag: Tag) extends Table[(Int, String,String, String,Date,String,Option[Long], Int)](tag, "User") {
def id = column[Int]("SUP_ID", O.PrimaryKey, O.AutoInc)
def first_name = column[String]("First_Name")
def second_name=column[String]("Second_Name")
def email=column[String]("Email")
def datebirth=column[Date]("Birth_date")
def password=column[String]("Password")
def addID = column[Option[Long]]("ADRESS", O.Nullable)
def privilege=column[Int]("privilege")
def * = (id, first_name, second_name, email, datebirth, password, addID, privilege)
def home_address=foreignKey("ha_FK", addID, address)(_.id)
}
val user=TableQuery[User]
对象如何更改为 seq 然后映射到 Form?
Form如何绑定scala2.0中的数据?
谁能为此提供任何示例?