pub struct DbConfig {
pub hostname: String,
pub port: u32,
pub database: String,
pub username: String,
pub password: String,
}Expand description
Configuration struct for database connection settings
Contains all necessary fields to establish a connection to a PostgreSQL database.
Fields§
§hostname: String§port: u32§database: String§username: String§password: StringImplementations§
Source§impl DbConfig
impl DbConfig
Sourcepub fn new(
hostname: String,
port: u32,
database: String,
username: String,
password: String,
) -> DbConfig
pub fn new( hostname: String, port: u32, database: String, username: String, password: String, ) -> DbConfig
Creates a new database configuration with the provided connection details
§Arguments
hostname- Database server hostnameport- Database server port numberdatabase- Name of the database to connect tousername- Username for authenticationpassword- Password for authentication
§Returns
A new DbConfig instance with the specified connection parameters
Sourcepub fn get_connection_url(&self) -> String
pub fn get_connection_url(&self) -> String
Generates a PostgreSQL connection URL string from the configuration
§Returns
A formatted connection URL string in the format:
postgres://username:password@hostname:port/database?sslmode=disable
TODO: Add SSL configuration options to support secure connections
Auto Trait Implementations§
impl Freeze for DbConfig
impl RefUnwindSafe for DbConfig
impl Send for DbConfig
impl Sync for DbConfig
impl Unpin for DbConfig
impl UnwindSafe for DbConfig
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