fs2-data icon indicating copy to clipboard operation
fs2-data copied to clipboard

Support nested case classes for CsvRow*coder derivation

Open Daenyth opened this issue 5 years ago • 1 comments

When deriving shapeless implicits for very wide case classes, sometimes the compiler fails with a stack overflow error. One technique to avoid this is to nest the case classes, which is isomorphic to the flattened structure.

Something like this:

case class Sub(
  @CsvName("first-name") firstName: String,
  @CsvName("the-age") age: Int
)
case class Whole(
  @CsvName("last-name") lastName: String,
  @CsvEmbed sub: Sub
)
// last-name, first-name, the-age
// flintstone, fred, 42

Context: https://gitter.im/fs2-data/general?at=5f159b91a28d973192e7d07a

Doobie supports a similar structure

Daenyth avatar Jul 20 '20 13:07 Daenyth

Linked to #44.

satabin avatar Aug 26 '20 07:08 satabin