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

source

pub fn new(driver: DatabaseDriver) -> Self

Create a new database configuration with some defaults set.

Defaults:

Parameter:

Trait Implementations§

source§

impl Debug for DatabaseConfiguration

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for DatabaseConfiguration

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for DatabaseConfiguration

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,