feat: support PoolConnection via AsExecutor trait#4
Merged
Conversation
…trait Replace the `for<'c> &'c mut E: sqlx::Executor<'c, Database = Postgres>` bound on `Queries<E>` with a generated `AsExecutor` trait. The new trait has impls for `PgPool`, `&PgPool`, `PgConnection`, `Transaction`, `PoolConnection`, and `&mut T` — fixing the gap where `PoolConnection` deref'd executors previously required a manual `&mut *conn` at call sites, and also the cases `&PgPool`, `&mut PgConnection`, and `&mut Transaction` which the README claimed worked but didn't type-check. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jrandolf
added a commit
that referenced
this pull request
Apr 13, 2026
🤖 I have created a release *beep* *boop* --- ## [0.1.1](v0.1.0...v0.1.1) (2026-04-13) ### Features * Support PoolConnection via AsExecutor trait ([#4](#4)) ([0db4bde](0db4bde)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
jrandolf
added a commit
that referenced
this pull request
Apr 13, 2026
🤖 I have created a release *beep* *boop* --- ## [0.1.4](v0.1.3...v0.1.4) (2026-04-13) ### Features * Add Queries::into_inner ([#6](#6)) ([5e5058e](5e5058e)) * Initial commit ([e8693f3](e8693f3)) * Support PoolConnection via AsExecutor trait ([#4](#4)) ([0db4bde](0db4bde)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
for<'c> &'c mut E: sqlx::Executor<'c, Database = Postgres>bound onQueries<E>with a generatedAsExecutortrait.AsExecutorhas impls forPgPool,&PgPool,PgConnection,Transaction<'_, Postgres>,PoolConnection<Postgres>, and&mut T— covering all eight call shapes (owned +&mut).Queries::new(&pool)andQueries::new(&mut tx)worked, but neither actually type-checked against the old bound. OnlyQueries::new(conn)with ownedPgConnectiondid.enumsandbatchexample mains that didn't match the current codegen (struct params / stream returns).Why the previous bound failed
sqlx has a commented-out
impl Executor for &mut PoolConnection<DB>insqlx-core/src/pool/executor.rsciting trait-resolver overflow in the generic blanket form.AsExecutorsidesteps that by providing concrete per-type impls that yield&mut PgConnectiondirectly.Test plan
cargo fmt --all --checkcargo clippy --workspace --all-targets -- -D warningscargo test --workspace(snapshots; integration tests require DATABASE_URL)cargo build --target wasm32-wasip1🤖 Generated with Claude Code