Skip to content

Commit f39fae2

Browse files
committed
[mysql] fix lint issues
1 parent e54f0eb commit f39fae2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/mysql/errors.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@ import (
66
"github.com/go-sql-driver/mysql"
77
)
88

9+
const (
10+
ErrCodeDuplicateEntry = 1062
11+
)
12+
913
func IsDuplicateKeyViolation(err error) bool {
1014
var me *mysql.MySQLError
1115
if errors.As(err, &me) {
12-
return me.Number == 1062
16+
return me.Number == ErrCodeDuplicateEntry
1317
}
1418
return false
1519
}

0 commit comments

Comments
 (0)