mysqlconv

package
v0.0.0-...-3215105 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQLConverter

type MySQLConverter struct {
	// contains filtered or unexported fields
}

MySQLConverter is a Converter interface implementation The Converter can convert provided error into *Error with specific logic. Check the Convert method documentation for more information on how it distinguish given error

func New

func New() *MySQLConverter

New creates new already inited MySQLConverter

func (*MySQLConverter) Convert

func (m *MySQLConverter) Convert(err error) *dberrors.Error

Convert converts provided 'err' error into *dberrors.Error type. With this method MySQLConverter implements ErrorConverter interface. Convert distinguish and convert specific error of types sql.Err*, mysql.Err*, and *mysql.MySQLError. If an error is of different type it returns new entity of dberrors.ErrUnspecifiedError If the error is of *mysql.MySQLError type the method checks its code. If the code matches with internal code map it returns proper entity of *dberrors.Error. If the code does not exists in the code map, the method gets sqlstate for given code and checks if this sqlstate is in the code map. If the sqlstate does not exists in the code map, the first two numbers from the sqlstate are being checked in the codeMap as a 'sqlstate class'. If not found Convert returns new entity for dberrors.UnspecifiedError

Jump to

Keyboard shortcuts

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