MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / close_by_ref

Method close_by_ref

src/database/db_connection.rs:485–505  ·  view source on GitHub ↗

Explicitly close the database connection

(&self)

Source from the content-addressed store, hash-verified

483
484 /// Explicitly close the database connection
485 pub async fn close_by_ref(&self) -> Result<(), DbErr> {
486 match self {
487 #[cfg(feature = "sqlx-mysql")]
488 DatabaseConnection::SqlxMySqlPoolConnection(conn) => conn.close_by_ref().await,
489 #[cfg(feature = "sqlx-postgres")]
490 DatabaseConnection::SqlxPostgresPoolConnection(conn) => conn.close_by_ref().await,
491 #[cfg(feature = "sqlx-sqlite")]
492 DatabaseConnection::SqlxSqlitePoolConnection(conn) => conn.close_by_ref().await,
493 #[cfg(feature = "mock")]
494 DatabaseConnection::MockDatabaseConnection(_) => {
495 // Nothing to cleanup, we just consume the `DatabaseConnection`
496 Ok(())
497 }
498 #[cfg(feature = "proxy")]
499 DatabaseConnection::ProxyDatabaseConnection(_) => {
500 // Nothing to cleanup, we just consume the `DatabaseConnection`
501 Ok(())
502 }
503 DatabaseConnection::Disconnected => Err(conn_err("Disconnected")),
504 }
505 }
506}
507
508impl DatabaseConnection {

Callers 1

closeMethod · 0.45

Calls 1

conn_errFunction · 0.85

Tested by

no test coverage detected