pub struct ConnectionConfig {
pub url: String,
pub connect_timeout_ms: u64,
pub query_timeout_ms: u64,
pub statement_cache_size: usize,
pub application_name: Option<String>,
pub properties: HashMap<String, String>,
}Expand description
Configuration for creating connections
Fields§
§url: StringConnection URL (e.g., postgres://user:pass@host:5432/db)
connect_timeout_ms: u64Connection timeout in milliseconds
query_timeout_ms: u64Query timeout in milliseconds (0 = no timeout)
statement_cache_size: usizeStatement cache size
application_name: Option<String>Application name (shown in pg_stat_activity, etc)
properties: HashMap<String, String>Additional connection properties
Implementations§
Source§impl ConnectionConfig
impl ConnectionConfig
Sourcepub fn with_connect_timeout(self, ms: u64) -> Self
pub fn with_connect_timeout(self, ms: u64) -> Self
Set connection timeout
Sourcepub fn with_query_timeout(self, ms: u64) -> Self
pub fn with_query_timeout(self, ms: u64) -> Self
Set query timeout
Sourcepub fn with_statement_cache_size(self, size: usize) -> Self
pub fn with_statement_cache_size(self, size: usize) -> Self
Set statement cache size
Sourcepub fn with_application_name(self, name: impl Into<String>) -> Self
pub fn with_application_name(self, name: impl Into<String>) -> Self
Set application name
Trait Implementations§
Source§impl Clone for ConnectionConfig
impl Clone for ConnectionConfig
Source§fn clone(&self) -> ConnectionConfig
fn clone(&self) -> ConnectionConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConnectionConfig
impl Debug for ConnectionConfig
Auto Trait Implementations§
impl Freeze for ConnectionConfig
impl RefUnwindSafe for ConnectionConfig
impl Send for ConnectionConfig
impl Sync for ConnectionConfig
impl Unpin for ConnectionConfig
impl UnsafeUnpin for ConnectionConfig
impl UnwindSafe for ConnectionConfig
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