edgedb / edgedb-rust

The official Rust binding for EdgeDB
https://edgedb.com
Apache License 2.0
214 stars 26 forks source link

Add QueryExecutor trait #338

Closed CodesInChaos closed 1 month ago

CodesInChaos commented 1 month ago

The trait enables writing functions that don't care if they're executed in a transaction or directly on a client.

Handling of Send needs to be discussed. Currently I'm not constraining anything to Send, but perhaps the returned futures need to be, but that might require adding constraints to some of the generic arguments (e.g. QueryResult) as well.

Closes #339

edgedb-cla[bot] commented 1 month ago

All commit authors signed the Contributor License Agreement.
CLA signed

aljazerzen commented 1 month ago

This looks good.

For reference, postgres crate has similar trait, named GenericClient. I think that QueryExecutor is a better name. Other db clients that I've checked (mysql, tiberious, sqlite) don't have such traits.

aljazerzen commented 1 month ago

I think we'd need to bump MSRV from 1.72 to 1.75 for "async fn returning impl Trait".

This is a reasonable, since 1.75 is 8 versions before current stable (1.80.1).