[][src]Trait juniper_eager_loading::LoadFrom

pub trait LoadFrom<T>: Sized {
    type Error;
    type Connection;
    fn load(ids: &[T], db: &Self::Connection) -> Result<Vec<Self>, Self::Error>;
}

How should associated values actually be loaded?

Normally T will be your id type but for HasMany and HasManyThrough it might also be other values.

If you're using Diesel it is recommend that you use the macro impl_LoadFrom_for_diesel to generate implementations.

Associated Types

type Error

The error type. This must match the error set in #[eager_loading(error_type = _)].

type Connection

The connection type required to do the loading. This can be a database connection or maybe a connection an external web service.

Loading content...

Required methods

fn load(ids: &[T], db: &Self::Connection) -> Result<Vec<Self>, Self::Error>

Perform the load.

Loading content...

Implementors

Loading content...