Documentation ¶
Index ¶
- Variables
- type ClientCommandQueryPacket
- type ClientCommandStatementClosePacket
- type ClientCommandStatementPreparePacket
- type EndpointSide
- type MySQLConn
- func (this *MySQLConn) ChangeState(newState MySQLConnState) (MySQLConnState, bool, error)
- func (this *MySQLConn) DequeuePacket() *RawPacket
- func (this *MySQLConn) Enqueue(rawPacket *RawPacket)
- func (this *MySQLConn) GetCurrentState() MySQLConnState
- func (this *MySQLConn) HandleCommandPhaseClientPacket(rawPacket *RawPacket) error
- func (this *MySQLConn) HandleCommandPhaseServerPacket(rawPacket *RawPacket) error
- func (this *MySQLConn) HandleConnPhase(inbound, outbound io.ReadWriter) error
- func (this *MySQLConn) HandleConnPhase0(inbound, outbound io.ReadWriter) error
- type MySQLConnState
- type OkPacket
- type Packet
- type PacketType
- type RawPacket
- type SQLSnifferHandler
- type ServerCommandStatementResponsePacket
- type UnknownPacket
- type UnknownPacketHandler
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrPacketIncomplete = errors.New("packet is incomplete")
View Source
var ErrReaderEOF = errors.New("reader EOF")
View Source
var ErrUnknownPacket = errors.New("unknown packet")
Functions ¶
This section is empty.
Types ¶
type ClientCommandQueryPacket ¶
type ClientCommandQueryPacket struct {
Statement string
}
func (*ClientCommandQueryPacket) PacketType ¶
func (this *ClientCommandQueryPacket) PacketType() PacketType
type ClientCommandStatementClosePacket ¶
type ClientCommandStatementClosePacket struct {
StatementId uint32
}
func (*ClientCommandStatementClosePacket) PacketType ¶
func (this *ClientCommandStatementClosePacket) PacketType() PacketType
type ClientCommandStatementPreparePacket ¶
type ClientCommandStatementPreparePacket struct {
Statement string
}
func (*ClientCommandStatementPreparePacket) PacketType ¶
func (this *ClientCommandStatementPreparePacket) PacketType() PacketType
type EndpointSide ¶
type EndpointSide string
const ( TypeServerSide EndpointSide = "server" TypeClientSide EndpointSide = "client" )
type MySQLConn ¶
type MySQLConn struct { State MySQLConnState CommandQueue list.List QueueLock sync.Mutex SQLSnifferHandler SQLSnifferHandler UnknownPacketHandler UnknownPacketHandler DebugUnknownPacketType bool DebugRawPacket bool }
func NewMySQLConn ¶
func NewMySQLConn() *MySQLConn
func NewMySQLConnWithSniffer ¶
func NewMySQLConnWithSniffer(handler SQLSnifferHandler, unknownPacketHandler UnknownPacketHandler) *MySQLConn
func (*MySQLConn) ChangeState ¶
func (this *MySQLConn) ChangeState(newState MySQLConnState) (MySQLConnState, bool, error)
func (*MySQLConn) DequeuePacket ¶
func (*MySQLConn) GetCurrentState ¶
func (this *MySQLConn) GetCurrentState() MySQLConnState
func (*MySQLConn) HandleCommandPhaseClientPacket ¶
func (*MySQLConn) HandleCommandPhaseServerPacket ¶
func (*MySQLConn) HandleConnPhase ¶
func (this *MySQLConn) HandleConnPhase(inbound, outbound io.ReadWriter) error
func (*MySQLConn) HandleConnPhase0 ¶
func (this *MySQLConn) HandleConnPhase0(inbound, outbound io.ReadWriter) error
type MySQLConnState ¶
type MySQLConnState int32
const ( StateConn MySQLConnState = 1 StateCommand MySQLConnState = 2 )
type OkPacket ¶
type OkPacket struct { }
func (*OkPacket) PacketType ¶
func (o *OkPacket) PacketType() PacketType
type PacketType ¶
type PacketType int
const ( UnknownPacketType PacketType = -1 CommonOkPacketType PacketType = 1 )
const ( ClientCommandQueryType PacketType = 101 ClientCommandStatementPrepareType PacketType = 102 ClientCommandStatementCloseType PacketType = 103 )
const (
ServerCommandStatementResponseType PacketType = 201
)
type SQLSnifferHandler ¶
type SQLSnifferHandler func(sql string)
type ServerCommandStatementResponsePacket ¶
type ServerCommandStatementResponsePacket struct {
StatementId uint32
}
func (*ServerCommandStatementResponsePacket) PacketType ¶
func (o *ServerCommandStatementResponsePacket) PacketType() PacketType
type UnknownPacket ¶
func (*UnknownPacket) PacketType ¶
func (this *UnknownPacket) PacketType() PacketType
type UnknownPacketHandler ¶
type UnknownPacketHandler func(packet *RawPacket, side EndpointSide)
Click to show internal directories.
Click to hide internal directories.