pub enum DeleteRule {
Nullify,
Cascade,
Deny,
}Expand description
What deleting a referenced parent does. Declared per relation
(#[model(relation(delete = "…"))]); the default is Nullify (also SwiftData’s default
for @Relationship).
Variants§
Nullify
Children survive; their references clear. Needs Option<One<M>> on the child: a
required reference cannot hold “nothing”, and wiring refuses the combination.
Cascade
Children delete with the parent, recursively, through the normal pipeline, undoable as one unit and heard by live queries.
Deny
The delete is refused while children remain, through
crate::ModelContainer::delete, the checked door; a raw restructure bypasses the
check and the deferred SQL RESTRICT refuses at flush instead.
Trait Implementations§
Source§impl Clone for DeleteRule
impl Clone for DeleteRule
impl Copy for DeleteRule
Source§impl Debug for DeleteRule
impl Debug for DeleteRule
impl Eq for DeleteRule
Source§impl PartialEq for DeleteRule
impl PartialEq for DeleteRule
impl StructuralPartialEq for DeleteRule
Auto Trait Implementations§
impl Forget for DeleteRule
impl Freeze for DeleteRule
impl RefUnwindSafe for DeleteRule
impl Send for DeleteRule
impl Sync for DeleteRule
impl Unpin for DeleteRule
impl UnsafeUnpin for DeleteRule
impl UnwindSafe for DeleteRule
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more