pub struct DatabaseConfig {Show 13 fields
pub url: Option<String>,
pub host: Option<String>,
pub port: Option<u16>,
pub user: Option<String>,
pub password: Option<String>,
pub database: Option<String>,
pub connect_retries: u32,
pub ssl_mode: SslMode,
pub ssl_root_cert: Option<PathBuf>,
pub connect_timeout_secs: u32,
pub statement_timeout_secs: u32,
pub keepalive_secs: u32,
pub engine: DialectKind,
}Expand description
Database connection configuration.
Fields§
§url: Option<String>Full connection URL (e.g., postgres://user:pass@host/db).
host: Option<String>Database server hostname.
port: Option<u16>Database server port number.
user: Option<String>Database user for authentication.
password: Option<String>Database password for authentication.
database: Option<String>Database name to connect to.
connect_retries: u32Number of times to retry a failed connection (max 20).
ssl_mode: SslModeSSL/TLS mode for the database connection.
ssl_root_cert: Option<PathBuf>PEM file holding the CA certificate(s) used to verify the server.
Mirrors libpq’s sslrootcert: when set, these certificates replace
the built-in Mozilla trust store rather than adding to it. Only
consulted by the verifying modes (verify-ca / verify-full).
connect_timeout_secs: u32Connection timeout in seconds.
statement_timeout_secs: u32Statement timeout in seconds (0 means no timeout).
keepalive_secs: u32TCP keepalive interval in seconds (0 disables, default 120).
engine: DialectKindWhich engine the host/port/user/database fields describe.
Only consulted when url is unset. With a url, the engine is derived
from its scheme (postgres:// / mysql://). Defaults to PostgreSQL,
which is what the field-based form always produced historically.
Trait Implementations§
Source§impl Clone for DatabaseConfig
impl Clone for DatabaseConfig
Source§fn clone(&self) -> DatabaseConfig
fn clone(&self) -> DatabaseConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more