u
This commit is contained in:
1 parent
4ce951dd56
commit
8a3dea8545
44 files changed
+1599
-30
No files matched your search
@@ -0,0 +1,13 @@
|
||||
package errorx
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"errors"
|
||||
|
||||
"github.com/jackc/pgx/v5"
|
||||
)
|
||||
|
||||
// IsNotFound 判断 err 是否因为数据库中没找到数据
|
||||
func IsNotFound(err error) bool {
|
||||
return errors.Is(err, sql.ErrNoRows) || errors.Is(err, pgx.ErrNoRows)
|
||||
}
|
||||
Reference in new issue
Block a user