Skip to content
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

Switch to sqlx::any following Sqlx 0.7 release #39

Open
dave42w opened this issue Jan 24, 2024 · 1 comment
Open

Switch to sqlx::any following Sqlx 0.7 release #39

dave42w opened this issue Jan 24, 2024 · 1 comment

Comments

@dave42w
Copy link

dave42w commented Jan 24, 2024

It seems that Sqlx 0.7 included sorting out the sqlx::any module so that it works usefully. See this comment last comment on Compiling with QueryBuilder::push_values based on AnyPool reports an error #1978

I have tested this on the example.rs and it works (I had to do some updates to cargo.toml versions).

If this is correct then my hope is that neither the Tx type nor the pool have to be database specific

We should be able to replace

type Tx = axum_sqlx_tx::Tx<sqlx::Sqlite>;
``
with

type Tx = axum_sqlx_tx::Txsqlx::Any;


and
let pool = sqlx::SqlitePool::connect("sqlite::memory:").await?;
with
let db_url = "sqlite::memory:";
let pool = sqlx::AnyPool::connect(db_url).await?;

This would significantly simplify my code.
@connec
Copy link
Member

connec commented Apr 6, 2024

I've never worked with sqlx::Any, I'll try to explore that at some point. It might be a sensible "quickstart" default.

I would still want it to be possible to specify the generic for the database, since there are sometimes driver-specific methods (e.g. PgConnection::copy_in_raw) which would be impossible to access from an AnyConnection, as far as I can tell.

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

No branches or pull requests

2 participants