Skip to main content

Module embed_enum_optional

Module embed_enum_optional 

Source
Expand description

Option<EmbeddedEnum> model fields.

A nullable embedded enum reuses its discriminant column as the head: NULL = None, a variant value = Some(variant). The data-enum decode Match gets a null else branch so a NULL (unmatched) discriminant decodes to None; a unit-only enum’s discriminant column reads back as None directly.

Variant-only predicates (.is_email()) on the optional path are not yet exposed — that needs the same Field path-machinery work deferred for nested-field access on Option<struct>. Whole-value .eq(Some(Variant)) covers variant matching here.

Functions§

option_enum_create_ops
Driver-op coverage for create. A Some(variant) writes the variant discriminant to the (shared) discriminant column and the variant’s fields to their columns (other variants’ columns NULL); a None writes NULL to the discriminant and every variant column.
option_enum_crud
Round-trip Some(variant) and None for both a data enum and a unit enum.
option_enum_db_schema
The DB schema: nullable discriminant columns (named after the field) plus nullable variant-field columns for the data enum.
option_enum_filter_eq
Whole-value .eq(Some(variant)) matches the equal Some row and never None, for both a data variant and a unit variant.
option_enum_filter_ops
Driver-op coverage for filters. .is_none() / .is_some() emit a predicate on the single discriminant column (IS NULL / NOT (.. IS NULL)), never a check distributed across the variant columns.
option_enum_filter_presence
.is_none() / .is_some() on an Option<enum> filter the discriminant column’s null-ness.
option_enum_update
Updating the whole value in both directions for a data and a unit enum.
option_enum_update_ops
Driver-op coverage for updates. Setting Some(variant) assigns the variant discriminant + that variant’s column (others NULL); setting None assigns NULL to the discriminant and every variant column.