pub trait GraphQLValueAsync<S = DefaultScalarValue>: GraphQLValue<S> + Sync{
// Provided methods
fn resolve_field_async<'a>(
&'a self,
_info: &'a Self::TypeInfo,
_field_name: &'a str,
_arguments: &'a Arguments<'_, S>,
_executor: &'a Executor<'_, '_, Self::Context, S>,
) -> BoxFuture<'a, ExecutionResult<S>> { ... }
fn resolve_into_type_async<'a>(
&'a self,
info: &'a Self::TypeInfo,
type_name: &str,
selection_set: Option<&'a [Selection<'a, S>]>,
executor: &'a Executor<'a, 'a, Self::Context, S>,
) -> BoxFuture<'a, ExecutionResult<S>> { ... }
fn resolve_async<'a>(
&'a self,
info: &'a Self::TypeInfo,
selection_set: Option<&'a [Selection<'_, S>]>,
executor: &'a Executor<'_, '_, Self::Context, S>,
) -> BoxFuture<'a, ExecutionResult<S>> { ... }
}
Expand description
Extension of GraphQLValue
trait with asynchronous queries/mutations resolvers.
Convenience macros related to asynchronous queries/mutations expand into an implementation of
this trait and GraphQLValue
for the given type.
Provided Methods§
Sourcefn resolve_field_async<'a>(
&'a self,
_info: &'a Self::TypeInfo,
_field_name: &'a str,
_arguments: &'a Arguments<'_, S>,
_executor: &'a Executor<'_, '_, Self::Context, S>,
) -> BoxFuture<'a, ExecutionResult<S>>
fn resolve_field_async<'a>( &'a self, _info: &'a Self::TypeInfo, _field_name: &'a str, _arguments: &'a Arguments<'_, S>, _executor: &'a Executor<'_, '_, Self::Context, S>, ) -> BoxFuture<'a, ExecutionResult<S>>
Resolves the value of a single field on this GraphQLValueAsync
.
The arguments
object contains all the specified arguments, with default values being
substituted for the ones not provided by the query.
The executor
can be used to drive selections into sub-objects.
§Panics
The default implementation panics.
Sourcefn resolve_into_type_async<'a>(
&'a self,
info: &'a Self::TypeInfo,
type_name: &str,
selection_set: Option<&'a [Selection<'a, S>]>,
executor: &'a Executor<'a, 'a, Self::Context, S>,
) -> BoxFuture<'a, ExecutionResult<S>>
fn resolve_into_type_async<'a>( &'a self, info: &'a Self::TypeInfo, type_name: &str, selection_set: Option<&'a [Selection<'a, S>]>, executor: &'a Executor<'a, 'a, Self::Context, S>, ) -> BoxFuture<'a, ExecutionResult<S>>
Resolves this GraphQLValueAsync
(being an interface or an union) into a
concrete downstream object type.
Tries to resolve this GraphQLValueAsync
into the provided type_name
. If the type
matches, then passes the instance along to Executor::resolve
.
§Panics
The default implementation panics.
Sourcefn resolve_async<'a>(
&'a self,
info: &'a Self::TypeInfo,
selection_set: Option<&'a [Selection<'_, S>]>,
executor: &'a Executor<'_, '_, Self::Context, S>,
) -> BoxFuture<'a, ExecutionResult<S>>
fn resolve_async<'a>( &'a self, info: &'a Self::TypeInfo, selection_set: Option<&'a [Selection<'_, S>]>, executor: &'a Executor<'_, '_, Self::Context, S>, ) -> BoxFuture<'a, ExecutionResult<S>>
Resolves the provided selection_set
against this GraphQLValueAsync
.
For non-object types, the selection_set
will be None
and the value should simply
be returned.
For objects, all fields in the selection_set
should be resolved. The default
implementation uses GraphQLValueAsync::resolve_field_async
to resolve all fields,
including those through a fragment expansion.
Since the GraphQL spec specifies that errors during field processing should result in
a null-value, this might return Ok(Null)
in case of a failure. Errors are recorded
internally.
§Panics
The default implementation panics, if selection_set
is None
.