Hi, I would like to thank you all of the contributors for this amazing library
Please I am a very beginner in rust and diesel so apologies if I am suggesting something that architecturally not possible etc.. (I don't have that much knowledge of diesel internals)
What I am suggesting?
Diesel should use SQLx (https://github.com/launchbadge/sqlx) under the hood or add support as a feature
Why Should we add SQLx ?
SQLx does not have DSL and Diesel has one of the best DSL so it would be a good fit for using it
Just to clarify a few things:
- Pure Rust - The Postgres and MySQL/MariaDB drivers are written in pure Rust using zero unsafe code
While it's true that those drivers are pure rust with zero unsafe code, they do not handle all the edge cases in the underlying database protocols. Also at least their MySQL` driver is for a factor of 2-5 slower than that one provided by mysqlclient.
Migrating to some pure rust driver is definitely something that would be interesting for diesel, but such a driver should be similar mature than the existing C-drivers provided by the database itself.
- Truly Asynchronous - Built from the ground-up using async/await for maximum concurrency (This will solve #399)
You can certainly explain how to solve the problems outlined in this comment. Otherwise please get fluent in rust first before you start to suggest fundementally changing the implementation of a big crate.
- Database Agnostic - Support for PostgreSQL, MySQL, SQLite, and MSSQL.
Diesel is already database agnostic, even more than SQLx. It is possible to add support for other database backends as third party crate. See diesel-oci as an example.
- Type-safe SQL - macro to check your SQL and bind parameters at compile time.
This point is the most arguable. In my opinion diesel is already more type safe than sqlx because it correctly handles LEFT JOINS for example. (SQLx does not infer columns coming for a LEFT JOIN as nullable for example.)
- Runtime Agnostic - Works on async-std or tokio with the runtime-async-std or runtime-tokio cargo feature flag.
Technically that's not "Runtime Agnostic". That's just: We support more than one concrete runtime. Runtime agnostic would mean that everyone could use it's own homegrown runtime.
Additionally the last time I've checked the SQLx documentation their exposed interface is missing important methods for diesel (to implement for example prepared statement caching).
(Additionally you should assume that we are well aware of the state of rust's database ecosystem.)
I'm closing this issue as Off-Topic now.
Most helpful comment
Just to clarify a few things:
While it's true that those drivers are pure rust with zero unsafe code, they do not handle all the edge cases in the underlying database protocols. Also at least their MySQL` driver is for a factor of 2-5 slower than that one provided by mysqlclient.
Migrating to some pure rust driver is definitely something that would be interesting for diesel, but such a driver should be similar mature than the existing C-drivers provided by the database itself.
You can certainly explain how to solve the problems outlined in this comment. Otherwise please get fluent in rust first before you start to suggest fundementally changing the implementation of a big crate.
Diesel is already database agnostic, even more than SQLx. It is possible to add support for other database backends as third party crate. See diesel-oci as an example.
This point is the most arguable. In my opinion diesel is already more type safe than sqlx because it correctly handles
LEFT JOINSfor example. (SQLx does not infer columns coming for aLEFT JOINas nullable for example.)Technically that's not "Runtime Agnostic". That's just: We support more than one concrete runtime. Runtime agnostic would mean that everyone could use it's own homegrown runtime.
Additionally the last time I've checked the SQLx documentation their exposed interface is missing important methods for diesel (to implement for example prepared statement caching).
(Additionally you should assume that we are well aware of the state of rust's database ecosystem.)
I'm closing this issue as Off-Topic now.