Skip to main content

Module embed_relation

Module embed_relation 

Source

Functions§

belongs_to_in_embedded_struct
#[belongs_to] inside an embedded struct: same storage rule — the key field owns the column, the relation maps to nothing — through the full CRUD cycle.
belongs_to_in_enum_variants
The polymorphic-owner shape: #[belongs_to] fields inside embedded enum variants, exercised through the full CRUD cycle. The relation fields map to no columns — the discriminant and the key fields own the storage. Creating supplies the variant value with explicit keys, match reads the stored keys back, the owner loads with an ordinary get_by_*, and changing the owner — including its kind — is a whole-value replacement of the embed.
filter_by_relation_key_through_variant_path
Key fields of relation-carrying variants stay queryable through the existing variant filter paths — the variant closure gates on the discriminant and compares the shared key column — and stay consistent as rows are re-pointed and deleted.
optional_relation_carrying_embed
An Option<Owner> field: an ownerless row stores NULL in the discriminant column, per existing optional-embed support, and updates move rows in and out of ownership.