mysqltest

package
v0.0.0-...-225f367 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Explain

type Explain struct {
	SQL          string
	ID           *string `db:"id"`
	SelectType   *string `db:"select_type"`
	Table        *string `db:"table"`
	Partitions   *string `db:"partitions"`
	Type         *string `db:"type"`
	PossibleKeys *string `db:"possible_keys"`
	Key          *string `db:"key"`
	KeyLen       *string `db:"key_len"`
	Ref          *string `db:"ref"`
	Rows         *string `db:"rows"`
	Filtered     *string `db:"filtered"`
	Extra        *string `db:"Extra"`
}

Explain represents the explain result.

type Mysqltester

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

Mysqltester mysqld

func NewMysqltester

func NewMysqltester() (*Mysqltester, error)

NewMysqltester create a mysqld instance.

func (*Mysqltester) DSN

func (m *Mysqltester) DSN() string

DSN creates a datasource name string that is appropriate for connecting to the database instance

func (*Mysqltester) EnableGeneralLog

func (m *Mysqltester) EnableGeneralLog() error

EnableGeneralLog sets global general_log to ON. After doing this, all receiving sql will be recorded in table `mysql.general_log`

func (*Mysqltester) Exec

func (m *Mysqltester) Exec(query string, args ...interface{}) (sql.Result, error)

Exec executes a query without returning any rows. The args are for any placeholder parameters in the query.

func (*Mysqltester) Explain

func (m *Mysqltester) Explain(sql string, args ...interface{}) (*Explain, error)

Explain explain the sql.

func (*Mysqltester) MustExec

func (m *Mysqltester) MustExec(query string, args ...interface{}) sql.Result

MustExec (panic) runs MustExec using this database. Any placeholder parameters are replaced with supplied args.

func (*Mysqltester) Query

func (m *Mysqltester) Query(query string, args ...interface{}) (*sql.Rows, error)

Query executes a query that returns rows, typically a SELECT. The args are for any placeholder parameters in the query.

func (*Mysqltester) Stop

func (m *Mysqltester) Stop()

Stop explicitly stops the execution of mysqld.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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