errors

package
v0.0.40 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package errors maps a store's database errors to domain errors: each mapper translates driver-specific errors (constraint violations, not-found, schema errors) into a coded core/errors.AppError. The mapper is chosen by the store's database Kind, one subpackage per kind (postgres/: pgx and pgconn).

Only the generic, dependency-light mappers live here. An Ent-ORM mapper belongs with the consumer that owns the Ent schema, because it imports the schema-generated ent error predicates; that consumer's Ent store injects it as a DBMapperFunc — the seam type below — at its composition point.

Index

Constants

View Source
const KindPostgres = "postgres"

KindPostgres maps PostgreSQL errors (pgx, pgconn) to domain errors (the default).

Variables

This section is empty.

Functions

This section is empty.

Types

type DBMapperFunc

type DBMapperFunc func(error) error

DBMapperFunc maps a database error to an *AppError. Implementations must return nil when the input error is nil. A concrete ORM mapper (e.g. a consumer's Ent mapper) is a DBMapperFunc value injected by the store that owns that ORM.

func NewDBMapper

func NewDBMapper(kind string) (DBMapperFunc, error)

NewDBMapper returns the DBMapperFunc for the database kind; empty means KindPostgres. An unknown kind is CodeInvalidInput.

Directories

Path Synopsis
Package postgres provides PostgreSQL-specific DB error mapping.
Package postgres provides PostgreSQL-specific DB error mapping.

Jump to

Keyboard shortcuts

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