Skip to content
Discussion options

You must be logged in to vote
fn run_query<'a, 'c, A>(conn: A) -> impl Future<Output = Result<(), BoxDynError>> + Send + 'a
where
    A: Acquire<'c, Database = Postgres> + Send + 'a,
{
    async move {
        let mut conn = conn.acquire().await?;

        sqlx::query!("SELECT 1 as v").fetch_one(&mut *conn).await?;
        sqlx::query!("SELECT 2 as v").fetch_one(&mut *conn).await?;

        Ok(())
    }
}

This was the solution. So, I have just decided to continue with &mut PgConnection. Hopefully, the bug is fixed with the diagnostics soon. So, we don't have to use this solution.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@ArbazIrshad
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by ArbazIrshad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants