#[non_exhaustive]pub struct ProviderConfig {
pub connection: ConnectionConfig,
pub schema_name: Option<String>,
pub migration_policy: MigrationPolicy,
pub long_poll: LongPollConfig,
}Expand description
Configuration for PostgresProvider::new_with_config.
Construct via ProviderConfig::url (standard postgres:// URL) or
ProviderConfig::entra (Azure Database for PostgreSQL with Microsoft
Entra ID), then adjust fields as needed:
use duroxide_pg::{MigrationPolicy, PostgresProvider, ProviderConfig};
let mut config = ProviderConfig::url("postgres://localhost/mydb");
config.schema_name = Some("my_app".into());
config.migration_policy = MigrationPolicy::VerifyOnly;
let provider = PostgresProvider::new_with_config(config).await?;Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.connection: ConnectionConfigHow the provider should reach the database.
schema_name: Option<String>PostgreSQL schema for tenant isolation. None resolves to public.
migration_policy: MigrationPolicyPolicy for handling embedded migrations at startup.
long_poll: LongPollConfigNotification-driven waiting for work. Disabled by default.
ApplyAll also activates schema-wide notification triggers;
VerifyOnly requires prior activation.
Implementations§
Source§impl ProviderConfig
impl ProviderConfig
Sourcepub fn url(database_url: impl Into<String>) -> Self
pub fn url(database_url: impl Into<String>) -> Self
Build a config from a standard PostgreSQL connection URL
(postgres://user:pass@host:port/db). Schema defaults to public
and migration policy defaults to MigrationPolicy::ApplyAll.
Sourcepub fn entra(
host: impl Into<String>,
port: u16,
database: impl Into<String>,
user: impl Into<String>,
options: EntraAuthOptions,
) -> Self
pub fn entra( host: impl Into<String>, port: u16, database: impl Into<String>, user: impl Into<String>, options: EntraAuthOptions, ) -> Self
Build a config for Azure Database for PostgreSQL with Microsoft
Entra ID. Schema defaults to public and migration policy defaults
to MigrationPolicy::ApplyAll. All Entra connections use
PgSslMode::VerifyFull.
Trait Implementations§
Source§impl Clone for ProviderConfig
impl Clone for ProviderConfig
Auto Trait Implementations§
impl Forget for ProviderConfig
impl Freeze for ProviderConfig
impl Move for ProviderConfig
impl RefUnwindSafe for ProviderConfig
impl Send for ProviderConfig
impl Sync for ProviderConfig
impl Unpin for ProviderConfig
impl UnsafeUnpin for ProviderConfig
impl UnwindSafe for ProviderConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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