diff --git a/Cargo.lock b/Cargo.lock index cdcfe567fb..b56dcf3296 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -989,9 +989,9 @@ dependencies = [ [[package]] name = "git2" -version = "0.13.25" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29229cc1b24c0e6062f6e742aa3e256492a5323365e5ed3413599f8a5eff7d6" +checksum = "3826a6e0e2215d7a41c2bfc7c9244123969273f3476b939a226aac0ab56e9e3c" dependencies = [ "bitflags", "libc", @@ -1225,9 +1225,9 @@ checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" [[package]] name = "libgit2-sys" -version = "0.12.26+1.3.0" +version = "0.13.2+1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e1c899248e606fbfe68dcb31d8b0176ebab833b103824af31bddf4b7457494" +checksum = "3a42de9a51a5c12e00fc0e4ca6bc2ea43582fc6418488e8f615e905d886f258b" dependencies = [ "cc", "libc", diff --git a/sqlx-core/src/postgres/connection/mod.rs b/sqlx-core/src/postgres/connection/mod.rs index 965342bfc4..ba25ddd9b7 100644 --- a/sqlx-core/src/postgres/connection/mod.rs +++ b/sqlx-core/src/postgres/connection/mod.rs @@ -67,6 +67,11 @@ pub struct PgConnection { } impl PgConnection { + /// the version number of the server in `libpq` format + pub fn server_version_num(&self) -> Option { + self.stream.server_version_num + } + // will return when the connection is ready for another query pub(in crate::postgres) async fn wait_until_ready(&mut self) -> Result<(), Error> { if !self.stream.wbuf.is_empty() { @@ -187,20 +192,3 @@ impl Connection for PgConnection { !self.stream.wbuf.is_empty() } } - -pub trait PgConnectionInfo { - /// the version number of the server in `libpq` format - fn server_version_num(&self) -> Option; -} - -impl PgConnectionInfo for PgConnection { - fn server_version_num(&self) -> Option { - self.stream.server_version_num - } -} - -impl PgConnectionInfo for crate::pool::PoolConnection { - fn server_version_num(&self) -> Option { - self.stream.server_version_num - } -} diff --git a/sqlx-core/src/postgres/mod.rs b/sqlx-core/src/postgres/mod.rs index e2966c6da8..0f6bd7c0be 100644 --- a/sqlx-core/src/postgres/mod.rs +++ b/sqlx-core/src/postgres/mod.rs @@ -27,7 +27,7 @@ mod migrate; pub use advisory_lock::{PgAdvisoryLock, PgAdvisoryLockGuard, PgAdvisoryLockKey}; pub use arguments::{PgArgumentBuffer, PgArguments}; pub use column::PgColumn; -pub use connection::{PgConnection, PgConnectionInfo}; +pub use connection::PgConnection; pub use copy::PgCopyIn; pub use database::Postgres; pub use error::{PgDatabaseError, PgErrorPosition}; diff --git a/tests/postgres/postgres.rs b/tests/postgres/postgres.rs index f4078ac1bc..e702b29c72 100644 --- a/tests/postgres/postgres.rs +++ b/tests/postgres/postgres.rs @@ -1,8 +1,8 @@ use futures::{StreamExt, TryStreamExt}; use sqlx::postgres::types::Oid; use sqlx::postgres::{ - PgAdvisoryLock, PgConnectOptions, PgConnection, PgConnectionInfo, PgDatabaseError, - PgErrorPosition, PgListener, PgPoolOptions, PgRow, PgSeverity, Postgres, + PgAdvisoryLock, PgConnectOptions, PgConnection, PgDatabaseError, PgErrorPosition, PgListener, + PgPoolOptions, PgRow, PgSeverity, Postgres, }; use sqlx::{Column, Connection, Executor, Row, Statement, TypeInfo}; use sqlx_test::{new, pool, setup_if_needed}; @@ -1202,8 +1202,6 @@ VALUES #[sqlx_macros::test] async fn test_pg_server_num() -> anyhow::Result<()> { - use sqlx::postgres::PgConnectionInfo; - let conn = new::().await?; assert!(conn.server_version_num().is_some());