pub struct LinkTableInfo {
pub table_name: &'static str,
pub local_column: &'static str,
pub remote_column: &'static str,
pub local_columns: Option<&'static [&'static str]>,
pub remote_columns: Option<&'static [&'static str]>,
}Expand description
Information about a link/join table for many-to-many relationships.
Fields§
§table_name: &'static strThe link table name (e.g., "hero_powers").
local_column: &'static strColumn in link table pointing to the local model (e.g., "hero_id").
remote_column: &'static strColumn in link table pointing to the remote model (e.g., "power_id").
local_columns: Option<&'static [&'static str]>Composite local key columns (for composite PK parents).
If set, this takes precedence over local_column.
remote_columns: Option<&'static [&'static str]>Composite remote key columns (for composite PK children).
If set, this takes precedence over remote_column.
Implementations§
Source§impl LinkTableInfo
impl LinkTableInfo
Sourcepub const fn new(
table_name: &'static str,
local_column: &'static str,
remote_column: &'static str,
) -> Self
pub const fn new( table_name: &'static str, local_column: &'static str, remote_column: &'static str, ) -> Self
Create a new link-table definition.
Sourcepub const fn composite(
table_name: &'static str,
local_columns: &'static [&'static str],
remote_columns: &'static [&'static str],
) -> Self
pub const fn composite( table_name: &'static str, local_columns: &'static [&'static str], remote_columns: &'static [&'static str], ) -> Self
Create a new composite link-table definition.
Column order matters:
local_columnsmust match the parent PK value orderingremote_columnsmust match the child PK value ordering
Sourcepub fn local_cols(&self) -> &[&'static str]
pub fn local_cols(&self) -> &[&'static str]
Return the local key columns (single or composite).
Sourcepub fn remote_cols(&self) -> &[&'static str]
pub fn remote_cols(&self) -> &[&'static str]
Return the remote key columns (single or composite).
Trait Implementations§
Source§impl Clone for LinkTableInfo
impl Clone for LinkTableInfo
Source§fn clone(&self) -> LinkTableInfo
fn clone(&self) -> LinkTableInfo
Returns a duplicate of the value. Read more
1.0.0 · 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 LinkTableInfo
impl Debug for LinkTableInfo
Source§impl PartialEq for LinkTableInfo
impl PartialEq for LinkTableInfo
impl Copy for LinkTableInfo
impl Eq for LinkTableInfo
impl StructuralPartialEq for LinkTableInfo
Auto Trait Implementations§
impl Freeze for LinkTableInfo
impl RefUnwindSafe for LinkTableInfo
impl Send for LinkTableInfo
impl Sync for LinkTableInfo
impl Unpin for LinkTableInfo
impl UnsafeUnpin for LinkTableInfo
impl UnwindSafe for LinkTableInfo
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).