Struct rorm_db::database::DatabaseConfiguration
source · pub struct DatabaseConfiguration {
pub driver: DatabaseDriver,
pub min_connections: u32,
pub max_connections: u32,
pub disable_logging: Option<bool>,
pub statement_log_level: Option<LevelFilter>,
pub slow_statement_log_level: Option<LevelFilter>,
}Expand description
Configuration to create a database connection.
min_connections and max_connections must be greater than 0
and max_connections must be greater or equals min_connections.
Fields§
§driver: DatabaseDriverThe driver and its corresponding settings
min_connections: u32Minimal connections to initialize upfront.
max_connections: u32Maximum connections that allowed to be created.
disable_logging: Option<bool>If set to true, logging will be completely disabled.
In case of None, false will be used.
statement_log_level: Option<LevelFilter>Set the log level of SQL statements
In case of None, LevelFilter::Debug will be used.
slow_statement_log_level: Option<LevelFilter>Log level in case of slow statements (>300 ms)
In case of None, LevelFilter::Warn will be used.
Implementations§
source§impl DatabaseConfiguration
impl DatabaseConfiguration
sourcepub fn new(driver: DatabaseDriver) -> Self
pub fn new(driver: DatabaseDriver) -> Self
Create a new database configuration with some defaults set.
Defaults:
min_connections: 1max_connections: 10disable_logging: Nonestatement_log_level:SomeofLevelFilter::Debugslow_statement_log_level:SomeofLevelFilter::Warn
Parameter:
driver:DatabaseDriver: Configuration of the database driver.
Trait Implementations§
source§impl Debug for DatabaseConfiguration
impl Debug for DatabaseConfiguration
source§impl<'de> Deserialize<'de> for DatabaseConfiguration
impl<'de> Deserialize<'de> for DatabaseConfiguration
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more