pub trait GraphQLHandler: Send + Sync {
// Provided methods
fn on_operation<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 GraphQLContext,
) -> Pin<Box<dyn Future<Output = HandlerResult<Option<Response>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn after_operation<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 GraphQLContext,
response: Response,
) -> Pin<Box<dyn Future<Output = HandlerResult<Response>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn on_error<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 GraphQLContext,
error: String,
) -> Pin<Box<dyn Future<Output = HandlerResult<Response>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn handles_operation(
&self,
operation_name: Option<&str>,
_operation_type: &OperationType,
) -> bool { ... }
fn priority(&self) -> i32 { ... }
}Expand description
Trait for handling GraphQL operations
Provided Methods§
Sourcefn on_operation<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 GraphQLContext,
) -> Pin<Box<dyn Future<Output = HandlerResult<Option<Response>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_operation<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 GraphQLContext,
) -> Pin<Box<dyn Future<Output = HandlerResult<Option<Response>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called before query/mutation execution Return None to proceed with default resolution, Some(Response) to override
Sourcefn after_operation<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 GraphQLContext,
response: Response,
) -> Pin<Box<dyn Future<Output = HandlerResult<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn after_operation<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 GraphQLContext,
response: Response,
) -> Pin<Box<dyn Future<Output = HandlerResult<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called after successful query/mutation execution Allows modification of the response
Sourcefn on_error<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 GraphQLContext,
error: String,
) -> Pin<Box<dyn Future<Output = HandlerResult<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_error<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 GraphQLContext,
error: String,
) -> Pin<Box<dyn Future<Output = HandlerResult<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called when an error occurs
Sourcefn handles_operation(
&self,
operation_name: Option<&str>,
_operation_type: &OperationType,
) -> bool
fn handles_operation( &self, operation_name: Option<&str>, _operation_type: &OperationType, ) -> bool
Check if this handler should handle the given operation