func (e Error) GetPacket() []byte {
	data := make([]byte, 4, 4+1+2+1+5+len(e.Message))
	data = append(data, 0xff)
	data = append(data, byte(e.Code), byte(e.Code>>8))
	data = append(data, '#')
	data = append(data, e.SQLState...)
	data = append(data, e.Message...)
	length := len(data) - 4
	data[0] = byte(length)
	data[1] = byte(length >> 8)
	data[2] = byte(length >> 16)
	data[3] = byte(0)
	return data
}
GetPacket formats an Error into a protocol message.
https://dev.mysql.com/doc/internals/en/packet-ERR_Packet.html
package protocol
import (
	"fmt"
)
const (
	CRUnknownError  = 2000
	malformedPacket = 2027
	CRSSLConnectionError = 2026
)
const (
	ErrorCodeInternalError = "HY000"
)
type ErrorContainer interface {
	GetPacket() []byte
}
type Error struct {
	Code     uint16
	SQLState string
	Message  string
}
func NewGenericError(goErr error) Error {
	return Error{
		Code:     CRUnknownError,
		SQLState: ErrorCodeInternalError,
		Message:  goErr.Error(),
	}
}
var ErrNoTLS = Error{
	Code:     CRSSLConnectionError,
	SQLState: ErrorCodeInternalError,
	Message:  "SSL connection error: SSL is required but the server doesn't support it",
}
func (e Error) Error() string {
	return fmt.Sprintf("ERROR: %v (%s): %s", e.Code, e.SQLState, e.Message)
}