Versions in this module Expand all Collapse all v1 v1.0.1 Jul 31, 2024 Changes in this version + var ErrConnectionWasClosed = errors.NewKind("connection was closed") + var ErrRowTimeout = errors.NewKind("row read wait bigger than connection timeout") + var QueryCounter = discard.NewCounter() + var QueryErrorCounter = discard.NewCounter() + var QueryHistogram = discard.NewHistogram() + var UnixSocketInUseError = errors.New("bind address at given unix socket path is already in use") + func Intercept(h Interceptor) + type Chain interface + ComMultiQuery func(c *mysql.Conn, query string, callback mysql.ResultSpoolFn) (string, error) + ComPrepare func(c *mysql.Conn, query string, prepare *mysql.PrepareData) ([]*querypb.Field, error) + ComQuery func(c *mysql.Conn, query string, callback mysql.ResultSpoolFn) error + ComStmtExecute func(c *mysql.Conn, prepare *mysql.PrepareData, ...) error + type Config struct + Address string + AllowClearTextWithoutTLS bool + ConnReadTimeout time.Duration + ConnWriteTimeout time.Duration + DisableClientMultiStatements bool + EncodeLoggedQuery bool + Listener net.Listener + MaxConnections uint64 + MaxLoggedQueryLen int + NoDefaults bool + Options []Option + Protocol string + RequireSecureTransport bool + Socket string + TLSConfig *tls.Config + Tracer trace.Tracer + Version string + func (c Config) NewConfig() (Config, error) + type DoneFunc func() + type Handler struct + func (h *Handler) ComBind(c *mysql.Conn, query string, parsedQuery mysql.ParsedQuery, ...) (mysql.BoundQuery, []*querypb.Field, error) + func (h *Handler) ComBinlogDumpGTID(c *mysql.Conn, logFile string, logPos uint64, gtidSet mysql.GTIDSet) error + func (h *Handler) ComExecuteBound(c *mysql.Conn, query string, boundQuery mysql.BoundQuery, ...) error + func (h *Handler) ComInitDB(c *mysql.Conn, schemaName string) error + func (h *Handler) ComMultiQuery(c *mysql.Conn, query string, callback mysql.ResultSpoolFn) (string, error) + func (h *Handler) ComParsedQuery(c *mysql.Conn, query string, parsed sqlparser.Statement, ...) error + func (h *Handler) ComPrepare(c *mysql.Conn, query string, prepare *mysql.PrepareData) ([]*querypb.Field, error) + func (h *Handler) ComPrepareParsed(c *mysql.Conn, query string, parsed sqlparser.Statement, ...) (mysql.ParsedQuery, []*querypb.Field, error) + func (h *Handler) ComQuery(c *mysql.Conn, query string, callback mysql.ResultSpoolFn) error + func (h *Handler) ComRegisterReplica(c *mysql.Conn, replicaHost string, replicaPort uint16, replicaUser string, ...) error + func (h *Handler) ComResetConnection(c *mysql.Conn) error + func (h *Handler) ComStmtExecute(c *mysql.Conn, prepare *mysql.PrepareData, ...) error + func (h *Handler) ConnectionClosed(c *mysql.Conn) + func (h *Handler) NewConnection(c *mysql.Conn) + func (h *Handler) ParserOptionsForConnection(c *mysql.Conn) (sqlparser.ParserOptions, error) + func (h *Handler) WarningCount(c *mysql.Conn) uint16 + type HandlerWrapper func(h mysql.Handler) (mysql.Handler, error) + type Interceptor interface + MultiQuery func(chain Chain, c *mysql.Conn, query string, ...) (string, error) + ParsedQuery func(chain Chain, c *mysql.Conn, query string, parsed sqlparser.Statement, ...) error + Prepare func(chain Chain, c *mysql.Conn, query string, prepare *mysql.PrepareData) ([]*querypb.Field, error) + Priority func() int + Query func(chain Chain, c *mysql.Conn, query string, ...) error + StmtExecute func(chain Chain, c *mysql.Conn, prepare *mysql.PrepareData, ...) error + type Listener struct + func NewListener(protocol, address string, unixSocketPath string) (*Listener, error) + func (l *Listener) Accept() (net.Conn, error) + func (l *Listener) Addr() net.Addr + func (l *Listener) Close() error + type MultiStmtMode int + const MultiStmtModeOff + const MultiStmtModeOn + type Option func(e *sqle.Engine, sm *SessionManager, handler mysql.Handler) + func WithChain() Option + type ProtocolListener interface + Accept func() + Addr func() net.Addr + Close func() + type ProtocolListenerFunc func(cfg mysql.ListenerConfig) (ProtocolListener, error) + var DefaultProtocolListenerFunc ProtocolListenerFunc = func(cfg mysql.ListenerConfig) (ProtocolListener, error) { ... } + type QueryExecutor func(ctx *sql.Context, query string, parsed sqlparser.Statement, analyzed sql.Node, ...) (sql.Schema, sql.RowIter, error) + type Server struct + Engine *gms.Engine + Listener ProtocolListener + func NewServer(cfg Config, e *sqle.Engine, sb SessionBuilder, listener ServerEventListener) (*Server, error) + func NewServerWithHandler(cfg Config, e *sqle.Engine, sb SessionBuilder, listener ServerEventListener, ...) (*Server, error) + func (s *Server) Close() error + func (s *Server) SessionManager() *SessionManager + func (s *Server) Start() error + func (s *Server) WarnIfLoadFileInsecure() + type ServerEventListener interface + ClientConnected func() + ClientDisconnected func() + QueryCompleted func(success bool, duration time.Duration) + QueryStarted func() + type SessionBuilder func(ctx context.Context, conn *mysql.Conn, addr string) (sql.Session, error) + type SessionManager struct + func NewSessionManager(builder SessionBuilder, tracer trace.Tracer, ...) *SessionManager + func (s *SessionManager) AddConn(conn *mysql.Conn) + func (s *SessionManager) Iter(f func(session sql.Session) (stop bool, err error)) error + func (s *SessionManager) KillConnection(connID uint32) error + func (s *SessionManager) NewContext(conn *mysql.Conn) (*sql.Context, error) + func (s *SessionManager) NewContextWithQuery(conn *mysql.Conn, query string) (*sql.Context, error) + func (s *SessionManager) NewSession(ctx context.Context, conn *mysql.Conn) error + func (s *SessionManager) RemoveConn(conn *mysql.Conn) + func (s *SessionManager) SetDB(conn *mysql.Conn, dbName string) error