You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In chapter 5, in the nested case class example, we should point out that for >22 columns you can nest the tuple in the mapping to avoid having a >22 tuple:
E.g.,
// Packing a row into the structure we want:defpack(row: (String, String, (String, String, String), Long)):User=User(
EmailContact(row._1, row._2),
Address(row._3._1, row._3._2, row._3._3), row._4)
// Unpacking our structure into a row representation:defunpack(user: User):Option[(String, String, (String, String, String), Long)] =Some(
(user.contact.name, user.contact.email, (user.address.street, user.address.city, user.address.country), user.id)
)
// We only project the columns we are interested in:def*= (name, email, (street, city, country), id) <> (pack, unpack)
... the point being that the * projection there has a tree structure too so is only a tuple of length 3, despite containing 6 values.
This is all horrible. Can shapeless make it better?
The text was updated successfully, but these errors were encountered:
This is still relevant because you just can't write a tuple with >22 elements for the left-hand side of mapTo. So if you want to avoid HLists for some reason, you need these tricks.
In chapter 5, in the nested case class example, we should point out that for >22 columns you can nest the tuple in the mapping to avoid having a >22 tuple:
E.g.,
... the point being that the
*
projection there has a tree structure too so is only a tuple of length 3, despite containing 6 values.This is all horrible. Can shapeless make it better?
The text was updated successfully, but these errors were encountered: