Closed mxmaxime closed 1 year ago
Hi! Thanks for asking. The custom ErrNotFound
error lives on the dbscan
package level because that package doesn't depend on any particular implementation such as database/sql
.
Assuming you are using the sqlscan
package, it does translate the dbscan.ErrNotFound
error to sql.ErrNoRows
. The code is here: https://github.com/georgysavva/scany/blob/0203330fd43f46f404de6ce76953e656961989fc/sqlscan/sqlscan.go#L122-L140.
The same is true for the pgxscan
package, with the result error type being pgx.ErrNoRows
.
I hope this helps. Let me know if you have any other questions.
Thanks for the answer! Crystal clear. I'll use sqlscan then, the code you referenced is basically what I did to wrap dbscan.
Hi, First of all, thanks for the project, it looks really great!
I have a question concerning the
ErrNotFound
. Why did you create one new type/error instead of using thesql.ErrNoRows
. I had to wrap the error handling to return thesql.ErrNoRows
in order to not break any existing code which is database/sql "compliant".I might miss something there, I'm curious about this choice. Thanks!