pub struct ManyToManyManager<S: Model, T: Model> { /* private fields */ }Expand description
Accessor for one many-to-many relation of one source object
(post.tags(&db)). Generated accessors construct it; its query and
mutation methods (all, add, remove, clear, set) run on db.
Implementations§
Source§impl<S: Model, T: Model> ManyToManyManager<S, T>
impl<S: Model, T: Model> ManyToManyManager<S, T>
Sourcepub fn queryset(&self) -> QuerySet<T>
pub fn queryset(&self) -> QuerySet<T>
Lazy queryset over the related objects (WHERE pk IN (SELECT target FROM through WHERE source = ..)); filter or order it further.
Sourcepub async fn add<'a>(
&self,
objects: impl IntoIterator<Item = &'a T>,
) -> Result<(), OrmError>
pub async fn add<'a>( &self, objects: impl IntoIterator<Item = &'a T>, ) -> Result<(), OrmError>
Relate objects (already related ones are skipped).
§Errors
Capability or backend errors (BackendError::Constraint
when a target does not exist).
Sourcepub async fn remove<'a>(
&self,
objects: impl IntoIterator<Item = &'a T>,
) -> Result<u64, OrmError>
pub async fn remove<'a>( &self, objects: impl IntoIterator<Item = &'a T>, ) -> Result<u64, OrmError>
Sourcepub async fn remove_pks(
&self,
keys: impl IntoIterator<Item = T::Pk>,
) -> Result<u64, OrmError>
pub async fn remove_pks( &self, keys: impl IntoIterator<Item = T::Pk>, ) -> Result<u64, OrmError>
Source§impl<S: Model, T: Model> ManyToManyManager<S, T>
impl<S: Model, T: Model> ManyToManyManager<S, T>
Sourcepub fn new(db: &Db, meta: &'static ManyToManyMeta, source_pk: Value) -> Self
pub fn new(db: &Db, meta: &'static ManyToManyMeta, source_pk: Value) -> Self
Manager for relation meta of the object whose key is source_pk.
Sourcepub fn meta(&self) -> &'static ManyToManyMeta
pub fn meta(&self) -> &'static ManyToManyMeta
Relation metadata.
Auto Trait Implementations§
impl<S, T> !RefUnwindSafe for ManyToManyManager<S, T>
impl<S, T> !UnwindSafe for ManyToManyManager<S, T>
impl<S, T> Freeze for ManyToManyManager<S, T>
impl<S, T> Send for ManyToManyManager<S, T>
impl<S, T> Sync for ManyToManyManager<S, T>
impl<S, T> Unpin for ManyToManyManager<S, T>
impl<S, T> UnsafeUnpin for ManyToManyManager<S, T>
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