async_graphql

Module dynamic

Source
Available on crate feature dynamic-schema only.
Expand description

Suppport for dynamic schema

§Create a simple GraphQL schema

use async_graphql::{dynamic::*, value, Value};

let query = Object::new("Query").field(Field::new("value", TypeRef::named_nn(TypeRef::INT), |ctx| {
    FieldFuture::new(async move { Ok(Some(Value::from(100))) })
}));


let schema = Schema::build(query.type_name(), None, None)
    .register(query)
    .finish()?;

assert_eq!(
   schema
       .execute("{ value }")
       .await
       .into_result()
       .unwrap()
       .data,
   value!({ "value": 100 })
);

Re-exports§

pub use indexmap;

Structs§

Directive
A GraphQL directive
DynamicRequest
GraphQL request for dynamic schema.
Enum
A GraphQL enum type
EnumItem
A GraphQL enum item
Field
A GraphQL field
FieldValue
A value returned from the resolver function
InputObject
A GraphQL input object type
InputValue
A GraphQL input value type
Interface
A GraphQL interface type
InterfaceField
A GraphQL interface field type
ListAccessor
A list accessor
Object
A GraphQL object type
ObjectAccessor
A object accessor
ResolverContext
A context for resolver function
Scalar
A GraphQL scalar type
Schema
Dynamic GraphQL schema.
SchemaBuilder
Dynamic schema builder
SchemaError
An error can occur when building dynamic schema
Subscription
A GraphQL subscription type
SubscriptionField
A GraphQL subscription field
SubscriptionFieldFuture
A future that returned from field resolver
Union
A GraphQL union type
ValueAccessor
A value accessor

Enums§

FieldFuture
A future that returned from field resolver
Type
A GraphQL type
TypeRef
A type reference

Traits§

DynamicRequestExt
A trait for DynamicRequest