Skip to main content

ExecutorAdapter

Trait ExecutorAdapter 

Source
pub trait ExecutorAdapter: Send + Sync {
    // Required method
    fn execute_with_context<'a>(
        &'a self,
        query: &'a str,
        variables: Option<&'a Value>,
        ctx: &'a ExecutionContext,
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'a>>;
}
Expand description

Type-erased executor interface.

Allows code that drives query execution (fraiseql-server, tests) to hold Arc<dyn ExecutorAdapter> without being generic over DatabaseAdapter.

Concrete implementations should implement this trait on their Executor<A> type to participate in the type-erased execution path.

Required Methods§

Source

fn execute_with_context<'a>( &'a self, query: &'a str, variables: Option<&'a Value>, ctx: &'a ExecutionContext, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'a>>

Execute a GraphQL query string with an execution context.

§Arguments
  • query — the raw GraphQL query document
  • variables — optional JSON object of query variables
  • ctx — execution context carrying the query ID and cancellation token
§Returns

A JSON-serialised GraphQL response string on success.

§Errors

Returns a crate::error::FraiseQLError if parsing, validation, or SQL execution fails, or if the context’s cancellation token has already been triggered.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§