pub struct PgConfig {
pub database_url: String,
pub database_username: String,
pub database_password: String,
pub schema_name: String,
pub max_connections: u32,
pub migration_path: String,
pub schemas: HashMap<String, SchemaConfig>,
}Expand description
Top-level PostgreSQL configuration, loaded from the [postgres] section of config.toml.
Supports both single-schema (legacy) and multi-schema setups. For multi-schema,
populate the schemas map; otherwise the top-level
schema_name and migration_path are used as a single "default" schema.
Fields§
§database_url: String§database_username: String§database_password: String§schema_name: String§max_connections: u32§migration_path: String§schemas: HashMap<String, SchemaConfig>Implementations§
Source§impl PgConfig
impl PgConfig
Sourcepub fn connection_string(&self) -> String
pub fn connection_string(&self) -> String
Builds a PostgreSQL connection string from the configured URL, username, and password.
Sourcepub fn resolved_schemas(&self) -> HashMap<String, SchemaConfig>
pub fn resolved_schemas(&self) -> HashMap<String, SchemaConfig>
Returns the effective schema map.
If schemas is explicitly configured, returns it directly.
Otherwise synthesizes a single "default" entry from the top-level
schema_name and migration_path.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PgConfig
impl<'de> Deserialize<'de> for PgConfig
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 PgConfig
impl RefUnwindSafe for PgConfig
impl Send for PgConfig
impl Sync for PgConfig
impl Unpin for PgConfig
impl UnsafeUnpin for PgConfig
impl UnwindSafe for PgConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more