Skip to content

Commit

Permalink
Ensure tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
ranile authored and mehcode committed Dec 19, 2020
1 parent 8a55ae2 commit d1417dc
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions sqlx-core/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,27 @@ pub trait Connection: Send {
/// # Example
///
/// ```rust
/// use sqlx_core::postgres::{PgConnection, PgRow};
/// use sqlx_core::connection::Connection;
/// use sqlx_core::error::Error;
/// use sqlx_core::executor::Executor;
/// use sqlx_core::postgres::{PgConnection, PgRow};
/// use sqlx_core::query::query;
///
/// # pub async fn _f(conn: &mut PgConnection) -> Result<Vec<PgRow>, Error> {
/// conn.transaction(|conn|Box::pin(async move {
/// sqlx::query("select * from ..").fetch_all(conn).await
/// query("select * from ..").fetch_all(conn).await
/// })).await
/// # }
/// ```
fn transaction<F, R, E>(&mut self, callback: F) -> BoxFuture<Result<R, E>>
where
for<'c> F:
FnOnce(&'c mut Transaction<Self::Database>) -> BoxFuture<'c, Result<R, E>> + 'static + Send + Sync,
Self: Sized,
R: Send,
E: From<Error> + Send,
where
for<'c> F: FnOnce(&'c mut Transaction<Self::Database>) -> BoxFuture<'c, Result<R, E>>
+ 'static
+ Send
+ Sync,
Self: Sized,
R: Send,
E: From<Error> + Send,
{
Box::pin(async move {
let mut transaction = self.begin().await?;
Expand Down

0 comments on commit d1417dc

Please sign in to comment.