Not every nested case class should be a UDT. Some case classes could be mapped to columns, they could be flatten.
Consider the example:
case class Bar(name: String, age: Int)
case class Foo(id: UUID, bar: Bar)
This could be mapped as:
CREATE TABLE foos (id UUID, bar_name TEXT, bar_age INT)
We want to introduce a way to create a ColumnMapper that can make this mapping possible. At a high level this method should look like:
object ColumnMapper {
def of[T](prefix: String = "", renames: T => (Any, ColumnName)*): ColumnMapper[T] = ???
}
Not every nested case class should be a UDT. Some case classes could be mapped to columns, they could be flatten.
Consider the example:
This could be mapped as:
We want to introduce a way to create a
ColumnMapperthat can make this mapping possible. At a high level this method should look like: