pgerrors

package
v14.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2026 License: BSD-3-Clause, BSD-3-Clause Imports: 5 Imported by: 0

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

func Resolve(ctx *context.Context, err error) bool

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL