mysql

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package mysql provides an errs.Classifier for errors originating from the go-sql-driver/mysql driver and the standard database/sql + net packages commonly seen when talking to a MySQL backend.

The classifier inspects a single error node at a time, as required by the errs.Classifier contract. It returns errs.Unknown for nodes it does not recognise so the surrounding classifier-processor chain walk can continue to deeper nodes.

Index

Constants

This section is empty.

Variables

View Source
var Classifier errs.Classifier = classifier{}

Classifier implements errs.Classifier for MySQL-related errors. It recognises:

  • *gomysql.MySQLError values, dispatching on the server-reported error number to one of InfraRetryable (transient server / lock / connection issues) or Infra (everything else the driver reports — schema bugs, constraint violations, programmer errors).
  • driver.ErrBadConn and sql.ErrConnDone — pooled connection failures that are safe to retry on a fresh connection.
  • sql.ErrTxDone — a programming error, non-retryable.
  • net.Error values (including *net.OpError, *net.DNSError) — transient network failures while talking to the server, retryable.

Anything else returns errs.Unknown so the surrounding classifier-processor walker can keep looking down the unwrap chain.

The classifier never returns errs.User. Constraint violations and similar codes that a caller might want to surface as user errors must be wrapped explicitly with errs.NewUserError at the controller — only the controller knows whether a duplicate key, FK violation, etc. reflects bad input from the user or an internal invariant being broken. The framework-wrap check in the classifier-processor short-circuits before this classifier runs, so an explicit controller wrap always wins.

The classifier is stateless; this package-level singleton is the canonical handle. Pass it as one of the variadic classifiers to errs.NewClassifierProcessor; the resulting processor is what gets handed to consumer.New.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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