Expand description
Type-erased executor interface.
This module provides ExecutorAdapter, a trait that allows code driving
query execution (e.g., fraiseql-server, tests) to hold an
Arc<dyn ExecutorAdapter> without being generic over a concrete
DatabaseAdapter type parameter.
§Design Rationale
Executor<A> is generic over its database adapter. Without type erasure,
every struct that holds an executor — the HTTP server, middleware, test
harnesses — must carry that type parameter, which produces significant
generic noise and makes dynamic dispatch impossible.
ExecutorAdapter solves this by providing a single object-safe trait that
concrete Executor<A> implementations can implement, enabling uniform
Arc<dyn ExecutorAdapter> storage.
§Example
// Requires: a concrete ExecutorAdapter implementation.
use fraiseql_core::runtime::{ExecutionContext, ExecutorAdapter};
use std::sync::Arc;
async fn run_query(exec: Arc<dyn ExecutorAdapter>, query: &str) -> String {
let ctx = ExecutionContext::new("query-1".to_string());
exec.execute_with_context(query, None, &ctx).await.unwrap()
}Traits§
- Executor
Adapter - Type-erased executor interface.