Describe the feature

Add an error var in errors.go for unique constraint violations, so GORM users can check for that error type across all supported DBs and drivers.

Motivation

Apps that support multiple databases require complex workarounds or extra queries to return a correct error to API consumers when a unique key constraint is violated. GORM users should be able to check for this error type regardless of DB or driver used, without cumbersome code or additional imports.

Related Issues

Closed with only partly-working workarounds: https://github.com/go-gorm/gorm/issues/4037

Comment From: saeidee

Closing the issue since this feature has been add already. https://github.com/go-gorm/gorm/pull/6004