With this change, interfaces FromRow and ToRow get much more versatile, as they allow us now to not only convert record types to rows if all fields have a ToCell and FromCell interface, but also when all fields have a ToRow and FromRow implementation.
This allows us to store record fields in marshallable record fields, so that everything is flattened out when going to the database. It also allows us to use parameterized types with placeholders such as unit to mark values to be auto-generated when inserting, and correctly read them when collecting data.
I'll do some more experiments and will then add another part to the tutorial to show the advantages in more detail.
Implementing this was satisfyingly simple: Dependent types helped a lot here.
With this change, interfaces
FromRow
andToRow
get much more versatile, as they allow us now to not only convert record types to rows if all fields have aToCell
andFromCell
interface, but also when all fields have aToRow
andFromRow
implementation.This allows us to store record fields in marshallable record fields, so that everything is flattened out when going to the database. It also allows us to use parameterized types with placeholders such as unit to mark values to be auto-generated when inserting, and correctly read them when collecting data.
I'll do some more experiments and will then add another part to the tutorial to show the advantages in more detail.
Implementing this was satisfyingly simple: Dependent types helped a lot here.