async_graphql/dynamic/
mod.rs

1//! Suppport for dynamic schema
2//!
3//! # Create a simple GraphQL schema
4//!
5//! ```
6//! use async_graphql::{dynamic::*, value, Value};
7//!
8//! let query = Object::new("Query").field(Field::new("value", TypeRef::named_nn(TypeRef::INT), |ctx| {
9//!     FieldFuture::new(async move { Ok(Some(Value::from(100))) })
10//! }));
11//!
12//! # tokio::runtime::Runtime::new().unwrap().block_on(async move {
13//!
14//! let schema = Schema::build(query.type_name(), None, None)
15//!     .register(query)
16//!     .finish()?;
17//!
18//! assert_eq!(
19//!    schema
20//!        .execute("{ value }")
21//!        .await
22//!        .into_result()
23//!        .unwrap()
24//!        .data,
25//!    value!({ "value": 100 })
26//! );
27//!
28//! # Ok::<_, SchemaError>(())
29//! # }).unwrap();
30//! ```
31
32#[macro_use]
33mod macros;
34
35mod base;
36mod check;
37mod directive;
38mod r#enum;
39mod error;
40mod field;
41mod input_object;
42mod input_value;
43mod interface;
44mod object;
45mod request;
46mod resolve;
47mod scalar;
48mod schema;
49mod subscription;
50mod r#type;
51mod type_ref;
52mod union;
53mod value_accessor;
54
55pub use directive::Directive;
56pub use error::SchemaError;
57pub use field::{Field, FieldFuture, FieldValue, ResolverContext};
58pub use indexmap;
59pub use input_object::InputObject;
60pub use input_value::InputValue;
61pub use interface::{Interface, InterfaceField};
62pub use object::Object;
63pub use r#enum::{Enum, EnumItem};
64pub use r#type::Type;
65pub use request::{DynamicRequest, DynamicRequestExt};
66pub use scalar::Scalar;
67pub use schema::{Schema, SchemaBuilder};
68pub use subscription::{Subscription, SubscriptionField, SubscriptionFieldFuture};
69pub use type_ref::TypeRef;
70pub use union::Union;
71pub use value_accessor::{ListAccessor, ObjectAccessor, ValueAccessor};