The test code you linked to is outdated. If you don't use mappings for your tables, it's straight-forward: The type of *
corresponds to the return type you get when querying the table, whether it is a single tuple, an HList, or nested tuples. Since Slick 2.1 this works for all operations. (In 2.0 it was not supported for the *
projection, so you had to define an alternate projection and override create_*
.) See here for an HList example.
If you want to map the *
projection to a custom type, you also use the <>
operator as for a single tuple but you don't get the convenience of the tupled
and unapply
methods that are automatically generated for case classes, so you have to write the two mapping functions (from the unmapped to the mapped type and back) manually as shown here. Note that Scala 2.11 does not improve this situation. While it allows case classes with more than 22 fields, there are no corresponding Function
types for arities > 22, so you still can't use tupled
and unapply
.
As an alternative to writing these functions, you can define a lifted type corresponding to your mapped type as explained in the manual. This is especially useful when you have nested case classes (of <= 22 fields each) for your mapped type. You only have to define separate mappings for each case class and they will automatically compose when you use them in a *
projection (or any other place in a projection or query).