Crate async_graphql

source
Expand description

§A GraphQL server library implemented in Rust

§Documentation

§Features

  • Fully supports async/await
  • Type safety
  • Rustfmt friendly (Procedural Macro)
  • Custom scalars
  • Minimal overhead
  • Easy integration (poem, actix_web, tide, warp, rocket …)
  • File upload (Multipart request)
  • Subscriptions (WebSocket transport)
  • Custom extensions
  • Apollo Tracing extension
  • Limit query complexity/depth
  • Error Extensions
  • Apollo Federation(v2)
  • Batch Queries
  • Apollo Persisted Queries

§Crate features

This crate offers the following features, all of which are not activated by default:

featureenables
apollo_tracingEnable the Apollo tracing extension.
apollo_persisted_queriesEnable the Apollo persisted queries extension.
bsonIntegrate with the bson crate.
bigdecimalIntegrate with the bigdecimal crate.
cborSupport for serde_cbor.
chronoIntegrate with the chrono crate.
chrono-tzIntegrate with the chrono-tz crate.
dataloaderSupport DataLoader.
decimalIntegrate with the rust_decimal crate.
dynamic-schemaSupport dynamic schema
fast_chemailIntegrate with the fast_chemail crate.
graphiqlEnables the GraphiQL IDE integration
hashbrownIntegrate with the hashbrown crate.
logEnable the Logger extension.
opentelemetryEnable the OpenTelemetry extension.
playgroundEnables the GraphQL playground IDE integration
rawvalueSupport raw values from serde_json
secrecyIntegrate with the secrecy crate.
smol_strIntegrate with the smol_str crate.
string_numberEnable the StringNumber.
timeIntegrate with the time crate.
tracingEnable the Tracing extension.
tempfileSave the uploaded content in the temporary file.
tokio-syncIntegrate with the tokio::sync::RwLock and tokio::sync::Mutex.
unblockSupport Asynchronous reader for Upload
uuidIntegrate with the uuid crate.
urlIntegrate with the url crate.

§Integrations

§License

Licensed under either of

§References

§Examples

All examples are in the sub-repository, located in the examples directory.

Run an example:

git submodule update # update the examples repo
cd examples && cargo run --bin [name]

§Benchmarks

Ensure that there is no CPU-heavy process in background!

cd benchmark
cargo bench

Now a HTML report is available at benchmark/target/criterion/report.

Re-exports§

  • pub use base::ComplexObject;
  • pub use base::Description;
  • pub use custom_directive::CustomDirectiveFactory;
  • pub use custom_directive::TypeDirective;
  • pub use extensions::ResolveFut;
  • pub use parser::Pos;
  • pub use parser::Positioned;
  • pub use resolver_utils::ContainerType;
  • pub use resolver_utils::EnumType;
  • pub use resolver_utils::ScalarType;
  • pub use schema::SchemaEnv;
  • pub use validation::VisitorContext;
  • pub use async_graphql_parser as parser;
  • pub use context::*;
  • pub use types::*;

Modules§

Macros§

Structs§

Enums§

Traits§

Functions§

  • Interpret a ConstValue as an instance of type T.
  • Convert a T into ConstValue which is an enum that can represent any valid GraphQL data.

Type Aliases§

Attribute Macros§

Derive Macros§