structure

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DECIMAL     FieldType = 0
	TINY        FieldType = 1
	SHORT       FieldType = 2
	LONG        FieldType = 3
	FLOAT       FieldType = 4
	DOUBLE      FieldType = 5
	NULL        FieldType = 6
	TIMESTAMP   FieldType = 7
	LONGLONG    FieldType = 8
	INT24       FieldType = 9
	DATE        FieldType = 10
	TIME        FieldType = 11
	DATETIME    FieldType = 12
	YEAR        FieldType = 13
	NEWDATE     FieldType = 14
	VARCHAR     FieldType = 15
	BIT         FieldType = 16
	TIMESTAMP2  FieldType = 17
	DATETIME2   FieldType = 18
	TIME2       FieldType = 19
	JSON        FieldType = 245
	NEWDECIMAL  FieldType = 246
	ENUM        FieldType = 247
	SET         FieldType = 248
	TINY_BLOB   FieldType = 249
	MEDIUM_BLOB FieldType = 250
	LONG_BLOB   FieldType = 251
	BLOB        FieldType = 252
	VAR_STRING  FieldType = 253
	STRING      FieldType = 254
	GEOMETRY    FieldType = 255

	DETAIL_NOT_NULL              FieldDetail = 1
	DETAIL_PRIMARY_KEY           FieldDetail = 2
	DETAIL_UNIQUE_KEY            FieldDetail = 4
	DETAIL_MULTIPLE_KEY          FieldDetail = 8
	DETAIL_BLOB                  FieldDetail = 16
	DETAIL_UNSIGNED              FieldDetail = 32
	DETAIL_ZEROFILL_FLAG         FieldDetail = 64
	DETAIL_BINARY_COLLATION      FieldDetail = 128
	DETAIL_ENUM                  FieldDetail = 256
	DETAIL_AUTO_INCREMENT        FieldDetail = 512
	DETAIL_TIMESTAMP             FieldDetail = 1024
	DETAIL_SET                   FieldDetail = 2048
	DETAIL_NO_DEFAULT_VALUE_FLAG FieldDetail = 4096
	DETAIL_ON_UPDATE_NOW_FLAG    FieldDetail = 8192
	DETAIL_PART_KEY_FLAG         FieldDetail = 16384
	DETAIL_NUM_FLAG              FieldDetail = 32768

	CCAP_CLIENT_MYSQL                      ClientCapabilities = 1
	CCAP_FOUND_ROWS                        ClientCapabilities = 2
	CCAP_CONNECT_WITH_DB                   ClientCapabilities = 8
	CCAP_COMPRESS                          ClientCapabilities = 32
	CCAP_LOCAL_FILES                       ClientCapabilities = 128
	CCAP_IGNORE_SPACE                      ClientCapabilities = 256
	CCAP_CLIENT_PROTOCOL_41                ClientCapabilities = 1 << 9
	CCAP_CLIENT_INTERACTIVE                ClientCapabilities = 1 << 10
	CCAP_SSL                               ClientCapabilities = 1 << 11
	CCAP_TRANSACTIONS                      ClientCapabilities = 1 << 12
	CCAP_SECURE_CONNECTION                 ClientCapabilities = 1 << 13
	CCAP_MULTI_STATEMENTS                  ClientCapabilities = 1 << 16
	CCAP_MULTI_RESULTS                     ClientCapabilities = 1 << 17
	CCAP_PS_MULTI_RESULTS                  ClientCapabilities = 1 << 18
	CCAP_PLUGIN_AUTH                       ClientCapabilities = 1 << 19
	CCAP_CONNECT_ATTRS                     ClientCapabilities = 1 << 20
	CCAP_PLUGIN_AUTH_LENENC_CLIENT_DATA    ClientCapabilities = 1 << 21
	CCAP_CLIENT_SESSION_TRACK              ClientCapabilities = 1 << 23
	CCAP_CLIENT_DEPRECATE_EOF              ClientCapabilities = 1 << 24
	CCAP_CLIENT_ZSTD_COMPRESSION_ALGORITHM ClientCapabilities = 1 << 26
	CCAP_CLIENT_CAPABILITY_EXTENSION       ClientCapabilities = 1 << 29
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientCapabilities

type ClientCapabilities uint32

func (ClientCapabilities) MarshalJSON

func (c ClientCapabilities) MarshalJSON() ([]byte, error)

