The simplest way would be to use map
to transform the result list. Something like the example below should be a starting point:
def getUserData = {
transaction {
from(users)(s =>
select(s.id, s.firstName, s.lastName, s.userName, s.email, s.lastLoginDate, s.dateJoined)
).toList.map { row =>
UserData(row._1, row._2, row._3, row._4, row._5, row._6, row._7)
}
}
}
This will iterate through each row and create a UserData
object out of the tuple, leaving you with List[UserData]
.
That said, if your schema users
is of type Table[UserData]
, then you could simply do:
from(users)(s => select(s))