pub struct TransactOptions {
pub isolation_level: Option<IsolationLevel>,
pub read_only: bool,
pub timeout: Option<Duration>,
pub max_nesting_depth: u32,
pub propagation: PropagationBehavior,
}Fields§
§isolation_level: Option<IsolationLevel>§read_only: bool§timeout: Option<Duration>§max_nesting_depth: u32H-8 修复:嵌套事务(保存点)最大深度限制
默认 DEFAULT_MAX_NESTING_DEPTH(8),防止递归事务导致数据库连接耗尽或
保存点栈溢出。设为 0 表示禁用嵌套事务(首次 savepoint() 即报错)。
propagation: PropagationBehavior事务传播行为(默认 Required)
Implementations§
Source§impl TransactOptions
impl TransactOptions
pub fn with_isolation(self, level: IsolationLevel) -> TransactOptions
pub fn read_only(self) -> TransactOptions
pub fn with_timeout(self, timeout: Duration) -> TransactOptions
Sourcepub fn with_max_nesting_depth(self, max_depth: u32) -> TransactOptions
pub fn with_max_nesting_depth(self, max_depth: u32) -> TransactOptions
H-8 修复:设置最大嵌套深度
Sourcepub fn with_propagation(
self,
propagation: PropagationBehavior,
) -> TransactOptions
pub fn with_propagation( self, propagation: PropagationBehavior, ) -> TransactOptions
设置事务传播行为
Trait Implementations§
Source§impl Default for TransactOptions
impl Default for TransactOptions
Source§fn default() -> TransactOptions
fn default() -> TransactOptions
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TransactOptions
impl RefUnwindSafe for TransactOptions
impl Send for TransactOptions
impl Sync for TransactOptions
impl Unpin for TransactOptions
impl UnsafeUnpin for TransactOptions
impl UnwindSafe for TransactOptions
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> 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