1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
//! Wundergraph provides a platform to easily expose your database through
//! a GraphQL interface.
//!
//! ## Short example
//!
//! ```rust
//! # #[macro_use] extern crate diesel;
//! #
//! 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,
//!     }
//! }
//!
//! # fn main() {}
//! ```
//!
//! ## Where to find things
//!
//! Everything required for basic usage of wundergraph is exposed through
//! [`wundergraph::prelude`](prelude/index.html).
//! [`wundergraph::query_builder::selection`](query_builder/selection/index.html)
//! contains functionality to manual extend or implement a query entity,
//! [`wundergraph::query_builder::mutations`](query_builder/mutations/index.html)
//! contains similar functionality for mutations.
//! [`wundergraph::scalar`](scalar/index.html) provides the implementation of
//! the internal used juniper scalar value type. [`wundergraph::error`](error/index.html)
//! contains the definition of the internal error type.
//! [`wundergraph::diesel_ext`](diesel_ext/index.html) and
//! [`wundergraph::juniper_ext`](juniper_ext/index.html) provide
//! extension traits and types for the corresponding crates.
//! [`wundergraph::helper`](helper/index.html) contains wundergraph
//! specific helper types.
//!
//!

#![deny(missing_debug_implementations, missing_copy_implementations)]
#![warn(
    missing_docs,
    clippy::option_unwrap_used,
    clippy::result_unwrap_used,
    clippy::print_stdout,
    clippy::wrong_pub_self_convention,
    clippy::mut_mut,
    clippy::non_ascii_literal,
    clippy::similar_names,
    clippy::unicode_not_nfc,
    clippy::enum_glob_use,
    clippy::if_not_else,
    clippy::items_after_statements,
    clippy::used_underscore_binding,
    clippy::cargo_common_metadata,
    clippy::dbg_macro,
    clippy::doc_markdown,
    clippy::filter_map,
    clippy::map_flatten,
    clippy::match_same_arms,
    clippy::needless_borrow,
    clippy::needless_pass_by_value,
    clippy::option_map_unwrap_or,
    clippy::option_map_unwrap_or_else,
    clippy::redundant_clone,
    clippy::result_map_unwrap_or_else,
    clippy::unnecessary_unwrap,
    clippy::unseparated_literal_suffix,
    clippy::wildcard_dependencies
)]
#![allow(clippy::type_complexity)]

#[doc(hidden)]
#[macro_use]
pub extern crate diesel;
#[doc(hidden)]
pub extern crate indexmap;
#[doc(hidden)]
pub extern crate juniper;
#[doc(hidden)]
#[cfg(feature = "debug")]
pub extern crate log;
#[doc(hidden)]
pub extern crate paste;

pub use wundergraph_derive::WundergraphEntity;

pub mod diesel_ext;
pub mod error;
pub mod helper;
pub mod juniper_ext;
pub mod scalar;
#[macro_use]
mod macros;
pub(crate) mod context;
#[doc(hidden)]
pub mod graphql_type;
pub mod query_builder;

mod third_party_integrations;

pub mod prelude {
    //! Re-exports important traits and types. Meant to be glob imported
    //! when using wundergraph.

    #[doc(inline)]
    pub use super::context::WundergraphContext;

    #[doc(inline)]
    pub use super::query_builder::types::{HasMany, HasOne};

    #[doc(inline)]
    pub use crate::query_builder::selection::{BoxedQuery, QueryModifier};

    #[doc(inline)]
    pub use super::WundergraphEntity;

    #[doc(inline)]
    pub use super::query_object;

    #[doc(inline)]
    pub use super::mutation_object;
}

#[doc(hidden)]
pub use self::prelude::*;

#[macro_export]
#[doc(hidden)]
/// Used by `wundergraph_derives`, which can't access `$crate`
macro_rules! __use_everything {
    () => {
        pub use $crate::*;
    };
}