This commit is contained in:
邹宗楠
2022-08-11 14:23:06 +08:00
parent 7efcd3a614
commit c845eabe69
32 changed files with 231 additions and 212 deletions

19
business/dao/dao_err.go Normal file
View File

@@ -0,0 +1,19 @@
package dao
import (
"github.com/astaxie/beego/client/orm"
"github.com/go-sql-driver/mysql"
)
func IsDuplicateError(err error) bool {
if mysqlErr, ok := err.(*mysql.MySQLError); ok {
if mysqlErr.Number == 1062 {
return true
}
}
return false
}
func IsNoRowsError(err error) bool {
return err == orm.ErrNoRows
}