pub struct DatabaseUrl {
pub scheme: String,
pub host: String,
pub port: u16,
pub username: String,
pub password: String,
pub database: String,
}Expand description
DatabaseUrl represents a structured database connection URL, providing options for the
scheme, host, port, username, password, and database name.
Fields§
§scheme: String§host: String§port: u16§username: String§password: String§database: StringImplementations§
Source§impl DatabaseUrl
impl DatabaseUrl
Sourcepub fn from_url_str<T>(url: T) -> Self
pub fn from_url_str<T>(url: T) -> Self
try to parse an instance from the given url
Sourcepub fn from_env(key: &str) -> Self
pub fn from_env(key: &str) -> Self
load and parse the database url from the configured environment variable
Sourcepub fn set_database<T>(&mut self, database: T)where
T: ToString,
pub fn set_database<T>(&mut self, database: T)where
T: ToString,
update the database name
Sourcepub fn set_username<T>(&mut self, username: T)where
T: ToString,
pub fn set_username<T>(&mut self, username: T)where
T: ToString,
set the username
Sourcepub fn set_password<T>(&mut self, password: T)where
T: ToString,
pub fn set_password<T>(&mut self, password: T)where
T: ToString,
update the database password
Sourcepub fn set_scheme<T>(&mut self, scheme: T)where
T: ToString,
pub fn set_scheme<T>(&mut self, scheme: T)where
T: ToString,
update the scheme of the database
Sourcepub fn with_database<T>(self, database: T) -> Selfwhere
T: ToString,
pub fn with_database<T>(self, database: T) -> Selfwhere
T: ToString,
returns a new instance with the given database name
Sourcepub fn with_host<T>(self, host: T) -> Selfwhere
T: ToString,
pub fn with_host<T>(self, host: T) -> Selfwhere
T: ToString,
returns a new instance with the given host
Sourcepub fn with_username<T>(self, username: T) -> Selfwhere
T: ToString,
pub fn with_username<T>(self, username: T) -> Selfwhere
T: ToString,
returns a new instance with the given username
Sourcepub fn with_password<T>(self, password: T) -> Selfwhere
T: ToString,
pub fn with_password<T>(self, password: T) -> Selfwhere
T: ToString,
returns a new instance with the given password
Sourcepub fn with_scheme<T>(self, scheme: T) -> Selfwhere
T: ToString,
pub fn with_scheme<T>(self, scheme: T) -> Selfwhere
T: ToString,
returns a new instance with the given scheme
Trait Implementations§
Source§impl Clone for DatabaseUrl
impl Clone for DatabaseUrl
Source§fn clone(&self) -> DatabaseUrl
fn clone(&self) -> DatabaseUrl
Returns a duplicate 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 DatabaseUrl
impl Debug for DatabaseUrl
Source§impl Default for DatabaseUrl
impl Default for DatabaseUrl
Source§impl<'de> Deserialize<'de> for DatabaseUrlwhere
DatabaseUrl: Default,
impl<'de> Deserialize<'de> for DatabaseUrlwhere
DatabaseUrl: Default,
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
Source§impl Display for DatabaseUrl
impl Display for DatabaseUrl
Source§impl From<DatabaseLink> for DatabaseUrl
impl From<DatabaseLink> for DatabaseUrl
Source§fn from(link: DatabaseLink) -> Self
fn from(link: DatabaseLink) -> Self
Converts to this type from the input type.
Source§impl From<DatabaseUrl> for DatabaseLink
impl From<DatabaseUrl> for DatabaseLink
Source§fn from(url: DatabaseUrl) -> Self
fn from(url: DatabaseUrl) -> Self
Converts to this type from the input type.
Source§impl From<DatabaseUrl> for String
impl From<DatabaseUrl> for String
Source§fn from(url: DatabaseUrl) -> Self
fn from(url: DatabaseUrl) -> Self
Converts to this type from the input type.
Source§impl From<DatabaseUrl> for Url
impl From<DatabaseUrl> for Url
Source§fn from(url: DatabaseUrl) -> Self
fn from(url: DatabaseUrl) -> Self
Converts to this type from the input type.
Source§impl From<DatabaseUrl> for Value
impl From<DatabaseUrl> for Value
Source§fn from(url: DatabaseUrl) -> Self
fn from(url: DatabaseUrl) -> Self
Converts to this type from the input type.
Source§impl From<String> for DatabaseUrl
impl From<String> for DatabaseUrl
Source§impl From<Url> for DatabaseUrl
impl From<Url> for DatabaseUrl
Source§impl From<Value> for DatabaseUrl
impl From<Value> for DatabaseUrl
Source§impl FromStr for DatabaseUrl
impl FromStr for DatabaseUrl
Source§impl Hash for DatabaseUrl
impl Hash for DatabaseUrl
Source§impl Ord for DatabaseUrl
impl Ord for DatabaseUrl
Source§fn cmp(&self, other: &DatabaseUrl) -> Ordering
fn cmp(&self, other: &DatabaseUrl) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<'a> PartialEq<&'a str> for DatabaseUrl
impl<'a> PartialEq<&'a str> for DatabaseUrl
Source§impl PartialEq<String> for DatabaseUrl
impl PartialEq<String> for DatabaseUrl
Source§impl PartialEq for DatabaseUrl
impl PartialEq for DatabaseUrl
Source§impl PartialOrd for DatabaseUrl
impl PartialOrd for DatabaseUrl
Source§impl Serialize for DatabaseUrl
impl Serialize for DatabaseUrl
impl Eq for DatabaseUrl
impl StructuralPartialEq for DatabaseUrl
Auto Trait Implementations§
impl Freeze for DatabaseUrl
impl RefUnwindSafe for DatabaseUrl
impl Send for DatabaseUrl
impl Sync for DatabaseUrl
impl Unpin for DatabaseUrl
impl UnwindSafe for DatabaseUrl
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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<I> IntoResettable<String> for I
impl<I> IntoResettable<String> for I
Source§fn into_resettable(self) -> Resettable<String>
fn into_resettable(self) -> Resettable<String>
Convert to the intended resettable type