pub struct ForeignKey {
pub fields: Vec<ForeignKeyField>,
}Expand description
A foreign key linking one model’s fields to another model’s primary key.
A ForeignKey is composed of one or more ForeignKeyField pairs, each
mapping a source field (on the owning model) to a target field (on the
referenced model). For single-column primary keys the fields vec has one
entry; composite keys have multiple.
§Examples
use toasty_core::schema::app::{ForeignKey, ForeignKeyField, FieldId, ModelId};
let fk = ForeignKey {
fields: vec![ForeignKeyField {
source: ModelId(0).field(1),
target: ModelId(1).field(0),
}],
};
assert_eq!(fk.fields.len(), 1);Fields§
§fields: Vec<ForeignKeyField>The field pairs that make up this foreign key.
Trait Implementations§
Source§impl Clone for ForeignKey
impl Clone for ForeignKey
Source§fn clone(&self) -> ForeignKey
fn clone(&self) -> ForeignKey
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 moreAuto Trait Implementations§
impl Freeze for ForeignKey
impl RefUnwindSafe for ForeignKey
impl Send for ForeignKey
impl Sync for ForeignKey
impl Unpin for ForeignKey
impl UnwindSafe for ForeignKey
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