oxidecomputer / async-bb8-diesel

Safe asynchronous access to Diesel and the bb8 connection manager
MIT License
12 stars 8 forks source link

Add async variant of OptionalExtension #31

Closed smklein closed 2 years ago

smklein commented 2 years ago

This is functionally identical to https://docs.diesel.rs/master/diesel/prelude/trait.OptionalExtension.html, but operates on the PoolError instead of a Result<T, diesel::result::Error>.

async-bb8-diesel may propagate more errors than merely diesel::result::Error, and as a consequence, cannot simply return a QueryResult like the synchronous counterparts from RunQueryDsl.

However, this new trait provides the same utility as the OptionalExtension.

smklein commented 2 years ago

Looks good. Any tests for this?

Right now, the examples file is all I've got. It's on my TO-DO list to add tests to this repo, but I need to pull in some DB utilities to do setup / teardown. I could probably pull that out of our Omicron repo?