pub async fn with_current_tx<R, F, Fut>(work: F) -> Result<Option<R>, DataError>where
F: FnOnce(ArclyTransaction) -> Fut,
Fut: Future<Output = (ArclyTransaction, Result<R, DataError>)>,Expand description
Run work with this request’s transaction (if #[Transactional] opened
one). The transaction is moved out of the slot for the duration of the
closure and put back afterwards, so the future stays Send.
Returns Ok(None) when called outside a #[Transactional] scope —
callers fall back to autocommit through the pool.