Struct datamodel_renderer::datamodel::Relation
source · pub struct Relation<'a>(/* private fields */);
Expand description
Defines the relation argument of a model field.
Implementations§
source§impl<'a> Relation<'a>
impl<'a> Relation<'a>
sourcepub fn name(&mut self, name: impl Into<Cow<'a, str>>)
pub fn name(&mut self, name: impl Into<Cow<'a, str>>)
Defines the relation name. The attribute will be value-only.
ⓘ
@relation("foo")
// ^^^ this
sourcepub fn on_delete(&mut self, action: impl Into<Cow<'a, str>>)
pub fn on_delete(&mut self, action: impl Into<Cow<'a, str>>)
Defines the ON DELETE
referential action.
ⓘ
@relation(onDelete: DoNothing)
// ^^^^^^^^^ this
sourcepub fn on_update(&mut self, action: impl Into<Cow<'a, str>>)
pub fn on_update(&mut self, action: impl Into<Cow<'a, str>>)
Defines the ON UPDATE
referential action.
ⓘ
@relation(onUpdate: DoNothing)
// ^^^^^^^^^ this
sourcepub fn map(&mut self, name: impl Into<Cow<'a, str>>)
pub fn map(&mut self, name: impl Into<Cow<'a, str>>)
Defines the foreign key constraint name.
ⓘ
@relation(map: "FK_foo")
// ^^^^^^ this
Trait Implementations§
Auto Trait Implementations§
impl<'a> RefUnwindSafe for Relation<'a>
impl<'a> Send for Relation<'a>
impl<'a> Sync for Relation<'a>
impl<'a> Unpin for Relation<'a>
impl<'a> UnwindSafe for Relation<'a>
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