pub struct RelationDef {
pub field: String,
pub target_struct: String,
pub target_table: String,
pub local_column: String,
pub nullable: bool,
}Expand description
A belongs-to relation field: #[orm(relation = fk_column)] field: Option<Target>. Traverses local_column (a foreign key on this table) to
its referenced row. When the FK column is nullable the join is a LEFT JOIN
and the field is None for rows with no parent.
Fields§
§field: StringStruct field name (run, donor).
target_struct: StringTarget struct name (Run), taken from the field’s Option<Target> type.
target_table: StringTarget SQL table (runs); resolved from local_column’s foreign key by
crate::parse::parse_sources. Empty in single-struct (derive) contexts.
local_column: StringThe foreign-key column on this table the relation joins through.
nullable: boolTrue when local_column is nullable → LEFT JOIN, None when absent.
Trait Implementations§
Source§impl Clone for RelationDef
impl Clone for RelationDef
Source§fn clone(&self) -> RelationDef
fn clone(&self) -> RelationDef
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RelationDef
impl Debug for RelationDef
Source§impl<'de> Deserialize<'de> for RelationDef
impl<'de> Deserialize<'de> for RelationDef
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for RelationDef
impl PartialEq for RelationDef
Source§fn eq(&self, other: &RelationDef) -> bool
fn eq(&self, other: &RelationDef) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for RelationDef
impl Serialize for RelationDef
impl StructuralPartialEq for RelationDef
Auto Trait Implementations§
impl Freeze for RelationDef
impl RefUnwindSafe for RelationDef
impl Send for RelationDef
impl Sync for RelationDef
impl Unpin for RelationDef
impl UnsafeUnpin for RelationDef
impl UnwindSafe for RelationDef
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more