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) -> Self
pub fn read_only(self) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Sourcepub fn with_max_nesting_depth(self, max_depth: u32) -> Self
pub fn with_max_nesting_depth(self, max_depth: u32) -> Self
H-8 修复:设置最大嵌套深度
Sourcepub fn with_propagation(self, propagation: PropagationBehavior) -> Self
pub fn with_propagation(self, propagation: PropagationBehavior) -> Self
设置事务传播行为
Trait Implementations§
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