mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-03 15:55:45 +00:00
Expose connect_options
for initialized pools and database
on the PgConnectOptions
(#1897)
* Expose ConnectOptions * Expose PoolOptions
This commit is contained in:
parent
664d576655
commit
21590d51f5
@ -435,6 +435,16 @@ impl<DB: Database> Pool<DB> {
|
|||||||
pub fn num_idle(&self) -> usize {
|
pub fn num_idle(&self) -> usize {
|
||||||
self.0.num_idle()
|
self.0.num_idle()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the connection options for this pool
|
||||||
|
pub fn connect_options(&self) -> &<DB::Connection as Connection>::Options {
|
||||||
|
&self.0.connect_options
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get the options for this pool
|
||||||
|
pub fn options(&self) -> &PoolOptions<DB> {
|
||||||
|
&self.0.options
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(
|
#[cfg(all(
|
||||||
|
@ -260,6 +260,20 @@ impl PgConnectOptions {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the current database name.
|
||||||
|
///
|
||||||
|
/// # Example
|
||||||
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// # use sqlx_core::postgres::PgConnectOptions;
|
||||||
|
/// let options = PgConnectOptions::new()
|
||||||
|
/// .database("postgres");
|
||||||
|
/// assert!(options.get_database().is_some());
|
||||||
|
/// ```
|
||||||
|
pub fn get_database(&self) -> Option<&str> {
|
||||||
|
self.database.as_deref()
|
||||||
|
}
|
||||||
|
|
||||||
/// Sets whether or with what priority a secure SSL TCP/IP connection will be negotiated
|
/// Sets whether or with what priority a secure SSL TCP/IP connection will be negotiated
|
||||||
/// with the server.
|
/// with the server.
|
||||||
///
|
///
|
||||||
|
Loading…
x
Reference in New Issue
Block a user