Trait async_graphql::extensions::Extension[][src]

pub trait Extension: Sync + Send + 'static {
    fn name(&self) -> Option<&'static str> { ... }
fn start(&mut self, ctx: &ExtensionContext<'_>) { ... }
fn end(&mut self, ctx: &ExtensionContext<'_>) { ... }
#[must_use] fn prepare_request<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 mut self,
        ctx: &'life1 ExtensionContext<'life2>,
        request: Request
    ) -> Pin<Box<dyn Future<Output = ServerResult<Request>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        Self: 'async_trait
, { ... }
fn parse_start(
        &mut self,
        ctx: &ExtensionContext<'_>,
        query_source: &str,
        variables: &Variables
    ) { ... }
fn parse_end(
        &mut self,
        ctx: &ExtensionContext<'_>,
        document: &ExecutableDocument
    ) { ... }
fn validation_start(&mut self, ctx: &ExtensionContext<'_>) { ... }
fn validation_end(
        &mut self,
        ctx: &ExtensionContext<'_>,
        result: &ValidationResult
    ) { ... }
fn execution_start(&mut self, ctx: &ExtensionContext<'_>) { ... }
fn execution_end(&mut self, ctx: &ExtensionContext<'_>) { ... }
fn resolve_start(
        &mut self,
        ctx: &ExtensionContext<'_>,
        info: &ResolveInfo<'_>
    ) { ... }
fn resolve_end(
        &mut self,
        ctx: &ExtensionContext<'_>,
        info: &ResolveInfo<'_>
    ) { ... }
fn error(&mut self, ctx: &ExtensionContext<'_>, err: &ServerError) { ... }
fn result(&mut self, ctx: &ExtensionContext<'_>) -> Option<Value> { ... } }

Represents a GraphQL extension

Call order for query and mutation

  • start
    • prepare_request
    • parse_start
    • parse_end
    • validation_start
    • validation_end
    • execution_start
      • resolve_start
      • resolve_end
    • result
    • execution_end
  • end

Call order for subscription

  • start
  • prepare_request
  • parse_start
  • parse_end
  • validation_start
  • validation_end
    • execution_start
      • resolve_start
      • resolve_end
    • execution_end
    • result

Provided methods

fn name(&self) -> Option<&'static str>[src]

If this extension needs to output data to query results, you need to specify a name.

fn start(&mut self, ctx: &ExtensionContext<'_>)[src]

Called at the beginning of query.

fn end(&mut self, ctx: &ExtensionContext<'_>)[src]

Called at the beginning of query.

#[must_use]fn prepare_request<'life0, 'life1, 'life2, 'async_trait>(
    &'life0 mut self,
    ctx: &'life1 ExtensionContext<'life2>,
    request: Request
) -> Pin<Box<dyn Future<Output = ServerResult<Request>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    Self: 'async_trait, 
[src]

Called at prepare request.

fn parse_start(
    &mut self,
    ctx: &ExtensionContext<'_>,
    query_source: &str,
    variables: &Variables
)
[src]

Called at the beginning of parse query source.

fn parse_end(
    &mut self,
    ctx: &ExtensionContext<'_>,
    document: &ExecutableDocument
)
[src]

Called at the end of parse query source.

fn validation_start(&mut self, ctx: &ExtensionContext<'_>)[src]

Called at the beginning of the validation.

fn validation_end(
    &mut self,
    ctx: &ExtensionContext<'_>,
    result: &ValidationResult
)
[src]

Called at the end of the validation.

fn execution_start(&mut self, ctx: &ExtensionContext<'_>)[src]

Called at the beginning of execute a query.

fn execution_end(&mut self, ctx: &ExtensionContext<'_>)[src]

Called at the end of execute a query.

fn resolve_start(&mut self, ctx: &ExtensionContext<'_>, info: &ResolveInfo<'_>)[src]

Called at the beginning of resolve a field.

fn resolve_end(&mut self, ctx: &ExtensionContext<'_>, info: &ResolveInfo<'_>)[src]

Called at the end of resolve a field.

fn error(&mut self, ctx: &ExtensionContext<'_>, err: &ServerError)[src]

Called when an error occurs.

fn result(&mut self, ctx: &ExtensionContext<'_>) -> Option<Value>[src]

Get the results.

Loading content...

Implementors

Loading content...