Struct atmosphere::ForeignKey
source · pub struct ForeignKey<T>where
T: Table,{
pub field: &'static str,
pub sql: &'static str,
/* private fields */
}Expand description
Represents a foreign key column, establishing a relationship to another table.
Fields§
§field: &'static strThe rust field name of the model
sql: &'static strThe associated sql column name
Implementations§
source§impl<T> ForeignKey<T>where
T: Table,
impl<T> ForeignKey<T>where
T: Table,
pub const fn new(field: &'static str, sql: &'static str) -> ForeignKey<T>
pub const fn as_col(&'static self) -> Column<T>
sourcepub const unsafe fn transmute<I>(&'static self) -> &'static ForeignKey<I>where
I: Table,
pub const unsafe fn transmute<I>(&'static self) -> &'static ForeignKey<I>where
I: Table,
Safety
We do treat this foreign key as a column of another table. This is not
smart to do - but can become necessary when doing complex joins. This
is memory safe as Self and Self have the exact same memory layout,
we do not store any data (A or B) but only a PhantomData instance which
is here transmuted.
Trait Implementations§
source§impl<T> Clone for ForeignKey<T>where
T: Table,
impl<T> Clone for ForeignKey<T>where
T: Table,
source§fn clone(&self) -> ForeignKey<T>
fn clone(&self) -> ForeignKey<T>
Returns a copy 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<T> Debug for ForeignKey<T>
impl<T> Debug for ForeignKey<T>
source§impl<T> PartialEq for ForeignKey<T>
impl<T> PartialEq for ForeignKey<T>
source§fn eq(&self, other: &ForeignKey<T>) -> bool
fn eq(&self, other: &ForeignKey<T>) -> bool
This method tests for
self and other values to be equal, and is used
by ==.impl<T> Copy for ForeignKey<T>
impl<T> Eq for ForeignKey<T>
impl<T> StructuralEq for ForeignKey<T>where
T: Table,
impl<T> StructuralPartialEq for ForeignKey<T>where
T: Table,
Auto Trait Implementations§
impl<T> RefUnwindSafe for ForeignKey<T>where
T: RefUnwindSafe,
impl<T> Send for ForeignKey<T>
impl<T> Sync for ForeignKey<T>where
T: Sync,
impl<T> Unpin for ForeignKey<T>where
T: Unpin,
impl<T> UnwindSafe for ForeignKey<T>where
T: UnwindSafe,
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.