Electron100 / butane

An ORM for Rust with a focus on simplicity and on writing Rust, not SQL
Apache License 2.0
93 stars 13 forks source link

`butane` + async runtime #13

Open TmLev opened 3 years ago

TmLev commented 3 years ago

Is it possible to use butane with asynchronous runtime like, for example, tokio?

Electron100 commented 3 years ago

Not directly, aside from using something like tokio::task::spawn_blocking of course. I'm not opposed to some deeper async integration, but it's not something that I'm expecting to implement soon

Electron100 commented 3 years ago

Closing this out as it's not something I'm expecting to do any time soon. I'd be open to a pull request for this, although it would likely only be applicable to some backends, since e.g. sqlite is always going to be based on libsqlite which isn't async-aware.

ibraheemdev commented 3 years ago

The sqlite backend would still have to expose async methods that do something like spawn_blocking.

Electron100 commented 3 years ago

@ibraheemdev sure, but the consumer of Butane could just as well make the spawn_blocking calls themselves. That's the same approach taken with Diesel, as in this Actix Web example https://actix.rs/docs/databases/.

ibraheemdev commented 3 years ago

Yeah, I was just saying that if you wanted to expose an async API, ideally everything should be usable directly in an async context.

Electron100 commented 1 year ago

Reactivating as this is under active consideration

jayvdb commented 5 months ago

I've merged master into the latest async branch , disabling r2d2 feature. https://github.com/jayvdb/butane/tree/async-no-r2d2-jv-merge-master

Electron100 commented 5 months ago

@jayvdb remind me what is the intended difference between that branch and async-wip? That also has r2d2 currently disabled.

I've just added async_checklist.md to attempt to track the remaining work on that branch.

jayvdb commented 3 months ago

I think I removed r2r2 from the features list so that I could use --all-features, and it has a recent master merged into it.

jayvdb commented 3 months ago

https://github.com/nvksv/maybe-async-cfg/pull/4 has been merged and released, which we can use on the butane branch to reduce the dependencies.