pub mod audit;
pub mod pool_factory;
pub mod schema_isolation;
#[cfg(test)]
mod tests;
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, destroy_tenant_schema,
};
pub type TenantExecutorFactory<A> = Arc<
dyn Fn(
String,
String,
TenantPoolConfig,
) -> Pin<Box<dyn Future<Output = Result<Arc<Executor<A>>>> + Send>>
+ Send
+ Sync,
>;
#[must_use]
pub fn make_executor_factory<A: FromPoolConfig + 'static>() -> TenantExecutorFactory<A> {
Arc::new(|tenant_key, schema_json, pool_config| {
Box::pin(async move {
create_tenant_executor::<A>(&tenant_key, &schema_json, &pool_config).await
})
})
}