Skip to content

Commit 2f9b8e5

Browse files
committed
refactor: modified IsUniqueViolationError function
1 parent a30372f commit 2f9b8e5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sql/codes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
func IsUniqueViolationError(err error) (bool, string) {
1010
var pqErr *pgconn.PgError
1111
if errors.As(err, &pqErr) && pqErr.Code == UniqueViolationCode {
12-
return true, pqErr.ColumnName
12+
return true, pqErr.ConstraintName
1313
}
1414
return false, ""
1515
}

0 commit comments

Comments
 (0)