pub struct DataBaseSettings {
pub host: String,
pub port: u16,
pub username: String,
pub password: SecretString,
pub db_name: String,
pub max_connections: u16,
pub idle_timeout_sec: u16,
pub require_ssl: bool,
}
Expand description
Data Base connection settings.
Fields§
§host: String
Host address for the DB server.
port: u16
Listening port for the DB server.
username: String
Username to access the application’s database.
password: SecretString
Password to access the application’s database.
db_name: String
Name of the application’s database.
max_connections: u16
Maximum number of connections for the connections pool.
idle_timeout_sec: u16
Idle timeout for open connections.
require_ssl: bool
Force using SSL for the connection to the DB. False sets the connection to Preferred
mode.
Implementations§
Source§impl DataBaseSettings
impl DataBaseSettings
pub fn connection_string(&self) -> SecretString
Sourcepub fn idle_timeout(&self) -> Duration
pub fn idle_timeout(&self) -> Duration
Translate a timeout in seconds from an integer to a type time::Duration
.
Sourcepub fn build_db_conn_without_db(&self) -> MySqlConnectOptions
pub fn build_db_conn_without_db(&self) -> MySqlConnectOptions
Build a connection to the MariaDB server without using a DB name.
§Description
The following settings will be applied:
Sourcepub fn build_db_conn_with_db(&self) -> MySqlConnectOptions
pub fn build_db_conn_with_db(&self) -> MySqlConnectOptions
Build a connection to the MariaDB server without using a DB name.
§Description
The following settings will be applied plus the ones from DataBaseSettings::build_db_conn_without_db:
Trait Implementations§
Source§impl Clone for DataBaseSettings
impl Clone for DataBaseSettings
Source§fn clone(&self) -> DataBaseSettings
fn clone(&self) -> DataBaseSettings
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for DataBaseSettings
impl Debug for DataBaseSettings
Source§impl<'de> Deserialize<'de> for DataBaseSettings
impl<'de> Deserialize<'de> for DataBaseSettings
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 DataBaseSettings
impl RefUnwindSafe for DataBaseSettings
impl Send for DataBaseSettings
impl Sync for DataBaseSettings
impl Unpin for DataBaseSettings
impl UnwindSafe for DataBaseSettings
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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