Documentation ¶
Overview ¶
Package utils provides utility functions for MySQL packets
Index ¶
- func BytesToMySQLPacket(buffer []byte) (mysql.Packet, error)
- func GetPayloadLength(src []byte) (length uint32)
- func IsEOFPacket(data []byte) bool
- func IsERRPacket(data []byte) bool
- func IsGenericResponse(data []byte) (string, bool)
- func IsOKPacket(data []byte) bool
- func ReadFirstBuffer(ctx context.Context, logger *zap.Logger, clientConn, destConn net.Conn) ([]byte, string, error)
- func ReadLengthEncodedInteger(b []byte) (num uint64, isNull bool, n int)
- func ReadLengthEncodedString(b []byte) ([]byte, bool, int, error)
- func ReadNullTerminatedString(b []byte) ([]byte, int, error)
- func ReadPacketBuffer(ctx context.Context, logger *zap.Logger, conn net.Conn) ([]byte, error)
- func ReadPacketStream(ctx context.Context, logger *zap.Logger, conn net.Conn, ...)
- func ReadUint24(b []byte) uint32
- func WriteLengthEncodedInteger(buf *bytes.Buffer, num uint64) error
- func WriteLengthEncodedString(buf *bytes.Buffer, s string) error
- func WriteStream(ctx context.Context, logger *zap.Logger, conn net.Conn, buff [][]byte) error
- func WriteUint24(buf *bytes.Buffer, value uint32) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToMySQLPacket ¶
BytesToMySQLPacket converts a byte slice to a MySQL packet
func GetPayloadLength ¶
GetPayloadLength returns the length of the payload from the first 3 bytes of the packet.
func IsEOFPacket ¶
func IsERRPacket ¶
func IsGenericResponse ¶
func IsOKPacket ¶
func ReadFirstBuffer ¶
func ReadFirstBuffer(ctx context.Context, logger *zap.Logger, clientConn, destConn net.Conn) ([]byte, string, error)
ReadFirstBuffer reads the first buffer from either clientConn or destConn
func ReadNullTerminatedString ¶
ReadNullTerminatedString reads a null-terminated string from a byte slice
func ReadPacketBuffer ¶
ReadPacketBuffer reads a MySQL packet from the connection
func ReadPacketStream ¶
func ReadPacketStream(ctx context.Context, logger *zap.Logger, conn net.Conn, bufferChannel chan []byte, errChannel chan error)
ReadPacketStream reads packets from the connection and sends them to the bufferChannel
func ReadUint24 ¶
func WriteStream ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.