pub struct DatabaseConfig {
pub connection_string: String,
pub db_type: DatabaseType,
pub max_connections: u32,
pub timeout_secs: u64,
pub read_only: bool,
pub max_rows: usize,
}Expand description
Configuration for the database server
Fields§
§connection_string: StringDatabase connection string
db_type: DatabaseTypeDatabase type
max_connections: u32Maximum number of connections in the pool
timeout_secs: u64Connection timeout in seconds
read_only: boolWhether to enable read-only mode (disables mutations)
max_rows: usizeMaximum rows to return from queries
Implementations§
Source§impl DatabaseConfig
impl DatabaseConfig
Sourcepub fn postgres(connection_string: impl Into<String>) -> Self
👎Deprecated: PostgreSQL is no longer supported. Use sqlite() instead.
pub fn postgres(connection_string: impl Into<String>) -> Self
Create a new PostgreSQL configuration (deprecated, SQLite is now default)
Sourcepub fn with_max_connections(self, max: u32) -> Self
pub fn with_max_connections(self, max: u32) -> Self
Set the maximum number of connections
Sourcepub fn with_read_only(self, read_only: bool) -> Self
pub fn with_read_only(self, read_only: bool) -> Self
Set read-only mode
Sourcepub fn with_max_rows(self, max_rows: usize) -> Self
pub fn with_max_rows(self, max_rows: usize) -> Self
Set maximum rows to return
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 moreSource§impl Debug for DatabaseConfig
impl Debug for DatabaseConfig
Source§impl<'de> Deserialize<'de> for DatabaseConfig
impl<'de> Deserialize<'de> for DatabaseConfig
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
Auto 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