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 (*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