pub struct Config { /* private fields */ }Expand description
Connection configuration for sentinel-driver.
§Connection String
postgres://user:password@host:port/database?sslmode=prefer&application_name=myapp§Builder
use sentinel_driver::Config;
let config = Config::builder()
.host("localhost")
.port(5432)
.database("mydb")
.user("postgres")
.password("secret")
.build();Implementations§
Source§impl Config
impl Config
Sourcepub fn parse(s: &str) -> Result<Self>
pub fn parse(s: &str) -> Result<Self>
Parse a PostgreSQL connection string.
Supported formats:
postgres://user:password@host:port/database?param=valuepostgresql://user:password@host:port/database?param=value
Sourcepub fn builder() -> ConfigBuilder
pub fn builder() -> ConfigBuilder
Create a new builder for Config.
Sourcepub fn host(&self) -> &str
pub fn host(&self) -> &str
Returns the first host (for backward compatibility and single-host use).
Sourcepub fn port(&self) -> u16
pub fn port(&self) -> u16
Returns the first port (for backward compatibility and single-host use).
Sourcepub fn load_balance_hosts(&self) -> LoadBalanceHosts
pub fn load_balance_hosts(&self) -> LoadBalanceHosts
Load balancing strategy for multi-host connections.
Sourcepub fn target_session_attrs(&self) -> TargetSessionAttrs
pub fn target_session_attrs(&self) -> TargetSessionAttrs
Target session attributes for connection routing.
pub fn database(&self) -> &str
pub fn user(&self) -> &str
pub fn password(&self) -> Option<&str>
pub fn ssl_mode(&self) -> SslMode
pub fn application_name(&self) -> Option<&str>
pub fn connect_timeout(&self) -> Duration
pub fn statement_timeout(&self) -> Option<Duration>
Sourcepub fn ssl_client_cert(&self) -> Option<&Path>
pub fn ssl_client_cert(&self) -> Option<&Path>
Path to client certificate for certificate authentication.
Sourcepub fn ssl_client_key(&self) -> Option<&Path>
pub fn ssl_client_key(&self) -> Option<&Path>
Path to client private key for certificate authentication.
Sourcepub fn ssl_direct(&self) -> bool
pub fn ssl_direct(&self) -> bool
Whether direct TLS (PG 17+) is enabled.
Sourcepub fn channel_binding(&self) -> ChannelBinding
pub fn channel_binding(&self) -> ChannelBinding
Channel binding preference for SCRAM authentication.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more