[][src]Trait juniper_eager_loading::GraphqlNodeForModel

pub trait GraphqlNodeForModel: Sized {
    type Model: Clone;
    type Id: 'static + Hash + Eq;
    type Context;
    type Error;
    fn new_from_model(model: &Self::Model) -> Self;

    fn from_db_models(models: &[Self::Model]) -> Vec<Self> { ... }
}

A GraphQL type backed by a model object.

You shouldn't need to implement this trait yourself even when customizing eager loading.

Associated Types

type Model: Clone

The model type.

type Id: 'static + Hash + Eq

The id type the model uses.

type Context

Your Juniper context type.

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

type Error

The error type.

Loading content...

Required methods

fn new_from_model(model: &Self::Model) -> Self

Create a new GraphQL type from a model.

Loading content...

Provided methods

fn from_db_models(models: &[Self::Model]) -> Vec<Self>

Create a list of GraphQL types from a list of models.

Loading content...

Implementors

Loading content...