[][src]Crate wundergraph

Wundergraph provides a platform to easily expose your database through a GraphQL interface.

Short example

use wundergraph::prelude::*;

table! {
    heros {
        id -> Integer,
        name -> Text,
        hair_color -> Nullable<Text>,
        species -> Integer,
    }
}

table! {
    species {
        id -> Integer,
        name -> Text,
    }
}

#[derive(Clone, Debug, Identifiable, WundergraphEntity)]
#[table_name = "heros"]
pub struct Hero {
    id: i32,
    name: String,
    hair_color: Option<String>,
    species: HasOne<i32, Species>,
}

#[derive(Clone, Debug, Identifiable, WundergraphEntity)]
#[table_name = "species"]
pub struct Species {
    id: i32,
    name: String,
    heros: HasMany<Hero, heros::species>,
}

wundergraph::query_object!{
    Query {
       Hero,
       Species,
    }
}

Where to find things

Everything required for basic usage of wundergraph is exposed through wundergraph::prelude. wundergraph::query_builder::selection contains functionality to manual extend or implement a query entity, wundergraph::query_builder::mutations contains similar functionality for mutations. wundergraph::scalar provides the implementation of the internal used juniper scalar value type. wundergraph::error contains the definition of the internal error type. wundergraph::diesel_ext and wundergraph::juniper_ext provide extension traits and types for the corresponding crates. wundergraph::helper contains wundergraph specific helper types.

Modules

diesel_ext

A module containing extension traits for various diesel types

error

This module contains all error handling related functionality in wundergraph

helper

A module containing various helper traits and types mostly useful to work with tuples at compile time

juniper_ext

A module containing juniper specific extension traits

prelude

Re-exports important traits and types. Meant to be glob imported when using wundergraph.

query_builder

This module contains functionality used by wundergraph to convert a GraphQL request as sql query.

scalar

A module containing a wundergraph specific juniper scalar value implementation

Macros

mutation_object

Macro to register the main mutation object

query_object

Macro to register the main query object

Derive Macros

WundergraphEntity

A custom derive to implement all wundergraph related traits for a entity Using this trait implies internally #[derive(WundergraphBelongsTo)] and #[derive(BuildFilterHelper)]