Or another could be to simply export ErrNoResults, to allow users of the package to call errors.Is themselves. This is less risky than it used to be, because the error implementation can change without breaking the public API now that func (m MyError) Is(target error) bool is a thing.
I would've submitted a PR already, but figured it was probably better to run it up the flagpole first to see if there's a preferred approach to surfacing errors. I'm happy to get cracking submitting something if this would be a worthwhile change.
I would like to be able to handle the
errNoResults
error in my code when usingsqlitex.ResultInt64()
and friends.There's a couple of ways I can think to do it, one would be to add an assertion function like
os.IsNotExist
, for e.g.:Or another could be to simply export ErrNoResults, to allow users of the package to call
errors.Is
themselves. This is less risky than it used to be, because the error implementation can change without breaking the public API now thatfunc (m MyError) Is(target error) bool
is a thing.I would've submitted a PR already, but figured it was probably better to run it up the flagpole first to see if there's a preferred approach to surfacing errors. I'm happy to get cracking submitting something if this would be a worthwhile change.