pgerror is a collection of helper functions to use with github.com/lib/pq Postgresql Database driver for Go Programming language.
// example use:
_, err = stmt.Exec(SomeInsertStateMent, params...)
if err != nil {
if e := pgerror.UniqueViolation(err); e != nil {
// you can use e here to check the fields et al
return SomeThingAlreadyExists
}
return err // other cases.
}
MIT.