Skip to main content

arcature_db/db/
orm.rs

1use sea_orm::DatabaseConnection;
2
3use super::Db;
4
5impl Db {
6    /// Get the underlying SeaORM [`DatabaseConnection`] for ORM access.
7    ///
8    /// This is the first-class SeaORM path (Phase 4 spec §5). The connection
9    /// is derived over the same `PgPool` — there is no second pool.
10    ///
11    /// SeaORM entities are application-defined (annotated with
12    /// `#[derive(sea_orm::DeriveEntityModel)]`), so this example is `ignore`d
13    /// here. See `examples/basic_query.rs` for a runnable program using the
14    /// SQLx path; the SeaORM path follows the same one-pool structure:
15    ///
16    /// ```ignore
17    /// # use arcature_db::Db;
18    /// # use arcature_db::sea_orm;
19    /// # async fn example(db: &Db) -> Result<(), sea_orm::DbErr> {
20    /// let users = user::Entity::find()
21    ///     .filter(user::Column::Active.eq(true))
22    ///     .all(db.orm())
23    ///     .await?;
24    /// # Ok(())
25    /// # }
26    /// ```
27    pub fn orm(&self) -> &DatabaseConnection {
28        &self.orm
29    }
30}