pub struct PostgresConfig {Show 15 fields
pub version: String,
pub database_name: String,
pub username: String,
pub password: String,
pub listen_addresses: String,
pub port: u16,
pub max_connections: Option<u32>,
pub shared_buffers: Option<String>,
pub effective_cache_size: Option<String>,
pub work_mem: Option<String>,
pub maintenance_work_mem: Option<String>,
pub wal_buffers: Option<String>,
pub checkpoint_completion_target: Option<f32>,
pub ssl: bool,
pub extra_config: HashMap<String, String>,
}Expand description
PostgreSQL configuration
Use PostgresConfigBuilder to construct instances.
§Example
use lmrc_postgres::PostgresConfig;
let config = PostgresConfig::builder()
.version("15")
.database_name("myapp")
.username("myuser")
.password("secure_password")
.build()
.unwrap();Fields§
§version: StringPostgreSQL version (e.g., “15”, “14”, “13”)
database_name: StringDatabase name to create
username: StringDatabase username
password: StringDatabase password
listen_addresses: StringListen addresses (CIDR notation, e.g., “0.0.0.0/0” or “10.0.0.0/8”)
port: u16PostgreSQL port (default: 5432)
max_connections: Option<u32>Maximum number of concurrent connections
Shared buffers size (e.g., “256MB”, “1GB”)
effective_cache_size: Option<String>Effective cache size (e.g., “1GB”, “4GB”)
work_mem: Option<String>Work memory (e.g., “4MB”, “16MB”)
maintenance_work_mem: Option<String>Maintenance work memory (e.g., “64MB”, “256MB”)
wal_buffers: Option<String>WAL buffers (e.g., “16MB”)
checkpoint_completion_target: Option<f32>Checkpoint completion target (0.0 to 1.0)
ssl: boolEnable SSL
extra_config: HashMap<String, String>Additional configuration parameters
Implementations§
Source§impl PostgresConfig
impl PostgresConfig
Sourcepub fn builder() -> PostgresConfigBuilder
pub fn builder() -> PostgresConfigBuilder
Create a new builder
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validate the configuration (basic validation only)
For comprehensive validation including memory sizes, CIDR notation,
conflicting settings, and resource limits, use [validate_comprehensive]
from the validation module.
Sourcepub fn config_dir(&self) -> String
pub fn config_dir(&self) -> String
Get the PostgreSQL configuration directory path
Sourcepub fn postgresql_conf_path(&self) -> String
pub fn postgresql_conf_path(&self) -> String
Get the postgresql.conf file path
Sourcepub fn pg_hba_conf_path(&self) -> String
pub fn pg_hba_conf_path(&self) -> String
Get the pg_hba.conf file path
Trait Implementations§
Source§impl Clone for PostgresConfig
impl Clone for PostgresConfig
Source§fn clone(&self) -> PostgresConfig
fn clone(&self) -> PostgresConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more