mydb

package
v0.0.0-...-1107578 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2018 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	C_mysql_alive_query          string = "select 1"
	C_mysql_sql_global_status    string = "show global status"
	C_mysql_sql_global_vars      string = "show global variables"
	C_mysql_sql_slave_status     string = "show slave status"
	C_mysql_sql_slave_status_all string = "show all slaves status"
	C_mysql_sql_innodb_status    string = "show engine innodb status"
)

Variables

This section is empty.

Functions

func BytesToInt64

func BytesToInt64(b []byte) (int64, error)

func CheckIfMysqlAliveError

func CheckIfMysqlAliveError(err error) bool

func CheckMysqlAlive

func CheckMysqlAlive(db *sql.DB, querySql string) bool

func GetErrorNumber

func GetErrorNumber(err error) (uint16, bool)

func GetPidOfMysql

func GetPidOfMysql(pidFile string) (int32, error)

func MergeMapUint64

func MergeMapUint64(dst map[string]uint64, src map[string]uint64) map[string]uint64

func MysqlShowGlobalStatus

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

func MysqlShowInnodbStatus

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

func ParseInnodbStatusFileIO

func ParseInnodbStatusFileIO(line string) map[string]uint64

5.5 Pending normal aio reads: 0 [0, 0, 0, 0] , aio writes: 0 [0, 0, 0, 0] , ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0 Pending flushes (fsync) log: 0; buffer pool: 0 11990 OS file reads, 279717 OS file writes, 248633 OS fsyncs

5.7 Pending normal aio reads: [0, 0, 0, 0, 0, 0, 0, 0] , aio writes: [0, 0, 0, 0, 0, 0, 0, 0] , ibuf aio reads:, log i/o's:, sync i/o's: Pending flushes (fsync) log: 0; buffer pool: 0 446 OS file reads, 272985 OS file writes, 2974 OS fsyncs 0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s

func ParseInnodbStatusLog

func ParseInnodbStatusLog(line string) map[string]uint64

func ParseInnodbStatusRowOperation

func ParseInnodbStatusRowOperation(line string) map[string]uint64

func ParseInnodbStatusSemaphores

func ParseInnodbStatusSemaphores(line string) map[string]uint64

func ParseInnodbStatusTransactions

func ParseInnodbStatusTransactions(line string) map[string]uint64

func StillAliveErrorNumb

func StillAliveErrorNumb(numb uint16) bool

Types

type MySQLSalveStatus

type MySQLSalveStatus struct {
	Is_Slave bool

	Master_Host string
	Master_Port int32

	Master_User     string
	Master_Password string

	Master_Log_File     string
	Read_Master_Log_Pos uint64

	Relay_Log_File string
	Relay_Log_Pos  uint64

	Relay_Master_Log_File string
	Exec_Master_Log_Pos   uint64

	Relay_Log_Space uint64

	Slave_IO_Running  bool
	Slave_SQL_Running bool

	Seconds_Behind_Master uint64

	Master_UUID        string
	Auto_Position      int32
	Retrieved_Gtid_Set string
	Executed_Gtid_Set  string

	Replicate_Do_DB             string
	Replicate_Ignore_DB         string
	Replicate_Do_Table          string
	Replicate_Ignore_Table      string
	Replicate_Wild_Do_Table     string
	Replicate_Wild_Ignore_Table string

	Replicate_Ignore_Server_Ids string
	Master_Server_Id            int32

	Until_Condition string
	Until_Log_File  string
	Until_Log_Pos   uint64

	Last_Errno               int32
	Last_Error               string
	Last_IO_Errno            int32
	Last_IO_Error            string
	Last_IO_Error_Timestamp  int32
	Last_SQL_Errno           int32
	Last_SQL_Error           string
	Last_SQL_Error_Timestamp int32
}

func MysqlShowSlaveStatusStr

func MysqlShowSlaveStatusStr(db *sql.DB) (MySQLSalveStatus, error)

type MysqlConCfg

type MysqlConCfg struct {
	Host         string
	Port         int
	Socket       string
	User         string
	Password     string
	DefaultDb    string
	WriteTimeout int
	ReadTimeout  int
	Timeout      int

	ParseTime bool
	Location  string

	AutoCommit bool

	MyUrl string
	// contains filtered or unexported fields
}

func (*MysqlConCfg) BuildMysqlUrl

func (my *MysqlConCfg) BuildMysqlUrl() string

func (*MysqlConCfg) CreateMysqlCon

func (my *MysqlConCfg) CreateMysqlCon() (*sql.DB, error)

even error, db is not nil , you have to close it (db.close)

if db != nil {
	db.Close()

func (*MysqlConCfg) CreateMysqlConMultiTimes

func (my *MysqlConCfg) CreateMysqlConMultiTimes(cnt int) (*sql.DB, error)

func (*MysqlConCfg) CreateMysqlConMultiTimesInterval

func (my *MysqlConCfg) CreateMysqlConMultiTimesInterval(cnt int, interval int) (*sql.DB, error)

func (*MysqlConCfg) SetMyConDefaultConConfNotOverwrite

func (my *MysqlConCfg) SetMyConDefaultConConfNotOverwrite()

func (*MysqlConCfg) SetMyConDefaultConConfOverwrite

func (my *MysqlConCfg) SetMyConDefaultConConfOverwrite()

type MysqlVars

type MysqlVars struct {
	V_read_only             uint8
	V_pid_file              string
	V_super_read_only       uint8
	V_innodb_read_only      uint8
	V_max_connections       int64
	V_max_user_connections  int64
	V_relay_log_space_limit int64
}

func MysqlShowGlobalVars

func MysqlShowGlobalVars(db *sql.DB) (MysqlVars, error)

Jump to

Keyboard shortcuts

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