diff --git a/sqlx-core/src/connection.rs b/sqlx-core/src/connection.rs index 5c67ce9f33..28d8f18849 100644 --- a/sqlx-core/src/connection.rs +++ b/sqlx-core/src/connection.rs @@ -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, 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(&mut self, callback: F) -> BoxFuture> - where - for<'c> F: - FnOnce(&'c mut Transaction) -> BoxFuture<'c, Result> + 'static + Send + Sync, - Self: Sized, - R: Send, - E: From + Send, + where + for<'c> F: FnOnce(&'c mut Transaction) -> BoxFuture<'c, Result> + + 'static + + Send + + Sync, + Self: Sized, + R: Send, + E: From + Send, { Box::pin(async move { let mut transaction = self.begin().await?;