You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// The error codes to map mssql errors to gorm errors, here is a reference about error codes for mssql https://learn.microsoft.com/en-us/sql/relational-databases/errors-events/database-engine-events-and-errors?view=sql-server-ver16
var errCodes = map[int32]error{
2627: gorm.ErrDuplicatedKey,
547: gorm.ErrForeignKeyViolated,
}
type ErrMessage struct {
Number int32 `json:"Number"`
Message string `json:"Message"`
}
// Translate it will translate the error to native gorm errors.