pub struct PoolBuilder { /* private fields */ }Expand description
Connection pool builder
§Example
let pool = PoolBuilder::default() .with_database("default") .with_username("default") .with_password("") .add_addr("www.example.com:9000") .build() .unwrap();
Implementations§
Source§impl PoolBuilder
impl PoolBuilder
Sourcepub fn with_compression(self) -> Self
pub fn with_compression(self) -> Self
Set compression option This make connection use LZ4 compression for block data transfer
Sourcepub fn with_ping(self) -> Self
pub fn with_ping(self) -> Self
If set, this option make connection check server availability after it is received from pool.
Sourcepub fn with_pool(self, min: u16, max: u16) -> Self
pub fn with_pool(self, min: u16, max: u16) -> Self
Set connection pool boundaries min - set the number of idle connection that the pool can keep up to max - set maximum number of connection that pool can issued
Sourcepub fn with_username(self, value: impl ToString) -> Self
pub fn with_username(self, value: impl ToString) -> Self
Set the username that is used in authentication
Sourcepub fn with_database(self, value: impl ToString) -> Self
pub fn with_database(self, value: impl ToString) -> Self
Set the default database that is used in query processing if the query doesn’t explicitly specify another database name
Sourcepub fn with_password(self, value: impl ToString) -> Self
pub fn with_password(self, value: impl ToString) -> Self
Set password that is used in authentication
Sourcepub fn add_addr(self, value: impl ToString) -> Self
pub fn add_addr(self, value: impl ToString) -> Self
Set server host address.
Address must have domain name and port number
§Example
PoolBuilder::new() .with_addr('example1.com:9000') .with_addr('example2.com:9000');
Connection pool can have multiple addresses
In this case next connection randomly chooses any
available one if it’s reachable