Struct warpgrapher::engine::context::GraphQLContext
source · [−]pub struct GraphQLContext<RequestCtx: RequestContext> { /* private fields */ }
Expand description
Juniper Context for Warpgrapher’s GraphQL queries. The ‘GraphQLContext’ is used to pass a connection pool for the database in to the resolvers.
Implementations
sourceimpl<RequestCtx> GraphQLContext<RequestCtx> where
RequestCtx: RequestContext,
impl<RequestCtx> GraphQLContext<RequestCtx> where
RequestCtx: RequestContext,
sourcepub fn pool(
&self
) -> &<<RequestCtx as RequestContext>::DBEndpointType as DatabaseEndpoint>::PoolType
pub fn pool(
&self
) -> &<<RequestCtx as RequestContext>::DBEndpointType as DatabaseEndpoint>::PoolType
Returns a pool of database connections
sourcepub fn resolver(&self, name: &str) -> Result<&ResolverFunc<RequestCtx>, Error>
pub fn resolver(&self, name: &str) -> Result<&ResolverFunc<RequestCtx>, Error>
Takes the name of a custom resolver and returns the function implementing that resolver
Errors
Returns an Error
variant ResolverNotFound
if the context does not contain a
resolver function associated with the name argument
sourcepub fn validators(&self) -> &Validators
pub fn validators(&self) -> &Validators
Returns the set of custom input validation functions
sourcepub fn event_handlers(&self) -> &EventHandlerBag<RequestCtx>
pub fn event_handlers(&self) -> &EventHandlerBag<RequestCtx>
Returns the collection of event handlers providing business logic for before and after Warpgrapher’s auto-generated CRUD operations.
sourcepub fn version(&self) -> Option<&String>
pub fn version(&self) -> Option<&String>
Returns an optional string for the version of the GraphQL service
sourcepub fn request_context(&self) -> Option<&RequestCtx>
pub fn request_context(&self) -> Option<&RequestCtx>
Returns the request-specific context
pub fn metadata(&self) -> &HashMap<String, String>
pub fn node_batcher(&self) -> &Batcher<NodeLoader<RequestCtx>>
pub fn rel_batcher(&self) -> &Batcher<RelLoader<RequestCtx>>
Trait Implementations
sourceimpl<RequestCtx> Debug for GraphQLContext<RequestCtx> where
RequestCtx: RequestContext,
impl<RequestCtx> Debug for GraphQLContext<RequestCtx> where
RequestCtx: RequestContext,
impl<RequestCtx> Context for GraphQLContext<RequestCtx> where
RequestCtx: RequestContext,
Auto Trait Implementations
impl<RequestCtx> !RefUnwindSafe for GraphQLContext<RequestCtx>
impl<RequestCtx> Send for GraphQLContext<RequestCtx>
impl<RequestCtx> Sync for GraphQLContext<RequestCtx>
impl<RequestCtx> Unpin for GraphQLContext<RequestCtx> where
RequestCtx: Unpin,
<<RequestCtx as RequestContext>::DBEndpointType as DatabaseEndpoint>::PoolType: Unpin,
impl<RequestCtx> !UnwindSafe for GraphQLContext<RequestCtx>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> FromContext<T> for T where
T: Context,
impl<T> FromContext<T> for T where
T: Context,
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more