-
Notifications
You must be signed in to change notification settings - Fork 24
Clean-up db
sub-crate
#22
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
Clean-up db
sub-crate
#22
Conversation
- decouple the ORM choice from the domain logic; - remove diesel as a dependency of the domain sub-crate.
…lowing access to a pooled connection with a getter.
…he function signature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has made me realize that something must have been lost along the way that I missed - the initial point of the Repo
and the run
method was to "Run the given closure in a way that is safe for blocking IO to the database" - so that it doesn't block the tokio reactor. It used task::spawn_blocking
to do this. Did I miss something that this not necessary any more with all the async ecosystem advances?
Even though this may not the a standard way to use diesel, it was something I cared about, however maybe it's confusing in an example app.
Checking async diesel issue made after review.
With the latest version of the
|
Fair enough - I agree. Let's bring that in when available 👍 |
A little bit of polishing/clean-up of our db-related code:
diesel
's errors into an opaque error type (anyhow::Error
), so that:domain
sub-crate does not have to listdiesel
as a dependency (nice side-effect: compilation speed-up 🚀)domain
remains truly unaware of the underlying persistence-related technology choice (ORM-agnostic).DatabaseError
struct for allDatabaseError
error variants indomain
;