pub struct DatabaseUriSchema { /* private fields */ }Expand description
A standard database connection url schema
Implementations§
Source§impl DatabaseUriSchema
impl DatabaseUriSchema
pub fn from_parts( prefix: impl ToString, host: impl ToString, port: u16, user: impl ToString, password: impl ToString, database: impl ToString, ) -> Self
Sourcepub fn postgresql(
host: impl ToString,
port: u16,
user: impl ToString,
password: impl ToString,
database: impl ToString,
) -> Self
pub fn postgresql( host: impl ToString, port: u16, user: impl ToString, password: impl ToString, database: impl ToString, ) -> Self
returns a new instance pre-configured with the postgresql prefix.
Sourcepub fn as_uri_string(&self) -> String
pub fn as_uri_string(&self) -> String
returns a string representation of the database URL.
Sourcepub const fn prefix_mut(&mut self) -> &mut String
pub const fn prefix_mut(&mut self) -> &mut String
returns a mutable reference to the driver
Sourcepub const fn password_mut(&mut self) -> &mut String
pub const fn password_mut(&mut self) -> &mut String
returns a mutable reference to the password
Sourcepub const fn database_mut(&mut self) -> &mut String
pub const fn database_mut(&mut self) -> &mut String
returns a mutable reference to the database name
Sourcepub fn set_database<U: ToString>(&mut self, value: U) -> &mut Self
pub fn set_database<U: ToString>(&mut self, value: U) -> &mut Self
update the configured database and return a mutable reference to the current instance
Sourcepub fn set_host(&mut self, host: impl ToString) -> &mut Self
pub fn set_host(&mut self, host: impl ToString) -> &mut Self
update the configured hostname and return a mutable reference to the current instance
Sourcepub fn set_password<U: ToString>(&mut self, value: U) -> &mut Self
pub fn set_password<U: ToString>(&mut self, value: U) -> &mut Self
update the configured password and return a mutable reference to the current instance
Sourcepub fn set_port(&mut self, port: u16) -> &mut Self
pub fn set_port(&mut self, port: u16) -> &mut Self
update the configured port and return a mutable reference to the current instance
Sourcepub fn set_prefix<U: ToString>(&mut self, value: U) -> &mut Self
pub fn set_prefix<U: ToString>(&mut self, value: U) -> &mut Self
update the configured prefix and return a mutable reference to the current instance
Sourcepub fn set_user<U: ToString>(&mut self, value: U) -> &mut Self
pub fn set_user<U: ToString>(&mut self, value: U) -> &mut Self
update the configured username and return a mutable reference to the current instance
Sourcepub fn with_database<U: ToString>(self, value: U) -> Self
pub fn with_database<U: ToString>(self, value: U) -> Self
consumes the current instance to create another with the given database name
Sourcepub fn with_host<U: ToString>(self, value: U) -> Self
pub fn with_host<U: ToString>(self, value: U) -> Self
consumes the current instance to create another with the given host
Sourcepub fn with_password<U: ToString>(self, value: U) -> Self
pub fn with_password<U: ToString>(self, value: U) -> Self
consumes the current instance to create another with the given password
Sourcepub fn with_port(self, value: u16) -> Self
pub fn with_port(self, value: u16) -> Self
consumes the current instance to create another with the given port
Sourcepub fn with_prefix<U: ToString>(self, value: U) -> Self
pub fn with_prefix<U: ToString>(self, value: U) -> Self
consumes the current instance to create another with the given prefix
Trait Implementations§
Source§impl Clone for DatabaseUriSchema
impl Clone for DatabaseUriSchema
Source§fn clone(&self) -> DatabaseUriSchema
fn clone(&self) -> DatabaseUriSchema
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DatabaseUriSchema
impl Debug for DatabaseUriSchema
Source§impl Default for DatabaseUriSchema
impl Default for DatabaseUriSchema
Source§impl<'de> Deserialize<'de> for DatabaseUriSchemawhere
DatabaseUriSchema: Default,
impl<'de> Deserialize<'de> for DatabaseUriSchemawhere
DatabaseUriSchema: 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>,
Source§impl Display for DatabaseUriSchema
impl Display for DatabaseUriSchema
Source§impl FromStr for DatabaseUriSchema
impl FromStr for DatabaseUriSchema
Source§impl Hash for DatabaseUriSchema
impl Hash for DatabaseUriSchema
Source§impl Ord for DatabaseUriSchema
impl Ord for DatabaseUriSchema
Source§fn cmp(&self, other: &DatabaseUriSchema) -> Ordering
fn cmp(&self, other: &DatabaseUriSchema) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for DatabaseUriSchema
impl PartialEq for DatabaseUriSchema
Source§impl PartialOrd for DatabaseUriSchema
impl PartialOrd for DatabaseUriSchema
Source§impl Serialize for DatabaseUriSchema
impl Serialize for DatabaseUriSchema
impl Eq for DatabaseUriSchema
impl StructuralPartialEq for DatabaseUriSchema
Auto Trait Implementations§
impl Freeze for DatabaseUriSchema
impl RefUnwindSafe for DatabaseUriSchema
impl Send for DatabaseUriSchema
impl Sync for DatabaseUriSchema
impl Unpin for DatabaseUriSchema
impl UnwindSafe for DatabaseUriSchema
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.