Skip to content

Commit ffc72ff

Browse files
committed
refactor(core): deprecate PgConnectionInfo
Signed-off-by: Atkins Chang <atkinschang@gmail.com>
1 parent 207e6db commit ffc72ff

File tree

1 file changed

+12
-2
lines changed
  • sqlx-core/src/postgres/connection

1 file changed

+12
-2
lines changed

sqlx-core/src/postgres/connection/mod.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ pub struct PgConnection {
6565
}
6666

6767
impl PgConnection {
68+
/// the version number of the server in `libpq` format
69+
pub fn server_version_num(&self) -> Option<u32> {
70+
self.stream.server_version_num
71+
}
72+
6873
// will return when the connection is ready for another query
6974
async fn wait_until_ready(&mut self) -> Result<(), Error> {
7075
if !self.stream.wbuf.is_empty() {
@@ -178,19 +183,24 @@ impl Connection for PgConnection {
178183
}
179184
}
180185

186+
#[deprecated(since = "0.5.7")]
181187
pub trait PgConnectionInfo {
182188
/// the version number of the server in `libpq` format
189+
#[deprecated(
190+
since = "0.5.7",
191+
note = "please use `server_version_num` from impl instead"
192+
)]
183193
fn server_version_num(&self) -> Option<u32>;
184194
}
185195

186196
impl PgConnectionInfo for PgConnection {
187197
fn server_version_num(&self) -> Option<u32> {
188-
self.stream.server_version_num
198+
self.server_version_num()
189199
}
190200
}
191201

192202
impl PgConnectionInfo for crate::pool::PoolConnection<Postgres> {
193203
fn server_version_num(&self) -> Option<u32> {
194-
self.stream.server_version_num
204+
self.server_version_num()
195205
}
196206
}

0 commit comments

Comments
 (0)