Skip to content

Commit 2a60d4f

Browse files
authored
fix: translate SQLITE_CONSTRAINT_PRIMARYKEY to ErrDuplicatedKey (go-gorm#152)
Translate the SQLITE_CONSTRAINT_PRIMARYKEY error code to ErrDuplicatedKey as well for consistency.
1 parent 9ac07d2 commit 2a60d4f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

error_translator.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
)
88

99
var errCodes = map[int]error{
10+
1555: gorm.ErrDuplicatedKey,
1011
2067: gorm.ErrDuplicatedKey,
1112
768: gorm.ErrForeignKeyViolated,
1213
}

0 commit comments

Comments
 (0)