Skip to content

Commit cf6cd11

Browse files
saeideeSaeid Saeidee
andauthored
fix: ErrForeignKeyViolated error constant (go-gorm#155)
* fix: ErrForeignKeyViolated error constant * refactor: added error codes reference --------- Co-authored-by: Saeid Saeidee <[email protected]>
1 parent 2a60d4f commit cf6cd11

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

error_translator.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ import (
66
"gorm.io/gorm"
77
)
88

9+
// The error codes to map sqlite errors to gorm errors, here is a reference about error codes for sqlite https://www.sqlite.org/rescode.html.
910
var errCodes = map[int]error{
1011
1555: gorm.ErrDuplicatedKey,
1112
2067: gorm.ErrDuplicatedKey,
12-
768: gorm.ErrForeignKeyViolated,
13+
787: gorm.ErrForeignKeyViolated,
1314
}
1415

1516
type ErrMessage struct {

0 commit comments

Comments
 (0)