Documentation
¶
Overview ¶
Package pgerrors restores the PostgreSQL-specific error mapping of the rest/errors package. Import it for its side effects when the application uses the github.com/kataras/pg (pgx) database driver:
import _ "github.com/kataras/iris/v14/rest/errors/pgerrors"
Without this import the rest/errors package maps only database/sql's ErrNoRows, keeping the PostgreSQL driver out of the application's dependency graph.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Resolve ¶
Resolve maps PostgreSQL driver errors to canonical REST errors: pg.ErrNoRows to NotFound, duplicate-key violations to AlreadyExists, foreign-key violations (SQLSTATE 23503) to InvalidArgument with the constraint name in the detail and SQLSTATE-tagged input errors to InvalidArgument with the SQLSTATE noise trimmed. It reports whether it handled the error.
Types ¶
This section is empty.