protocol

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Command types
	MySQLComQuit        byte = 0x01
	MySQLComInitDB      byte = 0x02
	MySQLComQuery       byte = 0x03
	MySQLComFieldList   byte = 0x04
	MySQLComCreateDB    byte = 0x05
	MySQLComDropDB      byte = 0x06
	MySQLComRefresh     byte = 0x07
	MySQLComShutdown    byte = 0x08
	MySQLComStatistics  byte = 0x09
	MySQLComProcessInfo byte = 0x0a
	MySQLComConnect     byte = 0x0b
	MySQLComProcessKill byte = 0x0c
	MySQLComDebug       byte = 0x0d
	MySQLComPing        byte = 0x0e
	MySQLComChangeUser  byte = 0x11

	// Server status flags
	MySQLServerStatusInTrans            uint16 = 0x0001
	MySQLServerStatusAutocommit         uint16 = 0x0002
	MySQLServerStatusMoreResultsExists  uint16 = 0x0008
	MySQLServerStatusNoGoodIndexUsed    uint16 = 0x0010
	MySQLServerStatusNoIndexUsed        uint16 = 0x0020
	MySQLServerStatusCursorExists       uint16 = 0x0040
	MySQLServerStatusLastRowSent        uint16 = 0x0080
	MySQLServerStatusDBDropped          uint16 = 0x0100
	MySQLServerStatusNoBackslashEscapes uint16 = 0x0200
	MySQLServerStatusMetadataChanged    uint16 = 0x0400

	// Field types
	MySQLTypeDecimal    byte = 0x00
	MySQLTypeTiny       byte = 0x01
	MySQLTypeShort      byte = 0x02
	MySQLTypeLong       byte = 0x03
	MySQLTypeFloat      byte = 0x04
	MySQLTypeDouble     byte = 0x05
	MySQLTypeNull       byte = 0x06
	MySQLTypeTimestamp  byte = 0x07
	MySQLTypeLongLong   byte = 0x08
	MySQLTypeInt24      byte = 0x09
	MySQLTypeDate       byte = 0x0a
	MySQLTypeTime       byte = 0x0b
	MySQLTypeDateTime   byte = 0x0c
	MySQLTypeYear       byte = 0x0d
	MySQLTypeNewDate    byte = 0x0e
	MySQLTypeVarchar    byte = 0x0f
	MySQLTypeBit        byte = 0x10
	MySQLTypeJSON       byte = 0xf5
	MySQLTypeNewDecimal byte = 0xf6
	MySQLTypeEnum       byte = 0xf7
	MySQLTypeSet        byte = 0xf8
	MySQLTypeTinyBlob   byte = 0xf9
	MySQLTypeMediumBlob byte = 0xfa
	MySQLTypeLongBlob   byte = 0xfb
	MySQLTypeBlob       byte = 0xfc
	MySQLTypeVarString  byte = 0xfd
	MySQLTypeString     byte = 0xfe
	MySQLTypeGeometry   byte = 0xff
)

MySQL protocol constants

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQLClient

type MySQLClient struct {
	// contains filtered or unexported fields
}

MySQLClient represents a MySQL client connection

type MySQLServer

type MySQLServer struct {
	// contains filtered or unexported fields
}

MySQLServer implements a MySQL-compatible server

func NewMySQLServer

func NewMySQLServer(db *engine.DB, version string) *MySQLServer

NewMySQLServer creates a new MySQL-compatible server

func (*MySQLServer) Addr

func (s *MySQLServer) Addr() net.Addr

Addr returns the listener address (useful for tests)

func (*MySQLServer) Close

func (s *MySQLServer) Close() error

Close stops the MySQL server and all client connections

func (*MySQLServer) Listen

func (s *MySQLServer) Listen(address string) error

Listen starts listening for MySQL connections

func (*MySQLServer) SetAuthenticator

func (s *MySQLServer) SetAuthenticator(a *auth.Authenticator)

SetAuthenticator sets the authenticator for the MySQL server. When set and enabled, connections must provide valid credentials. If not set or not enabled, all connections are accepted (backward compatible).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL