executor

package
v1.2207.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExplainRecordExtraUsingFilesort  = "Using filesort"
	ExplainRecordExtraUsingTemporary = "Using temporary"

	ExplainRecordAccessTypeAll   = "ALL"
	ExplainRecordAccessTypeIndex = "index"
)

https://dev.mysql.com/doc/refman/5.7/en/explain-output.html#explain_rows

View Source
const DAIL_TIMEOUT = 5 * time.Second

Variables

This section is empty.

Functions

func Ping

func Ping(entry *logrus.Entry, instance *mdriver.DSN) error

Types

type BaseConn

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

func (*BaseConn) Close

func (c *BaseConn) Close()

func (*BaseConn) Exec

func (c *BaseConn) Exec(query string) (driver.Result, error)

func (*BaseConn) Logger

func (c *BaseConn) Logger() *logrus.Entry

func (*BaseConn) Ping

func (c *BaseConn) Ping() error

func (*BaseConn) Query

func (c *BaseConn) Query(query string, args ...interface{}) ([]map[string]sql.NullString, error)

func (*BaseConn) QueryWithContext added in v1.2205.0

func (c *BaseConn) QueryWithContext(ctx context.Context, query string, args ...interface{}) (column []string, row [][]sql.NullString, err error)

func (*BaseConn) Transact

func (c *BaseConn) Transact(qs ...string) ([]driver.Result, error)

type Db

type Db interface {
	Close()
	Ping() error
	Exec(query string) (driver.Result, error)
	Transact(qs ...string) ([]driver.Result, error)
	Query(query string, args ...interface{}) ([]map[string]sql.NullString, error)
	QueryWithContext(ctx context.Context, query string, args ...interface{}) (column []string, row [][]sql.NullString, err error)
	Logger() *logrus.Entry
}

type Executor

type Executor struct {
	Db Db
	// contains filtered or unexported fields
}

func NewExecutor

func NewExecutor(entry *logrus.Entry, instance *mdriver.DSN, schema string) (*Executor, error)

func NewMockExecutor

func NewMockExecutor() (*Executor, sqlmock.Sqlmock, error)

NewMockExecutor returns a new mock executor.

func (*Executor) Explain

func (c *Executor) Explain(query string) (columns []string, rows [][]sql.NullString, err error)

func (*Executor) FetchMasterBinlogPos

func (c *Executor) FetchMasterBinlogPos() (string, int64, error)

func (*Executor) GetExplainRecord added in v1.2206.0

func (c *Executor) GetExplainRecord(query string) ([]*ExplainRecord, error)

func (*Executor) GetTableColumnsInfo added in v1.2206.0

func (c *Executor) GetTableColumnsInfo(schema, tableName string) ([]*TableColumnsInfo, error)

func (*Executor) GetTableIndexesInfo added in v1.2206.0

func (c *Executor) GetTableIndexesInfo(schema, tableName string) ([]*TableIndexesInfo, error)

func (*Executor) IsLowerCaseTableNames added in v1.2207.0

func (c *Executor) IsLowerCaseTableNames() bool

func (*Executor) SetLowerCaseTableNames added in v1.2207.0

func (c *Executor) SetLowerCaseTableNames(lowerCaseTableNames bool)

func (*Executor) ShowCreateTable

func (c *Executor) ShowCreateTable(schema, tableName string) (string, error)

When using keywords as table names, you need to pay attention to wrapping them in quotation marks

func (*Executor) ShowCreateView added in v1.2202.0

func (c *Executor) ShowCreateView(tableName string) (string, error)

When using keywords as view names, you need to pay attention to wrapping them in quotation marks

func (*Executor) ShowDatabases

func (c *Executor) ShowDatabases(ignoreSysDatabase bool) ([]string, error)

func (*Executor) ShowDefaultConfiguration

func (c *Executor) ShowDefaultConfiguration(sql, column string) (string, error)

func (*Executor) ShowMasterStatus

func (c *Executor) ShowMasterStatus() ([]map[string]sql.NullString, error)

func (*Executor) ShowSchemaTables

func (c *Executor) ShowSchemaTables(schema string) ([]string, error)

func (*Executor) ShowSchemaViews added in v1.2202.0

func (c *Executor) ShowSchemaViews(schema string) ([]string, error)

func (*Executor) ShowTableSizeMB

func (c *Executor) ShowTableSizeMB(schema, table string) (float64, error)

type ExplainRecord

type ExplainRecord struct {
	Id           string `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       string `json:"key_len"`
	Ref          string `json:"ref"`
	Rows         int64  `json:"rows"`
	Filtered     string `json:"filtered"`
	Extra        string `json:"extra"`
}

type TableColumnsInfo added in v1.2206.0

type TableColumnsInfo struct {
	ColumnName       string
	ColumnType       string
	CharacterSetName string
	IsNullable       string
	ColumnKey        string
	ColumnDefault    string
	Extra            string
	ColumnComment    string
}

type TableIndexesInfo added in v1.2206.0

type TableIndexesInfo struct {
	ColumnName  string
	KeyName     string
	NonUnique   string
	SeqInIndex  string
	Cardinality string
	Null        string
	IndexType   string
	Comment     string
}

Jump to

Keyboard shortcuts

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