[][src]Trait juniper_eager_loading::GraphqlNodeForModel

pub trait GraphqlNodeForModel: Sized {
    type Model: Clone;
    type Id: 'static + Hash + Eq;
    type Connection;
    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 Connection

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

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...