From 2a60d4fe201a68ce7bcf9e7865e8cbda6877eb01 Mon Sep 17 00:00:00 2001 From: Fabio Bonelli Date: Fri, 9 Jun 2023 04:18:50 +0200 Subject: [PATCH] fix: translate SQLITE_CONSTRAINT_PRIMARYKEY to ErrDuplicatedKey (#152) Translate the SQLITE_CONSTRAINT_PRIMARYKEY error code to ErrDuplicatedKey as well for consistency. --- error_translator.go | 1 + 1 file changed, 1 insertion(+) diff --git a/error_translator.go b/error_translator.go index e33d3cf..c5736cb 100644 --- a/error_translator.go +++ b/error_translator.go @@ -7,6 +7,7 @@ import ( ) var errCodes = map[int]error{ + 1555: gorm.ErrDuplicatedKey, 2067: gorm.ErrDuplicatedKey, 768: gorm.ErrForeignKeyViolated, }