pub mod pool_factory;
use std::{future::Future, pin::Pin, sync::Arc};
use fraiseql_core::runtime::Executor;
use fraiseql_error::Result;
pub use pool_factory::{FromPoolConfig, TenantPoolConfig, create_tenant_executor};
pub type TenantExecutorFactory<A> = Arc<
dyn Fn(
String,
TenantPoolConfig,
) -> Pin<Box<dyn Future<Output = Result<Arc<Executor<A>>>> + Send>>
+ Send
+ Sync,
>;
pub fn make_executor_factory<A: FromPoolConfig + 'static>() -> TenantExecutorFactory<A> {
Arc::new(|schema_json, pool_config| {
Box::pin(async move { create_tenant_executor::<A>(&schema_json, &pool_config).await })
})
}