pub struct TransactionConfig { /* private fields */ }Expand description
Options applied when starting a PostgreSQL transaction.
The default leaves every choice to the server. Use Self::builder when
choices are known statically; its typestate only exposes DEFERRABLE for
SERIALIZABLE READ ONLY transactions, the combination where PostgreSQL
gives the option meaning.
use drizzle_postgres::TransactionConfig;
// DEFERRABLE only has meaning for a serializable, read-only transaction.
let _ = TransactionConfig::builder()
.serializable()
.read_write()
.deferrable();Implementations§
Source§impl TransactionConfig
impl TransactionConfig
Sourcepub const fn builder() -> ConfigBuilder
pub const fn builder() -> ConfigBuilder
Starts a typestated transaction configuration.
Sourcepub const fn isolation_level(self, level: IsolationLevel) -> Self
pub const fn isolation_level(self, level: IsolationLevel) -> Self
Selects an isolation level supplied at runtime.
Sourcepub const fn access_mode(self, mode: AccessMode) -> Self
pub const fn access_mode(self, mode: AccessMode) -> Self
Selects an access mode supplied at runtime.
Sourcepub const fn deferrable(self) -> Self
pub const fn deferrable(self) -> Self
Requests a deferrable transaction for runtime-derived configuration.
PostgreSQL only gives DEFERRABLE meaning for a SERIALIZABLE READ ONLY transaction, so this establishes that valid combination. Prefer
the typestated builder when the choices are known in code.
Sourcepub const fn isolation(&self) -> Option<IsolationLevel>
pub const fn isolation(&self) -> Option<IsolationLevel>
Configured isolation level, or None to use the server default.
Sourcepub const fn access(&self) -> Option<AccessMode>
pub const fn access(&self) -> Option<AccessMode>
Configured access mode, or None to use the server default.
Sourcepub const fn is_deferrable(&self) -> bool
pub const fn is_deferrable(&self) -> bool
Whether DEFERRABLE was requested.