mysql

package
v0.0.0-...-5e2cfb7 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	IsMySQLDuplicateError = IsMySQLError(uint16(1062))
	IsMySQLNowaitError    = IsMySQLError(uint16(3572))
)
View Source
var (
	TablesQuery = "SELECT table_name, table_rows FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ?;"

	// CharacterSetVarsQuery see the values of the character set and collation system variables that apply to the current session
	CharacterSetVarsQuery = `` /* 243-byte string literal not displayed */

)

Functions

func IsMySQLError

func IsMySQLError(code uint16) func(error) bool

Types

type ExplainRow

type ExplainRow struct {
	ID           int      `json:"id"`
	SelectType   string   `json:"select_type"`
	Table        *string  `json:"table"`
	Partitions   *string  `json:"partitions"`
	Type         *string  `json:"type"`
	PossibleKeys *string  `json:"possible_keys"`
	Key          *string  `json:"key"`
	KeyLen       *int     `json:"key_len"`
	Ref          *string  `json:"ref"`
	Rows         *int     `json:"rows"`
	Filtered     *float32 `json:"filtered"`
	Extra        *string  `json:"extra"`
}

func (ExplainRow) String

func (er ExplainRow) String() string

type Lock

type Lock struct {
}

type LockWait

type LockWait struct{}

type MySQL

type MySQL struct {
	*sql.DB
}

func NewMySQL

func NewMySQL(db *sql.DB) MySQL

func (MySQL) Explain

func (mysql MySQL) Explain(ctx context.Context, query string, args ...interface{}) ([]ExplainRow, error)

Explain execute `explain query`

func (MySQL) GetCharacterSetVars

func (mysql MySQL) GetCharacterSetVars(ctx context.Context) (map[string]*Var, error)

GetCharacterSets get session character set from mysql `performance_schema.session_variables`

func (MySQL) GetTables

func (mysql MySQL) GetTables(ctx context.Context, databaseName string) (map[string]*Table, error)

GetTables get table from mysql `INFORMATION_SCHEMA.TABLES`

func (MySQL) LockWaits

func (mysql MySQL) LockWaits(ctx context.Context, query string, args ...interface{}) ([]LockWait, error)

func (MySQL) Locks

func (mysql MySQL) Locks(ctx context.Context, query string, args ...interface{}) ([]Lock, error)

func (MySQL) ProcessList

func (mysql MySQL) ProcessList(ctx context.Context, query string, args ...interface{}) (*ProcessList, error)

func (MySQL) Profile

func (mysql MySQL) Profile(ctx context.Context, query string, args ...interface{}) (*Profile, error)

func (MySQL) Trace

func (mysql MySQL) Trace(ctx context.Context, query string, args ...interface{}) (*Trace, error)

func (MySQL) Trxs

func (mysql MySQL) Trxs(ctx context.Context, query string, args ...interface{}) ([]Trx, error)

type ProcessList

type ProcessList struct {
}

type Profile

type Profile struct {
}

type Table

type Table struct {
	Name  string `json:"name"`
	Count int64  `json:"count"`
}

Table database table

type Trace

type Trace struct {
}

type Var

type Var struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Var variable

Jump to

Keyboard shortcuts

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