pub struct ConnectionConfig {
pub driver: Driver,
pub host: String,
pub port: u16,
pub database: String,
pub username: String,
pub password: String,
pub charset: String,
}Expand description
One named connection block - Laravel’s config/database.php
'mysql' => [...], narrowed to the settings this framework actually
needs (no unix_socket/prefix/strict/engine - nothing here
consumes them today; add them if a real caller ever needs to).
Fields§
§driver: Driver§host: StringIgnored for Driver::Sqlite - see database’s
own doc comment.
port: u16§database: StringFor every driver except Driver::Sqlite, a schema/database name.
For Driver::Sqlite, a file path (Laravel’s own database.sqlite
convention) - host/port/username/password/charset are
all meaningless for a local file and are ignored.
username: String§password: String§charset: StringImplementations§
Source§impl ConnectionConfig
impl ConnectionConfig
Sourcepub fn to_url(&self) -> Result<String, AppError>
pub fn to_url(&self) -> Result<String, AppError>
Assembles the connection URL crate::connect already knows how
to consume - the one place in this codebase that turns
(driver, host, port, database, username, password) into a
scheme://user:pass@host:port/db string; nothing else does this
today (a pre-assembled URL was previously the only input format
connect() ever saw). Username/password are percent-encoded since
a real password containing @, :, /, or % would otherwise
corrupt AnyConnectOptions::from_str’s strict RFC 3986 parsing
(see crate::connect’s own doc comment on why that parser is
strict, not lenient).
Trait Implementations§
Source§impl Clone for ConnectionConfig
impl Clone for ConnectionConfig
Source§fn clone(&self) -> ConnectionConfig
fn clone(&self) -> ConnectionConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Forget for ConnectionConfig
impl Freeze for ConnectionConfig
impl RefUnwindSafe for ConnectionConfig
impl Send for ConnectionConfig
impl Sync for ConnectionConfig
impl Unpin for ConnectionConfig
impl UnsafeUnpin for ConnectionConfig
impl UnwindSafe for ConnectionConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Event for T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> ⓘ
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> ⓘ
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