pub struct ConnectionConfigBuilder { /* private fields */ }Expand description
Builder for creating ConnectionConfig with advanced options
Provides a fluent API for configuring timeouts, keepalive, and application name.
§Examples
use fraiseql_wire::connection::ConnectionConfig;
use std::time::Duration;
let config = ConnectionConfig::builder("mydb", "user")
.password("secret")
.connect_timeout(Duration::from_secs(10))
.statement_timeout(Duration::from_secs(30))
.keepalive_idle(Duration::from_secs(300))
.application_name("my_app")
.build();Implementations§
Source§impl ConnectionConfigBuilder
impl ConnectionConfigBuilder
Sourcepub fn password(self, password: impl Into<String>) -> Self
pub fn password(self, password: impl Into<String>) -> Self
Set the password (automatically zeroed on drop)
Sourcepub fn param(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn param(self, key: impl Into<String>, value: impl Into<String>) -> Self
Add a connection parameter
Sourcepub const fn connect_timeout(self, duration: Duration) -> Self
pub const fn connect_timeout(self, duration: Duration) -> Self
Set TCP connection timeout
Default: None (no timeout)
§Arguments
duration- Timeout duration for establishing TCP connection
Sourcepub const fn statement_timeout(self, duration: Duration) -> Self
pub const fn statement_timeout(self, duration: Duration) -> Self
Set statement (query) timeout
Default: None (unlimited)
§Arguments
duration- Timeout duration for query execution
Sourcepub const fn keepalive_idle(self, duration: Duration) -> Self
pub const fn keepalive_idle(self, duration: Duration) -> Self
Set TCP keepalive idle interval
Default: None (OS default)
§Arguments
duration- Idle duration before sending keepalive probes
Sourcepub fn application_name(self, name: impl Into<String>) -> Self
pub fn application_name(self, name: impl Into<String>) -> Self
Set application name for Postgres logs
Default: None (Postgres will not set application_name)
§Arguments
name- Application name to identify in Postgres logs
Sourcepub const fn extra_float_digits(self, digits: i32) -> Self
pub const fn extra_float_digits(self, digits: i32) -> Self
Set extra_float_digits for float precision
Default: None (use Postgres default)
§Arguments
digits- Number of extra digits (typically 0-2)
Sourcepub fn build(self) -> ConnectionConfig
pub fn build(self) -> ConnectionConfig
Build the configuration
Trait Implementations§
Source§impl Clone for ConnectionConfigBuilder
impl Clone for ConnectionConfigBuilder
Source§fn clone(&self) -> ConnectionConfigBuilder
fn clone(&self) -> ConnectionConfigBuilder
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 moreAuto Trait Implementations§
impl Freeze for ConnectionConfigBuilder
impl RefUnwindSafe for ConnectionConfigBuilder
impl Send for ConnectionConfigBuilder
impl Sync for ConnectionConfigBuilder
impl Unpin for ConnectionConfigBuilder
impl UnsafeUnpin for ConnectionConfigBuilder
impl UnwindSafe for ConnectionConfigBuilder
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