Skip to content

Commit

Permalink
Add get_port to PgConnectionOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
jwangnz committed Jan 17, 2024
1 parent 2cc3e0f commit f4f2797
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions sqlx-postgres/src/options/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,19 @@ impl PgConnectOptions {
self
}

/// Get the current port.
///
/// # Example
///
/// ```rust
/// # use sqlx_postgres::PgConnectOptions;
/// let options = PgConnectOptions::new();
/// assert_eq!(options.get_port(), 5432);
/// ```
pub fn get_port(&self) -> u16 {
self.port
}

/// Sets a custom path to a directory containing a unix domain socket,
/// switching the connection method from TCP to the corresponding socket.
///
Expand Down

0 comments on commit f4f2797

Please sign in to comment.