arcature_db/db/close.rs
1use super::Db;
2
3impl Db {
4 /// Close the one connection pool.
5 ///
6 /// This closes the underlying `PgPool`. All cloned `Db` handles share the
7 /// same pool (it is `Arc`-backed internally), so closing from one handle
8 /// closes the pool for all handles (Phase 4 spec ยง29). The SeaORM
9 /// `DatabaseConnection` is also closed because it operates over the same
10 /// pool.
11 ///
12 /// After `close`, [`Db::ping`](crate::Db::ping) returns
13 /// [`DbHealthError::Closed`](crate::DbHealthError::Closed) and queries fail
14 /// with a pool-closed error.
15 pub async fn close(self) {
16 self.pool.close().await;
17 }
18}