Use mappedWith to map an HList into a case class
Addition of the mappedWith
method.
This allows a user to convert an HList
shape mapping to a case class shape mapping using a Generic
:
case class Address(id: Long, house: Int, street: String)
class Addresss(tag: Tag) extends Table[Address](tag, "addresses") {
def id = column[Long]("id", O.PrimaryKey, O.AutoInc)
def house = column[Int]("house")
def street = column[String]("street")
def * = (id :: house :: street :: HNil).mappedWith(Generic[Address])
}
Thanks @davegurnell and PR 10.