Documentation ¶
Index ¶
Constants ¶
const ( ClientUnknown = 2000 ClientBadUnixSocket = 2002 ClientBadTCPSocket = 2005 ClientWrongProtocol = 2007 ClientNetPacketTooLarge = 2020 )
MySQL Client errors as found in the MySQL manual under https://dev.mysql.com/doc/mysql-errors/8.0/en/client-error-reference.html. Names have been altered so that they make more sense. For example, CR_CONNECTION_ERROR became ClientBadUnixSocket.
Variables ¶
var (
ErrContextDeadlineExceeded = errors.New("context deadline exceeded")
)
Functions ¶
func NewFromServerMessage ¶
func NewFromServerMessage(msg interfaces.ServerMessager) error
NewFromServerMessage takes msg and transforms it into an Error.
func NewFromWarning ¶
func NewFromWarning(msg *mysqlxnotice.Warning) error
NewFromWarning takes msg and transforms it into a MySQLWarning.
Types ¶
type Error ¶
type Error struct { Inner error Message string Code int SQLState string Severity int Parameters []any ExtraMessage string }
Error holds information of MySQL returned error and is implementing the Go error interface.
func New ¶
New instantiates an Error object with code being the MySQL client or server error code. When the message contains placeholders (is a format specifier), params are used to interpolate them. When one of the params is an error, it is used as a wrapped error. Panics when params contains more than one value which is error-type.
type MySQLWarning ¶
MySQLWarning holds information of MySQL returned warning and is implementing the Go error interface.
func (*MySQLWarning) Error ¶
func (w *MySQLWarning) Error() string
Error is the string representation of the warning, mimicking how MySQL would show them.