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
The `#[default_when_null]` attibute is intented to allow a flexible
transition period when schema is altered. Namely, if a UDT is extended
with a new field, then server will populate the new column with NULLs.
If the data model does not abstractly permit NULLs in that column, one
may not want to represent the field with `Option<T>`, not to have to
handle the case of `None`. In such case, `#[default_when_null]` can be
attached to the new Rust struct's field and this way handle the
situation:
- in deserialization, the NULL field received from the DB will be
default-initialized,
- in serialization, there is no corresponding situation, so this
attribute does nothing.
This commit adds support for this attribute: for parsing it using
`darling`, and that's it - because it's a no-op.
Also, a corresponding (doc)test is added to confirm that the attibute is
parsed correctly.
0 commit comments