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§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more