Skip to content

Implement Executor for double references #588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

jplatte
Copy link
Contributor

@jplatte jplatte commented Jul 29, 2020

So now I got something that compiles , but I actually think it's mostly useless since AFAICT one still can't write a function that's generic over connection / pool / transaction with this 😞

I think this enables

async fn do_stuff<E>(mut executor: E) -> sqlx::Result<()>
where
    &mut E: Executor<DB>,
{
    sqlx::query!("…").execute(&mut executor).await?;
    let foo = sqlx::query_as!(Foo, "…").fetch_one(&mut executor).await?;

    Ok(())
}

@jplatte
Copy link
Contributor Author

jplatte commented Jul 31, 2020

I've tried it. While SQLx itself compiles with these changes, any way I've tried to use it results in overflow evaluating the requirement `&mut &mut _: sqlx::Executor<'_>` .

@mehcode
Copy link
Member

mehcode commented Nov 12, 2020

Thanks for the attempt. We definitely need to revisit this when GATs are available, even in nightly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants