Учитывая ваши вложенные определения классов дел, должно работать двунаправленное отображение для проекции *
, аналогичное следующему:
case class Info(fullName: Option[String], dn: Option[String], manager: Option[String], title: Option[String], group: Option[String], sid: Option[String])
case class User(username: String, riskScore: Float, averageRiskScore: Float, lastSessionId: String, lastActivityTime: Long, info: Info)
class Users(tag: Tag) extends Table[User](tag, "USERS") {
def username = column[String]("user_name")
def riskScore = column[Float]("risk_score")
def averageRiskScore = column[Float]("average_risk_score")
def lastSessionId = column[String]("last_session_id")
def lastActivityTime = column[Long]("last_acitivity_time")
def fullName = column[Option[String]]("full_name", O.Default(None))
def dn = column[Option[String]]("dn", O.Default(None))
def manager = column[Option[String]]("manager", O.Default(None))
def title = column[Option[String]]("title", O.Default(None))
def group = column[Option[String]]("group", O.Default(None))
def sid = column[Option[String]]("sid", O.Default(None))
def * = (
username, riskScore, averageRiskScore, lastSessionId, lastActivityTime, (
fullName, dn, manager, title, group, sid
)
).shaped <> (
{ case (username, riskScore, averageRiskScore, lastSessionId, lastActivityTime, info) =>
User(username, riskScore, averageRiskScore, lastSessionId, lastActivityTime, Info.tupled.apply(info))
},
{ u: User =>
def f(i: Info) = Info.unapply(i).get
Some((u.username, u.riskScore, u.averageRiskScore, u.lastSessionId, u.lastActivityTime, f(u.info)))
}
)
}
Вот отличная статья Slick , которую вы можетенайти полезное.