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: DatabaseDriver
The driver and its corresponding settings
min_connections: u32
Minimal connections to initialize upfront.
max_connections: u32
Maximum 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
:Some
ofLevelFilter::Debug
slow_statement_log_level
:Some
ofLevelFilter::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
Auto Trait Implementations§
impl Freeze for DatabaseConfiguration
impl RefUnwindSafe for DatabaseConfiguration
impl Send for DatabaseConfiguration
impl Sync for DatabaseConfiguration
impl Unpin for DatabaseConfiguration
impl UnwindSafe for DatabaseConfiguration
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more