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

Method ping

src/database/db_connection.rs:462–476  ·  view source on GitHub ↗

Checks if a connection to the database is still valid.

(&self)

Source from the content-addressed store, hash-verified

460
461 /// Checks if a connection to the database is still valid.
462 pub async fn ping(&self) -> Result<(), DbErr> {
463 match self {
464 #[cfg(feature = "sqlx-mysql")]
465 DatabaseConnection::SqlxMySqlPoolConnection(conn) => conn.ping().await,
466 #[cfg(feature = "sqlx-postgres")]
467 DatabaseConnection::SqlxPostgresPoolConnection(conn) => conn.ping().await,
468 #[cfg(feature = "sqlx-sqlite")]
469 DatabaseConnection::SqlxSqlitePoolConnection(conn) => conn.ping().await,
470 #[cfg(feature = "mock")]
471 DatabaseConnection::MockDatabaseConnection(conn) => conn.ping(),
472 #[cfg(feature = "proxy")]
473 DatabaseConnection::ProxyDatabaseConnection(conn) => conn.ping().await,
474 DatabaseConnection::Disconnected => Err(conn_err("Disconnected")),
475 }
476 }
477
478 /// Explicitly close the database connection.
479 /// See [`Self::close_by_ref`] for usage with references.

Callers

nothing calls this directly

Calls 1

conn_errFunction · 0.85

Tested by

no test coverage detected