pub struct ForeignKey {
pub database: Option<Cow<'static, str>>,
pub table: Cow<'static, str>,
pub name: Cow<'static, str>,
pub columns: Vec<Cow<'static, str>>,
pub foreign_database: Option<Cow<'static, str>>,
pub foreign_table: Cow<'static, str>,
pub foreign_columns: Vec<Cow<'static, str>>,
pub on_delete: Option<ReferentialAction>,
pub on_update: Option<ReferentialAction>,
}Expand description
A foreign key from table(columns) to foreign_table(foreign_columns).
Fields§
§database: Option<Cow<'static, str>>§table: Cow<'static, str>§name: Cow<'static, str>§columns: Vec<Cow<'static, str>>§foreign_database: Option<Cow<'static, str>>Database of the referenced table; None for the current database.
foreign_table: Cow<'static, str>§foreign_columns: Vec<Cow<'static, str>>§on_delete: Option<ReferentialAction>ON DELETE action; None when not written.
on_update: Option<ReferentialAction>ON UPDATE action; None when not written.
Implementations§
Source§impl ForeignKey
impl ForeignKey
Sourcepub fn new(
table: impl Into<Cow<'static, str>>,
name: impl Into<Cow<'static, str>>,
columns: impl IntoIterator<Item = impl Into<Cow<'static, str>>>,
foreign_table: impl Into<Cow<'static, str>>,
foreign_columns: impl IntoIterator<Item = impl Into<Cow<'static, str>>>,
) -> Self
pub fn new( table: impl Into<Cow<'static, str>>, name: impl Into<Cow<'static, str>>, columns: impl IntoIterator<Item = impl Into<Cow<'static, str>>>, foreign_table: impl Into<Cow<'static, str>>, foreign_columns: impl IntoIterator<Item = impl Into<Cow<'static, str>>>, ) -> Self
Creates a foreign key with no ON DELETE / ON UPDATE actions.
Trait Implementations§
Source§impl Clone for ForeignKey
impl Clone for ForeignKey
Source§impl Debug for ForeignKey
impl Debug for ForeignKey
impl Eq for ForeignKey
Source§impl PartialEq for ForeignKey
impl PartialEq for ForeignKey
impl StructuralPartialEq for ForeignKey
Auto Trait Implementations§
impl Freeze for ForeignKey
impl RefUnwindSafe for ForeignKey
impl Send for ForeignKey
impl Sync for ForeignKey
impl Unpin for ForeignKey
impl UnsafeUnpin 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