Your Question
if res = db.Save(&msg); res.Error != nil {
log.Error(err)
return
}
I have simple code which is update row in database, but time-to-time it gives me \u003cnil\u003e (<nil>)instead of nil. Any reason or any experience who have ?
Database: CockroachDB Connection: postgres connstring
The document you expected this should be explained
Expected answer
Return always nil instead of "<nil>"
Comment From: sabuhigr
Its because schema doesn't allow it.
SQL Error [23505]: ERROR: duplicate key value violates unique constraint "table_column_idx" Detail: Key (column_name)=('XXXXXX') already exists.
It gives me "<nil>", not actual error.
Want to report it.
Comment From: sabuhigr
I got this answer from Dbeaver, but in gorm there is no such chance for catch it.