timshannon / bolthold

BoltHold is an embeddable NoSQL store for Go types built on BoltDB
MIT License
648 stars 46 forks source link

Give empty results on empty bucket queries #31

Closed rmg closed 6 years ago

rmg commented 6 years ago

Fixes #30 by immediately returning from queries against missing/empty buckets.

coveralls commented 6 years ago

Coverage Status

Coverage decreased (-0.2%) to 85.476% when pulling acc7aa397bfa0c05dd8c8c93e8625f3b6d0b2ed7 on rmg:empty-result-on-empty-bucket into 66d5d232dc6b60283e962588343642b9d02b5dac on timshannon:master.

rmg commented 6 years ago

Now that I've fixed the coverage reporting I see that my approach causes a bunch of bucket checks in other places throughout the repo to no longer be tested.

@timshannon would you rather I change my approach to do the bucket check closer to the Find() entrypoint so that it impacts less code paths?

On the one hand that seems the better approach since it would dramatically reduce the likelihood of bugs.. but on the other hand, the reduction in coverage is a pretty good indicator that the current approach actually does remove a bunch of code paths and that is normally a good thing.

timshannon commented 6 years ago

I think the check makes more sense in the runQuery func. It's used in updates, and deleted as well. I'm still reviewing this, but first glance this looks great. I'll look and see if we want to actually be removing the unused code paths further down the line or not.

Thanks