Skip to main content

LoaderTrait

Trait LoaderTrait 

Source
pub trait LoaderTrait {
    type Model: ModelTrait;

    // Required methods
    fn load_one<'life0, 'life1, 'async_trait, R, S, C>(
        &'life0 self,
        stmt: S,
        db: &'life1 C,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Option<<R as EntityTrait>::Model>>, DbErr>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             C: ConnectionTrait + 'async_trait,
             R: EntityTrait + 'async_trait,
             <R as EntityTrait>::Model: Send + Sync,
             S: EntityOrSelect<R> + 'async_trait,
             <Self::Model as ModelTrait>::Entity: Related<R>,
             Self: 'async_trait;
    fn load_many<'life0, 'life1, 'async_trait, R, S, C>(
        &'life0 self,
        stmt: S,
        db: &'life1 C,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<<R as EntityTrait>::Model>>, DbErr>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             C: ConnectionTrait + 'async_trait,
             R: EntityTrait + 'async_trait,
             <R as EntityTrait>::Model: Send + Sync,
             S: EntityOrSelect<R> + 'async_trait,
             <Self::Model as ModelTrait>::Entity: Related<R>,
             Self: 'async_trait;
    fn load_many_to_many<'life0, 'life1, 'async_trait, R, S, V, C>(
        &'life0 self,
        stmt: S,
        via: V,
        db: &'life1 C,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<<R as EntityTrait>::Model>>, DbErr>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             C: ConnectionTrait + 'async_trait,
             R: EntityTrait + 'async_trait,
             <R as EntityTrait>::Model: Send + Sync,
             S: EntityOrSelect<R> + 'async_trait,
             V: EntityTrait + 'async_trait,
             <V as EntityTrait>::Model: Send + Sync,
             <Self::Model as ModelTrait>::Entity: Related<R>,
             Self: 'async_trait;
}
Expand description

This trait implements the Data Loader API

Required Associated Types§

Source

type Model: ModelTrait

Source model

Required Methods§

Source

fn load_one<'life0, 'life1, 'async_trait, R, S, C>( &'life0 self, stmt: S, db: &'life1 C, ) -> Pin<Box<dyn Future<Output = Result<Vec<Option<<R as EntityTrait>::Model>>, DbErr>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, C: ConnectionTrait + 'async_trait, R: EntityTrait + 'async_trait, <R as EntityTrait>::Model: Send + Sync, S: EntityOrSelect<R> + 'async_trait, <Self::Model as ModelTrait>::Entity: Related<R>, Self: 'async_trait,

Used to eager load has_one relations

Source

fn load_many<'life0, 'life1, 'async_trait, R, S, C>( &'life0 self, stmt: S, db: &'life1 C, ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<<R as EntityTrait>::Model>>, DbErr>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, C: ConnectionTrait + 'async_trait, R: EntityTrait + 'async_trait, <R as EntityTrait>::Model: Send + Sync, S: EntityOrSelect<R> + 'async_trait, <Self::Model as ModelTrait>::Entity: Related<R>, Self: 'async_trait,

Used to eager load has_many relations

Source

fn load_many_to_many<'life0, 'life1, 'async_trait, R, S, V, C>( &'life0 self, stmt: S, via: V, db: &'life1 C, ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<<R as EntityTrait>::Model>>, DbErr>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, C: ConnectionTrait + 'async_trait, R: EntityTrait + 'async_trait, <R as EntityTrait>::Model: Send + Sync, S: EntityOrSelect<R> + 'async_trait, V: EntityTrait + 'async_trait, <V as EntityTrait>::Model: Send + Sync, <Self::Model as ModelTrait>::Entity: Related<R>, Self: 'async_trait,

Used to eager load many_to_many relations

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<M> LoaderTrait for &[M]
where M: ModelTrait + Sync,

Source§

type Model = M

Source§

fn load_one<'life0, 'life1, 'async_trait, R, S, C>( &'life0 self, stmt: S, db: &'life1 C, ) -> Pin<Box<dyn Future<Output = Result<Vec<Option<<R as EntityTrait>::Model>>, DbErr>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, C: ConnectionTrait + 'async_trait, R: EntityTrait + 'async_trait, <R as EntityTrait>::Model: Send + Sync, S: EntityOrSelect<R> + 'async_trait, <<&[M] as LoaderTrait>::Model as ModelTrait>::Entity: Related<R>, &[M]: 'async_trait,

Source§

fn load_many<'life0, 'life1, 'async_trait, R, S, C>( &'life0 self, stmt: S, db: &'life1 C, ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<<R as EntityTrait>::Model>>, DbErr>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, C: ConnectionTrait + 'async_trait, R: EntityTrait + 'async_trait, <R as EntityTrait>::Model: Send + Sync, S: EntityOrSelect<R> + 'async_trait, <<&[M] as LoaderTrait>::Model as ModelTrait>::Entity: Related<R>, &[M]: 'async_trait,

Source§

fn load_many_to_many<'life0, 'life1, 'async_trait, R, S, V, C>( &'life0 self, stmt: S, via: V, db: &'life1 C, ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<<R as EntityTrait>::Model>>, DbErr>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, C: ConnectionTrait + 'async_trait, R: EntityTrait + 'async_trait, <R as EntityTrait>::Model: Send + Sync, S: EntityOrSelect<R> + 'async_trait, V: EntityTrait + 'async_trait, <V as EntityTrait>::Model: Send + Sync, <<&[M] as LoaderTrait>::Model as ModelTrait>::Entity: Related<R>, &[M]: 'async_trait,

Source§

impl<M> LoaderTrait for Vec<M>
where M: ModelTrait + Sync,

Source§

type Model = M

Source§

fn load_one<'life0, 'life1, 'async_trait, R, S, C>( &'life0 self, stmt: S, db: &'life1 C, ) -> Pin<Box<dyn Future<Output = Result<Vec<Option<<R as EntityTrait>::Model>>, DbErr>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, C: ConnectionTrait + 'async_trait, R: EntityTrait + 'async_trait, <R as EntityTrait>::Model: Send + Sync, S: EntityOrSelect<R> + 'async_trait, <<Vec<M> as LoaderTrait>::Model as ModelTrait>::Entity: Related<R>, Vec<M>: 'async_trait,

Source§

fn load_many<'life0, 'life1, 'async_trait, R, S, C>( &'life0 self, stmt: S, db: &'life1 C, ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<<R as EntityTrait>::Model>>, DbErr>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, C: ConnectionTrait + 'async_trait, R: EntityTrait + 'async_trait, <R as EntityTrait>::Model: Send + Sync, S: EntityOrSelect<R> + 'async_trait, <<Vec<M> as LoaderTrait>::Model as ModelTrait>::Entity: Related<R>, Vec<M>: 'async_trait,

Source§

fn load_many_to_many<'life0, 'life1, 'async_trait, R, S, V, C>( &'life0 self, stmt: S, via: V, db: &'life1 C, ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<<R as EntityTrait>::Model>>, DbErr>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, C: ConnectionTrait + 'async_trait, R: EntityTrait + 'async_trait, <R as EntityTrait>::Model: Send + Sync, S: EntityOrSelect<R> + 'async_trait, V: EntityTrait + 'async_trait, <V as EntityTrait>::Model: Send + Sync, <<Vec<M> as LoaderTrait>::Model as ModelTrait>::Entity: Related<R>, Vec<M>: 'async_trait,

Implementors§