Struct juniper::http::GraphQLResponse
source · pub struct GraphQLResponse<'a, S = DefaultScalarValue>(_);
Expand description
Simple wrapper around the result from executing a GraphQL query
This struct implements Serialize, so you can simply serialize this
to JSON and send it over the wire. Use the is_ok
method to determine
whether to send a 200 or 400 HTTP status code.
Implementations§
source§impl<'a, S> GraphQLResponse<'a, S>where
S: ScalarValue,
impl<'a, S> GraphQLResponse<'a, S>where
S: ScalarValue,
sourcepub fn from_result(
r: Result<(Value<S>, Vec<ExecutionError<S>>), GraphQLError<'a>>
) -> Self
pub fn from_result(
r: Result<(Value<S>, Vec<ExecutionError<S>>), GraphQLError<'a>>
) -> Self
Constructs new GraphQLResponse
using the given result
sourcepub fn error(error: FieldError<S>) -> Self
pub fn error(error: FieldError<S>) -> Self
Constructs an error response outside of the normal execution flow