pub struct PostgresConfig { /* private fields */ }Expand description
Facade-owned PostgreSQL pool, TLS, and timeout configuration.
Debug deliberately omits the connection string and certificate path.
Implementations§
Source§impl PostgresConfig
impl PostgresConfig
Sourcepub fn new(
connection_string: impl Into<String>,
) -> Result<Self, PostgresConfigError>
pub fn new( connection_string: impl Into<String>, ) -> Result<Self, PostgresConfigError>
Builds production-default configuration for a PostgreSQL connection.
The connection string is treated as a secret and is never included in facade diagnostics.
§Errors
Returns PostgresConfigError when the connection string is empty.
Sourcepub fn with_tls_mode(self, tls_mode: TlsMode) -> Self
pub fn with_tls_mode(self, tls_mode: TlsMode) -> Self
Selects certificate validation or explicit plaintext transport.
Sourcepub fn with_pool_size(self, value: u32) -> Result<Self, PostgresConfigError>
pub fn with_pool_size(self, value: u32) -> Result<Self, PostgresConfigError>
Sourcepub fn with_acquire_timeout(
self,
value: Duration,
) -> Result<Self, PostgresConfigError>
pub fn with_acquire_timeout( self, value: Duration, ) -> Result<Self, PostgresConfigError>
Sets connection acquisition timeout.
§Errors
Rejects values outside 1 ms through 5 minutes or above close timeout.
Sourcepub fn with_connect_timeout(
self,
value: Duration,
) -> Result<Self, PostgresConfigError>
pub fn with_connect_timeout( self, value: Duration, ) -> Result<Self, PostgresConfigError>
Sets TCP, TLS, authentication establishment timeout.
§Errors
Rejects values outside 1 ms through 5 minutes.
Sourcepub fn with_statement_timeout(
self,
value: Duration,
) -> Result<Self, PostgresConfigError>
pub fn with_statement_timeout( self, value: Duration, ) -> Result<Self, PostgresConfigError>
Sets the ordinary server-side statement timeout.
§Errors
Rejects values outside 1 ms through 24 hours or below lock timeout.
Sourcepub fn with_lock_timeout(
self,
value: Duration,
) -> Result<Self, PostgresConfigError>
pub fn with_lock_timeout( self, value: Duration, ) -> Result<Self, PostgresConfigError>
Sets the server-side lock timeout.
§Errors
Rejects values outside 1 ms through 5 minutes or above statement timeout.
Sourcepub fn with_idle_transaction_timeout(
self,
value: Duration,
) -> Result<Self, PostgresConfigError>
pub fn with_idle_transaction_timeout( self, value: Duration, ) -> Result<Self, PostgresConfigError>
Sets protection against idle open transactions.
§Errors
Rejects values outside 1 second through 24 hours.
Sourcepub fn with_connection_idle_timeout(
self,
value: Duration,
) -> Result<Self, PostgresConfigError>
pub fn with_connection_idle_timeout( self, value: Duration, ) -> Result<Self, PostgresConfigError>
Sourcepub fn with_connection_max_lifetime(
self,
value: Duration,
) -> Result<Self, PostgresConfigError>
pub fn with_connection_max_lifetime( self, value: Duration, ) -> Result<Self, PostgresConfigError>
Sets the maximum physical connection lifetime.
§Errors
Rejects values outside 1 minute through 7 days.
Sourcepub fn with_pool_close_timeout(
self,
value: Duration,
) -> Result<Self, PostgresConfigError>
pub fn with_pool_close_timeout( self, value: Duration, ) -> Result<Self, PostgresConfigError>
Sets cooperative pool shutdown timeout.
§Errors
Rejects values outside 1 ms through 5 minutes or below acquire timeout.
Trait Implementations§
Source§impl Clone for PostgresConfig
impl Clone for PostgresConfig
Source§fn clone(&self) -> PostgresConfig
fn clone(&self) -> PostgresConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PostgresConfig
impl RefUnwindSafe for PostgresConfig
impl Send for PostgresConfig
impl Sync for PostgresConfig
impl Unpin for PostgresConfig
impl UnsafeUnpin for PostgresConfig
impl UnwindSafe for PostgresConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more