Struct collab2::db::ConnectOptions
pub struct ConnectOptions { /* private fields */ }
Expand description
Defines the configuration options of a database
Implementations§
§impl ConnectOptions
impl ConnectOptions
pub fn new<T>(url: T) -> ConnectOptionswhere
T: Into<String>,
pub fn new<T>(url: T) -> ConnectOptionswhere T: Into<String>,
Create new ConnectOptions for a [Database] by passing in a URI string
pub fn pool_options<DB>(self) -> PoolOptions<DB>where
DB: Database,
pub fn pool_options<DB>(self) -> PoolOptions<DB>where DB: Database,
Convert ConnectOptions into [sqlx::pool::PoolOptions]
pub fn max_connections(&mut self, value: u32) -> &mut ConnectOptions
pub fn max_connections(&mut self, value: u32) -> &mut ConnectOptions
Set the maximum number of connections of the pool
pub fn get_max_connections(&self) -> Option<u32>
pub fn get_max_connections(&self) -> Option<u32>
Get the maximum number of connections of the pool, if set
pub fn min_connections(&mut self, value: u32) -> &mut ConnectOptions
pub fn min_connections(&mut self, value: u32) -> &mut ConnectOptions
Set the minimum number of connections of the pool
pub fn get_min_connections(&self) -> Option<u32>
pub fn get_min_connections(&self) -> Option<u32>
Get the minimum number of connections of the pool, if set
pub fn connect_timeout(&mut self, value: Duration) -> &mut ConnectOptions
pub fn connect_timeout(&mut self, value: Duration) -> &mut ConnectOptions
Set the timeout duration when acquiring a connection
pub fn get_connect_timeout(&self) -> Option<Duration>
pub fn get_connect_timeout(&self) -> Option<Duration>
Get the timeout duration when acquiring a connection, if set
pub fn idle_timeout(&mut self, value: Duration) -> &mut ConnectOptions
pub fn idle_timeout(&mut self, value: Duration) -> &mut ConnectOptions
Set the idle duration before closing a connection
pub fn get_idle_timeout(&self) -> Option<Duration>
pub fn get_idle_timeout(&self) -> Option<Duration>
Get the idle duration before closing a connection, if set
pub fn acquire_timeout(&mut self, value: Duration) -> &mut ConnectOptions
pub fn acquire_timeout(&mut self, value: Duration) -> &mut ConnectOptions
Set the maximum amount of time to spend waiting for acquiring a connection
pub fn get_acquire_timeout(&self) -> Option<Duration>
pub fn get_acquire_timeout(&self) -> Option<Duration>
Get the maximum amount of time to spend waiting for acquiring a connection
pub fn max_lifetime(&mut self, lifetime: Duration) -> &mut ConnectOptions
pub fn max_lifetime(&mut self, lifetime: Duration) -> &mut ConnectOptions
Set the maximum lifetime of individual connections
pub fn get_max_lifetime(&self) -> Option<Duration>
pub fn get_max_lifetime(&self) -> Option<Duration>
Get the maximum lifetime of individual connections, if set
pub fn sqlx_logging(&mut self, value: bool) -> &mut ConnectOptions
pub fn sqlx_logging(&mut self, value: bool) -> &mut ConnectOptions
Enable SQLx statement logging (default true)
pub fn get_sqlx_logging(&self) -> bool
pub fn get_sqlx_logging(&self) -> bool
Get whether SQLx statement logging is enabled
pub fn sqlx_logging_level(&mut self, level: LevelFilter) -> &mut ConnectOptions
pub fn sqlx_logging_level(&mut self, level: LevelFilter) -> &mut ConnectOptions
Set SQLx statement logging level (default INFO)
(ignored if sqlx_logging
is false
)
pub fn get_sqlx_logging_level(&self) -> LevelFilter
pub fn get_sqlx_logging_level(&self) -> LevelFilter
Get the level of SQLx statement logging
pub fn sqlcipher_key<T>(&mut self, value: T) -> &mut ConnectOptionswhere
T: Into<Cow<'static, str>>,
pub fn sqlcipher_key<T>(&mut self, value: T) -> &mut ConnectOptionswhere T: Into<Cow<'static, str>>,
set key for sqlcipher
pub fn set_schema_search_path<T>(
&mut self,
schema_search_path: T
) -> &mut ConnectOptionswhere
T: Into<String>,
pub fn set_schema_search_path<T>( &mut self, schema_search_path: T ) -> &mut ConnectOptionswhere T: Into<String>,
Set schema search path (PostgreSQL only)
Trait Implementations§
§impl Clone for ConnectOptions
impl Clone for ConnectOptions
§fn clone(&self) -> ConnectOptions
fn clone(&self) -> ConnectOptions
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more