MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / transaction

Method transaction

src/driver/sqlx_sqlite.rs:221–245  ·  view source on GitHub ↗
(
        &self,
        callback: F,
        isolation_level: Option<IsolationLevel>,
        access_mode: Option<AccessMode>,
    )

Source from the content-addressed store, hash-verified

219 /// Create a MySQL transaction
220 #[instrument(level = "trace", skip(callback))]
221 pub async fn transaction<F, T, E>(
222 &self,
223 callback: F,
224 isolation_level: Option<IsolationLevel>,
225 access_mode: Option<AccessMode>,
226 ) -> Result<T, TransactionError<E>>
227 where
228 F: for<'b> FnOnce(
229 &'b DatabaseTransaction,
230 ) -> Pin<Box<dyn Future<Output = Result<T, E>> + Send + 'b>>
231 + Send,
232 T: Send,
233 E: std::fmt::Display + std::fmt::Debug + Send,
234 {
235 let conn = self.pool.acquire().await.map_err(sqlx_conn_acquire_err)?;
236 let transaction = DatabaseTransaction::new_sqlite(
237 conn,
238 self.metric_callback.clone(),
239 isolation_level,
240 access_mode,
241 )
242 .await
243 .map_err(|e| TransactionError::Connection(e))?;
244 transaction.run(callback).await
245 }
246
247 pub(crate) fn set_metric_callback<F>(&mut self, callback: F)
248 where

Callers

nothing calls this directly

Calls 2

ConnectionClass · 0.85
runMethod · 0.45

Tested by

no test coverage detected