PostgresConfigBuilder

Struct PostgresConfigBuilder 

Source
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

Source

pub fn version(self, version: impl Into<String>) -> Self

Set PostgreSQL version

Source

pub fn database_name(self, name: impl Into<String>) -> Self

Set database name

Source

pub fn username(self, username: impl Into<String>) -> Self

Set username

Source

pub fn password(self, password: impl Into<String>) -> Self

Set password

Source

pub fn listen_addresses(self, addresses: impl Into<String>) -> Self

Set listen addresses (CIDR notation)

Source

pub fn port(self, port: u16) -> Self

Set port (default: 5432)

Source

pub fn max_connections(self, max: u32) -> Self

Set maximum connections

Source

pub fn shared_buffers(self, size: impl Into<String>) -> Self

Set shared buffers

Source

pub fn effective_cache_size(self, size: impl Into<String>) -> Self

Set effective cache size

Source

pub fn work_mem(self, size: impl Into<String>) -> Self

Set work memory

Source

pub fn maintenance_work_mem(self, size: impl Into<String>) -> Self

Set maintenance work memory

Source

pub fn wal_buffers(self, size: impl Into<String>) -> Self

Set WAL buffers

Source

pub fn checkpoint_completion_target(self, target: f32) -> Self

Set checkpoint completion target (0.0 to 1.0)

Source

pub fn ssl(self, enabled: bool) -> Self

Enable or disable SSL

Source

pub fn add_config( self, key: impl Into<String>, value: impl Into<String>, ) -> Self

Add custom configuration parameter

Source

pub fn build(self) -> Result<PostgresConfig>

Build the configuration

Trait Implementations§

Source§

impl Debug for PostgresConfigBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PostgresConfigBuilder

Source§

fn default() -> PostgresConfigBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more