[][src]Trait juniper_eager_loading::LoadFrom

pub trait LoadFrom<T, Args = ()>: Sized {
    type Error;
    type Context;
    fn load(
        ids: &[T],
        args: &Args,
        context: &Self::Context
    ) -> 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 one of the macros to generate implementations.

Args is the type of arguments your GraphQL field takes. This is how we're able to load things differently depending the types of arguments. You can learn more here.

Associated Types

type Error

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

type Context

Your Juniper context type.

This will typically contain a database connection or a connection to some external API.

Loading content...

Required methods

fn load(
    ids: &[T],
    args: &Args,
    context: &Self::Context
) -> Result<Vec<Self>, Self::Error>

Perform the load.

Loading content...

Implementors

Loading content...