mirror of
https://github.com/ncruces/go-sqlite3.git
synced 2026-01-11 21:49:13 +00:00
16 lines
242 B
Go
16 lines
242 B
Go
package gormlite
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/ncruces/go-sqlite3"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
func (dialector Dialector) Translate(err error) error {
|
|
if errors.Is(err, sqlite3.CONSTRAINT_UNIQUE) {
|
|
return gorm.ErrDuplicatedKey
|
|
}
|
|
return err
|
|
}
|