Skip to main content

scope_driver

Function scope_driver 

Source
pub async fn scope_driver<F>(
    driver: DatabaseDriver,
    future: F,
) -> Result<F::Output, DriverScopeError>
where F: Future,
Expand description

业务作用:仅在事务业务体执行期间发布 driver 哨兵,阻止嵌套进入另一后端。

参数说明:

  • driver:本地事务使用的数据库后端。
  • future:需要在该后端事务上下文中执行的业务 future。

返回:无外层 driver 或与外层一致时返回业务输出;错配时不执行 future。