Closed ggalihpp-jubelio closed 12 months ago
Hi! The reason you don't see the error as pgx.ErrNoRows or sql.ErrNoRows is because scany wraps database errors. If you want to check for a "no rows" error, you need to use the standard lib errors
package: errors.Is()
. It's a common pattern in Go and not something specific to scany. Additionally, scany provides its own no rows check functions: pgxscan.NotFound()
and sqlscan.NotFound()
. You can use these instead of errorr.Is()
. It's the same thing.
Let me know if you have any questions.
HI! thanks for replying...
Will check it when I'm getting back to the project... and update it if it is good or not.
Meanwhile will close this.. thanks again
Hi, great lib! Thanks for this...
however, I have difficulties to identified a no rows error. I'm using pgx/v5 and here's the code looks like
it have no rows error but never go either to pgx/sql ErrNoRows.