server

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServer

func NewServer(h Handler, opts ...Option) *server

func RandBytes

func RandBytes(n int) []byte

Types

type Command

type Command interface {
	Ping() error
	Query(query string) (ResultSet, error)
	Quit()
	Other(data []byte, conn mysql.Conn)
}

type DefaultHandler

type DefaultHandler struct{}

func NewDefaultHandler

func NewDefaultHandler() *DefaultHandler

func (*DefaultHandler) OnClose

func (h *DefaultHandler) OnClose(connId uint32)

func (*DefaultHandler) OnConnect

func (h *DefaultHandler) OnConnect(connId uint32)

func (*DefaultHandler) Other

func (h *DefaultHandler) Other(data []byte, conn mysql.Conn)

func (*DefaultHandler) Ping

func (h *DefaultHandler) Ping() error

func (*DefaultHandler) Query

func (h *DefaultHandler) Query(query string) (ResultSet, error)

func (*DefaultHandler) Quit

func (h *DefaultHandler) Quit()

type Handler

type Handler interface {
	Command
	Listener
}

type Listener

type Listener interface {
	OnConnect(connId uint32)
	OnClose(connId uint32)
}

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithAuthPlugin

func WithAuthPlugin(plugin core.AuthenticationPlugin) Option

func WithHost

func WithHost(host string) Option

func WithPassword

func WithPassword(password string) Option

func WithPort

func WithPort(port int) Option

func WithSSLCA

func WithSSLCA(sslCA string) Option

func WithSSLCert

func WithSSLCert(sslCert string) Option

func WithSSLKey

func WithSSLKey(sslKey string) Option

func WithUseSSL

func WithUseSSL(useSSL bool) Option

func WithUser

func WithUser(user string) Option

func WithVersion

func WithVersion(version string) Option

type ResultSet

type ResultSet interface {
	Columns() []packet.Column
	Rows() []packet.Row
	WriteText(mysql.Conn) error
}

func NewSimpleResultSet

func NewSimpleResultSet(columnNames []string, rowValues [][]interface{}) (ResultSet, error)

Jump to

Keyboard shortcuts

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