pub struct PoolBuilder { /* private fields */ }Expand description
Builder for configuring a connection pool.
Implementations§
Source§impl PoolBuilder
impl PoolBuilder
pub fn host(self, host: &str) -> Self
pub fn port(self, port: u16) -> Self
pub fn dbname(self, dbname: &str) -> Self
pub fn user(self, user: &str) -> Self
pub fn password(self, password: &str) -> Self
pub fn max_size(self, size: usize) -> Self
Sourcepub fn connect_timeout(self, secs: u64) -> Self
pub fn connect_timeout(self, secs: u64) -> Self
TCP connect timeout in seconds. This is the ONLY timeout in bsql – it exists because TCP itself will wait forever on a dead network.
Sourcepub fn replica(self, url: &str) -> Self
pub fn replica(self, url: &str) -> Self
Add a read replica. SELECT queries will be routed to replicas when
the executor uses query_raw_readonly (generated for SELECT queries).
Multiple replicas are selected round-robin. If a replica is unavailable, the query falls back to the primary.
Format: postgres://user:password@host:port/dbname
pub async fn build(self) -> BsqlResult<Pool>
Auto Trait Implementations§
impl Freeze for PoolBuilder
impl RefUnwindSafe for PoolBuilder
impl Send for PoolBuilder
impl Sync for PoolBuilder
impl Unpin for PoolBuilder
impl UnsafeUnpin for PoolBuilder
impl UnwindSafe for PoolBuilder
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