pub struct DatabaseConfig {
pub driver: Driver,
pub url: String,
pub host: Option<String>,
pub port: Option<u16>,
pub database: Option<String>,
pub user: Option<String>,
pub password: Option<String>,
pub connection: ConnectionOptions,
pub pool: PoolOptions,
pub postgres: Option<PostgresOptions>,
pub mysql: Option<MySqlOptions>,
pub sqlite: Option<SqliteOptions>,
}Expand description
Complete database configuration.
Fields§
§driver: DriverDatabase driver.
url: StringConnection URL.
host: Option<String>Host (if not in URL).
port: Option<u16>Port (if not in URL).
database: Option<String>Database name (if not in URL).
user: Option<String>Username (if not in URL).
password: Option<String>Password (if not in URL).
connection: ConnectionOptionsConnection options.
pool: PoolOptionsPool options.
postgres: Option<PostgresOptions>PostgreSQL-specific options.
mysql: Option<MySqlOptions>MySQL-specific options.
sqlite: Option<SqliteOptions>SQLite-specific options.
Implementations§
Source§impl DatabaseConfig
impl DatabaseConfig
Sourcepub fn postgres() -> DatabaseConfigBuilder
pub fn postgres() -> DatabaseConfigBuilder
Create a new PostgreSQL configuration builder.
Sourcepub fn mysql() -> DatabaseConfigBuilder
pub fn mysql() -> DatabaseConfigBuilder
Create a new MySQL configuration builder.
Sourcepub fn sqlite() -> DatabaseConfigBuilder
pub fn sqlite() -> DatabaseConfigBuilder
Create a new SQLite configuration builder.
Sourcepub fn from_url(url: &str) -> ConnectionResult<Self>
pub fn from_url(url: &str) -> ConnectionResult<Self>
Create configuration from a connection string.
Sourcepub fn from_env() -> ConnectionResult<Self>
pub fn from_env() -> ConnectionResult<Self>
Create configuration from DATABASE_URL environment variable.
Trait Implementations§
Source§impl Clone for DatabaseConfig
impl Clone for DatabaseConfig
Source§fn clone(&self) -> DatabaseConfig
fn clone(&self) -> DatabaseConfig
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 moreAuto Trait Implementations§
impl Freeze for DatabaseConfig
impl RefUnwindSafe for DatabaseConfig
impl Send for DatabaseConfig
impl Sync for DatabaseConfig
impl Unpin for DatabaseConfig
impl UnwindSafe for DatabaseConfig
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