async-graphql/src/lib.rs

94 lines
2.4 KiB
Rust
Raw Normal View History

2020-03-01 13:56:14 +00:00
//! # The GraphQL server library implemented by rust
//!
//! <div align="center">
//! <!-- CI -->
//! <img src="https://github.com/sunli829/potatonet/workflows/CI/badge.svg" />
//! <!-- Crates version -->
//! <a href="https://crates.io/crates/async-graphql">
//! <img src="https://img.shields.io/crates/v/async-graphql.svg?style=flat-square"
//! alt="Crates.io version" />
//! </a>
//! <!-- Downloads -->
//! <a href="https://crates.io/crates/async-graphql">
//! <img src="https://img.shields.io/crates/d/async-graphql.svg?style=flat-square"
//! alt="Download" />
//! </a>
//! <!-- docs.rs docs -->
//! <a href="https://docs.rs/async-graphql">
//! <img src="https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square"
//! alt="docs.rs docs" />
//! </a>
//! </div>
//!
//! ## Documentation
//!
//! * [GitHub repository](https://github.com/sunli829/async-graphql)
//! * [Cargo package](https://crates.io/crates/async-graphql)
//! * Minimum supported Rust version: 1.39 or later
//!
2020-03-04 06:27:00 +00:00
//! ## Features
//!
//! * Fully support async/await.
//! * Type safety.
//! * Rustfmt friendly (Procedural Macro).
//! * Custom scalar.
//! * Minimal overhead.
//! * Easy integration (hyper, actix_web, tide ...).
//!
//! ## License
//!
//! Licensed under either of
//!
//! * Apache License, Version 2.0,
//! (./LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
//! * MIT license (./LICENSE-MIT or http://opensource.org/licenses/MIT)
//! at your option.
//!
2020-03-01 13:56:14 +00:00
//! ## References
//!
//! * [GraphQL](https://graphql.org)
2020-03-01 10:54:34 +00:00
#[macro_use]
extern crate thiserror;
2020-03-05 00:39:56 +00:00
#[macro_use]
extern crate serde_derive;
2020-03-01 10:54:34 +00:00
2020-03-03 03:48:00 +00:00
mod base;
2020-03-01 10:54:34 +00:00
mod context;
mod error;
2020-03-03 11:15:18 +00:00
mod model;
2020-03-02 00:24:49 +00:00
mod scalars;
2020-03-03 11:15:18 +00:00
mod schema;
2020-03-02 00:24:49 +00:00
mod types;
2020-03-01 10:54:34 +00:00
2020-03-01 17:15:05 +00:00
#[doc(hidden)]
2020-03-01 10:54:34 +00:00
pub use anyhow;
2020-03-01 17:15:05 +00:00
#[doc(hidden)]
2020-03-01 10:54:34 +00:00
pub use async_trait;
2020-03-01 17:15:05 +00:00
#[doc(hidden)]
2020-03-01 10:54:34 +00:00
pub use graphql_parser;
2020-03-01 17:15:05 +00:00
#[doc(hidden)]
2020-03-01 10:54:34 +00:00
pub use serde_json;
2020-03-05 00:39:56 +00:00
pub mod http;
2020-03-01 10:54:34 +00:00
pub use async_graphql_derive::{Enum, InputObject, Object};
2020-03-03 03:48:00 +00:00
pub use base::Scalar;
2020-03-05 00:39:56 +00:00
pub use base::{GQLInputObject, GQLInputValue, GQLObject, GQLOutputValue, GQLType};
pub use context::{Context, ContextBase, Variables};
2020-03-01 13:35:39 +00:00
pub use error::{ErrorWithPosition, PositionError, QueryError, QueryParseError};
2020-03-01 10:54:34 +00:00
pub use graphql_parser::query::Value;
2020-03-02 00:24:49 +00:00
pub use scalars::ID;
2020-03-03 11:15:18 +00:00
pub use schema::{QueryBuilder, Schema};
2020-03-02 00:24:49 +00:00
pub use types::GQLEmptyMutation;
2020-03-05 00:39:56 +00:00
pub use types::{GQLEnum, GQLEnumItem};
2020-03-02 00:24:49 +00:00
pub type Result<T> = anyhow::Result<T>;
pub type Error = anyhow::Error;
2020-03-01 13:35:39 +00:00
// internal types
2020-03-01 17:15:05 +00:00
#[doc(hidden)]
pub use context::ContextSelectionSet;
#[doc(hidden)]
2020-03-03 11:15:18 +00:00
pub mod registry;