Struct juniper_iron::GraphQLHandler
source · pub struct GraphQLHandler<'a, CtxFactory, Query, Mutation, CtxT, S = DefaultScalarValue>where
S: ScalarValue,
for<'b> &'b S: ScalarRefValue<'b>,
CtxFactory: Fn(&mut Request<'_, '_>) -> IronResult<CtxT> + Send + Sync + 'static,
CtxT: 'static,
Query: GraphQLType<S, Context = CtxT> + Send + Sync + 'static,
Mutation: GraphQLType<S, Context = CtxT> + Send + Sync + 'static,{ /* private fields */ }
Expand description
Handler that executes GraphQL
queries in the given schema
The handler responds to GET requests and POST requests only. In GET
requests, the query should be supplied in the query
URL parameter, e.g.
http://localhost:3000/graphql?query={hero{name}}
.
POST requests support both queries and variables. POST a JSON document to
this endpoint containing the field "query"
and optionally "variables"
.
The variables should be a JSON object containing the variable to value
mapping.
Implementations§
source§impl<'a, CtxFactory, Query, Mutation, CtxT, S> GraphQLHandler<'a, CtxFactory, Query, Mutation, CtxT, S>where
S: ScalarValue + 'a,
for<'b> &'b S: ScalarRefValue<'b>,
CtxFactory: Fn(&mut Request<'_, '_>) -> IronResult<CtxT> + Send + Sync + 'static,
CtxT: 'static,
Query: GraphQLType<S, Context = CtxT, TypeInfo = ()> + Send + Sync + 'static,
Mutation: GraphQLType<S, Context = CtxT, TypeInfo = ()> + Send + Sync + 'static,
impl<'a, CtxFactory, Query, Mutation, CtxT, S> GraphQLHandler<'a, CtxFactory, Query, Mutation, CtxT, S>where
S: ScalarValue + 'a,
for<'b> &'b S: ScalarRefValue<'b>,
CtxFactory: Fn(&mut Request<'_, '_>) -> IronResult<CtxT> + Send + Sync + 'static,
CtxT: 'static,
Query: GraphQLType<S, Context = CtxT, TypeInfo = ()> + Send + Sync + 'static,
Mutation: GraphQLType<S, Context = CtxT, TypeInfo = ()> + Send + Sync + 'static,
sourcepub fn new(context_factory: CtxFactory, query: Query, mutation: Mutation) -> Self
pub fn new(context_factory: CtxFactory, query: Query, mutation: Mutation) -> Self
Build a new GraphQL handler
The context factory will receive the Iron request object and is expected to construct a context object for the given schema. This can be used to construct e.g. database connections or similar data that the schema needs to execute the query.
Trait Implementations§
source§impl<'a, CtxFactory, Query, Mutation, CtxT, S> Handler for GraphQLHandler<'a, CtxFactory, Query, Mutation, CtxT, S>where
S: ScalarValue + Sync + Send + 'static,
for<'b> &'b S: ScalarRefValue<'b>,
CtxFactory: Fn(&mut Request<'_, '_>) -> IronResult<CtxT> + Send + Sync + 'static,
CtxT: 'static,
Query: GraphQLType<S, Context = CtxT, TypeInfo = ()> + Send + Sync + 'static,
Mutation: GraphQLType<S, Context = CtxT, TypeInfo = ()> + Send + Sync + 'static,
'a: 'static,
impl<'a, CtxFactory, Query, Mutation, CtxT, S> Handler for GraphQLHandler<'a, CtxFactory, Query, Mutation, CtxT, S>where
S: ScalarValue + Sync + Send + 'static,
for<'b> &'b S: ScalarRefValue<'b>,
CtxFactory: Fn(&mut Request<'_, '_>) -> IronResult<CtxT> + Send + Sync + 'static,
CtxT: 'static,
Query: GraphQLType<S, Context = CtxT, TypeInfo = ()> + Send + Sync + 'static,
Mutation: GraphQLType<S, Context = CtxT, TypeInfo = ()> + Send + Sync + 'static,
'a: 'static,
Auto Trait Implementations§
impl<'a, CtxFactory, Query, Mutation, CtxT, S> RefUnwindSafe for GraphQLHandler<'a, CtxFactory, Query, Mutation, CtxT, S>where
CtxFactory: RefUnwindSafe,
Mutation: RefUnwindSafe,
Query: RefUnwindSafe,
S: RefUnwindSafe,
<Mutation as GraphQLType<S>>::TypeInfo: RefUnwindSafe,
<Query as GraphQLType<S>>::TypeInfo: RefUnwindSafe,
impl<'a, CtxFactory, Query, Mutation, CtxT, S> Send for GraphQLHandler<'a, CtxFactory, Query, Mutation, CtxT, S>where
S: Send,
<Mutation as GraphQLType<S>>::TypeInfo: Send,
<Query as GraphQLType<S>>::TypeInfo: Send,
impl<'a, CtxFactory, Query, Mutation, CtxT, S> Sync for GraphQLHandler<'a, CtxFactory, Query, Mutation, CtxT, S>where
S: Sync,
<Mutation as GraphQLType<S>>::TypeInfo: Sync,
<Query as GraphQLType<S>>::TypeInfo: Sync,
impl<'a, CtxFactory, Query, Mutation, CtxT, S> Unpin for GraphQLHandler<'a, CtxFactory, Query, Mutation, CtxT, S>where
CtxFactory: Unpin,
Mutation: Unpin,
Query: Unpin,
S: Unpin,
<Mutation as GraphQLType<S>>::TypeInfo: Unpin,
<Query as GraphQLType<S>>::TypeInfo: Unpin,
impl<'a, CtxFactory, Query, Mutation, CtxT, S> UnwindSafe for GraphQLHandler<'a, CtxFactory, Query, Mutation, CtxT, S>where
CtxFactory: UnwindSafe,
Mutation: UnwindSafe,
Query: UnwindSafe,
S: UnwindSafe,
<Mutation as GraphQLType<S>>::TypeInfo: UnwindSafe,
<Query as GraphQLType<S>>::TypeInfo: UnwindSafe,
Blanket Implementations§
§impl<T> PersistentInto<Arc<Mutex<T>>> for T
impl<T> PersistentInto<Arc<Mutex<T>>> for T
§fn persistent_into(self) -> Arc<Mutex<T>>
fn persistent_into(self) -> Arc<Mutex<T>>
Convert
self
into a value of type T
.§impl<T> PersistentInto<Arc<RwLock<T>>> for T
impl<T> PersistentInto<Arc<RwLock<T>>> for T
§fn persistent_into(self) -> Arc<RwLock<T>>
fn persistent_into(self) -> Arc<RwLock<T>>
Convert
self
into a value of type T
.§impl<T> PersistentInto<Arc<T>> for T
impl<T> PersistentInto<Arc<T>> for T
§fn persistent_into(self) -> Arc<T>
fn persistent_into(self) -> Arc<T>
Convert
self
into a value of type T
.§impl<T> PersistentInto<T> for T
impl<T> PersistentInto<T> for T
§fn persistent_into(self) -> T
fn persistent_into(self) -> T
Convert
self
into a value of type T
.