arcly-http 0.3.0

Enterprise-grade NestJS-inspired web framework on axum: zero-lock DI, declarative controllers, multi-tenant data routing, transactional outbox, ABAC, and a self-documenting OpenAPI surface
Documentation
//! SeaORM adapter — `DatabaseConnection` behind the unified facade.
//!
//! SeaORM wraps SQLx internally, so the connection is `Clone + Send + Sync`
//! with lock-free async acquisition; it drops into `DbDriver` directly.
//! Entity/ActiveModel code keeps full access to the native connection by
//! matching `DbDriver::SeaOrm(conn)` — the facade never hides it.

use crate::data::db::DbDriver;
use crate::data::DataError;

/// Build a SeaORM-backed driver for [`ArclyDbPool`](crate::data::db::ArclyDbPool).
///
/// ```ignore
/// let primary = seaorm_driver("postgres://app@db-primary/orders").await?;
/// ctx.provide(DataSourceRegistry::new(ArclyDbPool::new("default", primary)));
/// ```
pub async fn seaorm_driver(url: &str) -> Result<DbDriver, DataError> {
    let conn = sea_orm::Database::connect(url)
        .await
        .map_err(|e| DataError::connection(format!("sea-orm connect failed: {e}")))?;
    Ok(DbDriver::SeaOrm(conn))
}

/// Native handle accessor for entity queries.
pub fn native(driver: &DbDriver) -> Option<&sea_orm::DatabaseConnection> {
    match driver {
        DbDriver::SeaOrm(c) => Some(c),
        #[allow(unreachable_patterns)]
        _ => None,
    }
}