Skip to content

Commit a73cc5d

Browse files
committed
[mysql] improve naming
1 parent 51cd386 commit a73cc5d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

internal/sms-gateway/modules/messages/repository.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func (r *Repository) Insert(message *Message) error {
136136
return nil
137137
}
138138

139-
if errors.Is(err, gorm.ErrDuplicatedKey) || mysql.IsPrimaryKeyViolation(err) {
139+
if errors.Is(err, gorm.ErrDuplicatedKey) || mysql.IsDuplicateKeyViolation(err) {
140140
return ErrMessageAlreadyExists
141141
}
142142

pkg/mysql/errors.go

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

9-
func IsPrimaryKeyViolation(err error) bool {
9+
func IsDuplicateKeyViolation(err error) bool {
1010
var me *mysql.MySQLError
1111
if errors.As(err, &me) {
1212
return me.Number == 1062

0 commit comments

Comments
 (0)