func (ClientCapabilities) String

func (c ClientCapabilities) String() string

type ColumnInfo

type ColumnInfo struct {
	Catalog     string
	TableAlias  string
	Table       string
	Schema      string
	Column      string
	ColumnAlias string
	TypeInfo    TypeInfo
}

type Connection

type Connection struct {
	Address            tcp.ConnectionAddress
	Items              []Transmission
	RawRequestPackets  *packet.Buffer `json:"RawRequestPackets,omitempty"`
	RawResponsePackets *packet.Buffer `json:"RawResponsePackets,omitempty"`
}

func (Connection) FirstSeen

func (c Connection) FirstSeen() time.Time

type DecodeError

type DecodeError struct {
	CompressionOn       bool
	DecodeError         error
	DecodeErrorString   string
	Direction           string
	JustSeenGreeting    bool `json:"JustSeenGreeting,omitempty"`
	Packet              *packet.Packet
	PreviousRequestType string `json:"PreviousRequestType,omitempty"`
	DecoderState        string
}

type ErrorResponse

type ErrorResponse struct {
	Code    uint16
	Type    string
	State   string `json:"State,omitempty"`
	Message string
}

type ExecuteRequest

type ExecuteRequest struct {
	Type           string
	StatementID    uint32
	Flags          uint8
	IterationCount uint32
	// FIXME: ought to think about how to express this in the output.
	NullMap *bitmap.NullBitMap
	Params  []interface{}
}

type FieldDetail

type FieldDetail uint16

func (FieldDetail) MarshalJSON

func (d FieldDetail) MarshalJSON() ([]byte, error)

func (FieldDetail) String

func (d FieldDetail) String() string

type FieldType

type FieldType byte

func (FieldType) MarshalJSON

func (f FieldType) MarshalJSON() ([]byte, error)

func (FieldType) String

func (f FieldType) String() string

type Greeting

type Greeting struct {
	Capabilities ClientCapabilities
	Collation    byte
	Protocol     byte
	Version      string
	Type         string
}

type LoginRequest

type LoginRequest struct {
	Type                 string
	ClientCapabilities   ClientCapabilities
	Collation            byte
	ExtendedCapabilities uint32
	MaxPacketSize        uint32
	Username             string
}

type OKResponse

type OKResponse struct {
	AffectedRows uint64
	LastInsertID uint64
	ServerStatus StatusFlags
	WarningCount uint16
	// FIXME: deal with session tracking
	Type string `json:"Type"`
	Info string
}

type PrepareOKResponse

type PrepareOKResponse struct {
	Type        string `json:"Type"`
	StatementID uint32
	NumColumns  uint16
	NumParams   uint16
	Warnings    int16

	Columns []ColumnInfo `json:"Columns,omitempty"`
	Params  []ColumnInfo `json:"Params,omitempty"`
}

type Request

type Request struct {
	Type  string `json:"Type"`
	Query string `json:"Query,omitempty"`
}

type Response

type Response struct {
	Type string `json:"Type"`
}

type ResponseType

type ResponseType byte
const (
	// MySQLError type.
	MySQLError ResponseType = 0xff
	// MySQLEOF type.
	MySQLEOF ResponseType = 0xfe
	// MySQLOK type.
	MySQLOK ResponseType = 0
	// MySQLLocalInfile type.
	MySQLLocalInfile ResponseType = 0xfb
)

type ResultSetResponse

type ResultSetResponse struct {
	Type    string          `json:"Type"`
	Columns []ColumnInfo    `json:"Columns"`
	Results [][]interface{} `json:"Results"`
}

type StatusFlags

type StatusFlags uint16

func (StatusFlags) MarshalJSON

func (f StatusFlags) MarshalJSON() ([]byte, error)

func (StatusFlags) String

func (f StatusFlags) String() string

type Transmission

type Transmission struct {
	Data interface{}
	Seen []time.Time
}

type TypeInfo

type TypeInfo struct {
	LengthOfFixedFields byte
	CharacterSetNumber  uint16
	MaxColumnSize       uint32
	FieldTypes          FieldType
	FieldDetail         FieldDetail
	Decimals            byte
	Unused              uint16
}

type WithRawPacket

type WithRawPacket struct {
	RawData      []byte
	Transmission interface{}
}

Jump to

Keyboard shortcuts

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