mysql

package
v2.6.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseDB

func CloseDB(db *sql.DB) error

CloseDB closes the db connection

func CreateDB

func CreateDB(cfg types.DBConfig) (*sql.DB, error)

CreateDB creates db connection using the cfg

func GetRunningDDLCount

func GetRunningDDLCount(db *sql.DB) (int, error)

GetRunningDDLCount returns the count of ddls that are running

func GetRunningProcesses

func GetRunningProcesses(db *sql.DB) ([]string, error)

GetRunningProcesses get all running processes

func GetServerUUID

func GetServerUUID(db *sql.DB) (string, error)

GetServerUUID returns the uuid of current mysql server

func GetSlaveStatus

func GetSlaveStatus(db *sql.DB) (map[string]string, error)

GetSlaveStatus runs `show slave status` ans return the result as a map[string]string

func GetTxnIDFromGTIDStr

func GetTxnIDFromGTIDStr(gtidStr, serverUUID string) (int64, error)

GetTxnIDFromGTIDStr get the last txn id from the gtidset and serverUUID

func KillProcess

func KillProcess(db *sql.DB, pid string) error

KillProcess kill the process given the pid

func PromoteToMaster

func PromoteToMaster(db *sql.DB, replicationUser string, mysqlNet string) error

PromoteToMaster promotes the db to master

func RedirectMaster

func RedirectMaster(db *sql.DB, replicationUser, replicationPassword, masterHost string, masterPort string) error

RedirectMaster directs db to a different master

func Select1

func Select1(db *sql.DB) error

Select1 is used to test connection

func SetReadOnly

func SetReadOnly(db *sql.DB) error

SetReadOnly add read lock to db

func SetReadWrite

func SetReadWrite(db *sql.DB) error

SetReadWrite release read lock to db

func WaitCatchMaster

func WaitCatchMaster(db *sql.DB, gtid string) error

WaitCatchMaster blocks until mysql catches given gtid

Types

type GTIDSet

type GTIDSet struct {
	*gmysql.MysqlGTIDSet
}

GTIDSet wraps mysql.MysqlGTIDSet

func GetMasterStatus

func GetMasterStatus(db *sql.DB) (gmysql.Position, GTIDSet, error)

GetMasterStatus shows master status of MySQL.

Jump to

Keyboard shortcuts

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