Add Postgres-only SQLx bindings crate#1069
Open
caniko wants to merge 1 commit intoSeaQL:masterfrom
Open
Conversation
Author
|
Marking as ready for review. @tyt2y3 @Huliiiiii @Expurple — would appreciate any thoughts on the per-driver crate shape vs. trying to slim |
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
This adds a small Postgres-only SQLx binding crate for SeaQuery.
The existing
sea-query-sqlxcrate is intentionally database-agnostic, but that also means its manifest has to mention every SQLx backend it can support. Cargo records optional dependencies from package manifests in downstream lockfiles, so a project that only enables Postgres can still end up with unrelated SQLx packages such assqlx-mysqlinCargo.lock.That is awkward for projects that keep a tight dependency/audit surface. In our case, the MySQL edge pulls in
rsaeven though no MySQL code is compiled or used.What changed
sea-query-sqlx-postgres, a Postgres-only companion crate.SqlxBinderandSqlxValuesshape so callers can continue to build a query and pass the values into SQLx.sqlx-coreandsqlx-postgres, without depending on the top-levelsqlxfacade.One limitation is called out in the implementation:
pgvector's SQLx integration currently depends on thesqlxfacade, so this crate does not wire that integration yet. I kept that separate from the initial change so this PR can stay focused on the dependency shape.Why this shape
I first tried changing
sea-query-sqlxitself to use direct SQLx driver crates, but that does not solve the lockfile issue. Cargo still records optional dependencies listed by the package, even when those features are not enabled. A separate per-driver package avoids that entirely because a Postgres-only consumer never sees the MySQL dependency in the first place.Checks
cargo check --manifest-path sea-query-sqlx-postgres/Cargo.toml --no-default-features --features with-json,with-uuid,with-chrono,with-rust_decimal,with-bigdecimal,postgres-array,runtime-tokio-rustlscargo check --manifest-path sea-query-sqlx-postgres/Cargo.toml --all-featurescargo fmt --manifest-path sea-query-sqlx-postgres/Cargo.toml -- --checksqlx,sqlx-mysql,sqlx-macros, orrsatoCargo.lock.