hgzimmerman / diesel_test_setup

Common utility for setting up databases for testing using Diesel
MIT License
6 stars 1 forks source link

Consider switching to a struct instead of a tuple for returning a pool and a cleanup. #4

Closed hgzimmerman closed 5 years ago

hgzimmerman commented 5 years ago

This would eliminate some of the ambiguity in dropping a pool, at a minor expense to ergonomics.

The bad case currently is that someone doesn't assign the tuple returned by the setup functions. This causes the tuple's children to be dropped in reverse order, causing an error when the Cleanup is dropped first. By putting both the pool and cleanup in a structure, the drop order should be enforced.