pub struct PostgresConfigBuilder { /* private fields */ }Expand description
Builder for PostgresConfig
§Example
use lmrc_postgres::PostgresConfig;
let config = PostgresConfig::builder()
.version("15")
.database_name("production_db")
.username("app_user")
.password("strong_password")
.listen_addresses("10.0.0.0/8")
.port(5432)
.max_connections(200)
.shared_buffers("512MB")
.effective_cache_size("2GB")
.ssl(true)
.build()
.unwrap();Implementations§
Source§impl PostgresConfigBuilder
impl PostgresConfigBuilder
Sourcepub fn database_name(self, name: impl Into<String>) -> Self
pub fn database_name(self, name: impl Into<String>) -> Self
Set database name
Sourcepub fn listen_addresses(self, addresses: impl Into<String>) -> Self
pub fn listen_addresses(self, addresses: impl Into<String>) -> Self
Set listen addresses (CIDR notation)
Sourcepub fn max_connections(self, max: u32) -> Self
pub fn max_connections(self, max: u32) -> Self
Set maximum connections
Set shared buffers
Sourcepub fn effective_cache_size(self, size: impl Into<String>) -> Self
pub fn effective_cache_size(self, size: impl Into<String>) -> Self
Set effective cache size
Sourcepub fn maintenance_work_mem(self, size: impl Into<String>) -> Self
pub fn maintenance_work_mem(self, size: impl Into<String>) -> Self
Set maintenance work memory
Sourcepub fn wal_buffers(self, size: impl Into<String>) -> Self
pub fn wal_buffers(self, size: impl Into<String>) -> Self
Set WAL buffers
Sourcepub fn checkpoint_completion_target(self, target: f32) -> Self
pub fn checkpoint_completion_target(self, target: f32) -> Self
Set checkpoint completion target (0.0 to 1.0)
Sourcepub fn add_config(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn add_config( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add custom configuration parameter
Sourcepub fn build(self) -> Result<PostgresConfig>
pub fn build(self) -> Result<PostgresConfig>
Build the configuration
Trait Implementations§
Source§impl Debug for PostgresConfigBuilder
impl Debug for PostgresConfigBuilder
Source§impl Default for PostgresConfigBuilder
impl Default for PostgresConfigBuilder
Source§fn default() -> PostgresConfigBuilder
fn default() -> PostgresConfigBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PostgresConfigBuilder
impl RefUnwindSafe for PostgresConfigBuilder
impl Send for PostgresConfigBuilder
impl Sync for PostgresConfigBuilder
impl Unpin for PostgresConfigBuilder
impl UnwindSafe for PostgresConfigBuilder
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