glebarez / sqlite

The pure-Go SQLite driver for GORM
MIT License
615 stars 40 forks source link

Wrong error on Unique constraints #124

Closed FrauElster closed 6 months ago

FrauElster commented 7 months ago

The library does not return the ErrDuplicatedKey as gorm documents, but just returns the go-sqlite 2067 ("constraint failed: UNIQUE constraint failed: users.username (2067)") error.

To be compliant, there should be a mapping of the errors so that one can check errors.Is(err, gorm.ErrDuplicatedKey) independently of the used database driver.

FrauElster commented 7 months ago

I think it is actually fixed in here, just not released yet

glebarez commented 7 months ago

released with https://github.com/glebarez/sqlite/releases/tag/v1.11.0 please check