dbhelper

package
v0.0.2-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2015 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

dbhelper.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckBinlogFilters

func CheckBinlogFilters(m *sqlx.DB, s *sqlx.DB) bool

func CheckHostAddr

func CheckHostAddr(h string) (string, error)

Check if string is an IP address or a hostname, return a IP address

func CheckLongRunningWrites

func CheckLongRunningWrites(db *sqlx.DB, thresh int) int

func CheckReplicationFilters

func CheckReplicationFilters(m *sqlx.DB, s *sqlx.DB) bool

func CheckSlavePrerequisites

func CheckSlavePrerequisites(db *sqlx.DB, s string) bool
Check for a list of slave prerequisites.

- Slave is connected - Binary log on - Connected to master - No replication filters

func CheckSlaveSync

func CheckSlaveSync(dbS *sqlx.DB, dbM *sqlx.DB) bool

Check if a slave is in sync with his master

func Connect

func Connect(user string, password string, address string) *sqlx.DB

Connect to a MySQL server. Must be deprecated, use MySQLConnect instead

func FlushTablesNoLog

func FlushTablesNoLog(db *sqlx.DB) error

func FlushTablesWithReadLock

func FlushTablesWithReadLock(db *sqlx.DB) error

func GetAddress

func GetAddress(host string, port string, socket string) string

func GetSlaveHosts

func GetSlaveHosts(db *sqlx.DB) map[string]interface{}

func GetSlaveHostsDiscovery

func GetSlaveHostsDiscovery(db *sqlx.DB) []string

func GetStatus

func GetStatus(db *sqlx.DB) map[string]string

func GetStatusAsInt

func GetStatusAsInt(db *sqlx.DB) map[string]int64

func GetVariableByName

func GetVariableByName(db *sqlx.DB, name string) string

func GetVariables

func GetVariables(db *sqlx.DB) map[string]string

func IsSlaveof

func IsSlaveof(db *sqlx.DB, s string, m string) bool

Check if server is connected to declared master

func MasterPosWait

func MasterPosWait(db *sqlx.DB, gtid string) error

func MySQLConnect

func MySQLConnect(user string, password string, address string) (*sqlx.DB, error)

func ResetSlave

func ResetSlave(db *sqlx.DB, all bool) error

func SetReadOnly

func SetReadOnly(db *sqlx.DB, flag bool) error

func StartSlave

func StartSlave(db *sqlx.DB) error

func StopSlave

func StopSlave(db *sqlx.DB) error

func UnlockTables

func UnlockTables(db *sqlx.DB) error

Types

type MasterStatus

type MasterStatus struct {
	File             string
	Position         string
	Binlog_Do_DB     string
	Binlog_Ignore_DB string
}

func GetMasterStatus

func GetMasterStatus(db *sqlx.DB) (MasterStatus, error)

type Processlist

type Processlist struct {
	Id       uint64
	User     string
	Host     string
	Database sql.NullString
	Command  string
	Time     float64
	State    string
}

func GetProcesslist

func GetProcesslist(db *sqlx.DB) []Processlist

type SlaveHosts

type SlaveHosts struct {
	Server_id uint64
	Host      string
	Port      uint
	Master_id uint64
}

func GetSlaveHostsArray

func GetSlaveHostsArray(db *sqlx.DB) []SlaveHosts

type SlaveStatus

type SlaveStatus struct {
	Slave_IO_State                string
	Master_Host                   string
	Master_User                   string
	Master_Port                   uint
	Connect_Retry                 uint
	Master_Log_File               string
	Read_Master_Log_Pos           uint
	Relay_Log_File                string
	Relay_Log_Pos                 uint
	Relay_Master_Log_File         string
	Slave_IO_Running              string
	Slave_SQL_Running             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
	Last_Errno                    uint
	Last_Error                    string
	Skip_Counter                  uint
	Exec_Master_Log_Pos           uint
	Relay_Log_Space               uint
	Until_Condition               string
	Until_Log_File                string
	Until_Log_Pos                 uint
	Master_SSL_Allowed            string
	Master_SSL_CA_File            string
	Master_SSL_CA_Path            string
	Master_SSL_Cert               string
	Master_SSL_Cipher             string
	Master_SSL_Key                string
	Seconds_Behind_Master         sql.NullInt64
	Master_SSL_Verify_Server_Cert string
	Last_IO_Errno                 uint
	Last_IO_Error                 string
	Last_SQL_Errno                uint
	Last_SQL_Error                string
	Replicate_Ignore_Server_Ids   string
	Master_Server_Id              uint
	Master_SSL_Crl                string
	Master_SSL_Crlpath            string
	Using_Gtid                    string
	Gtid_IO_Pos                   string
}

func GetSlaveStatus

func GetSlaveStatus(db *sqlx.DB) (SlaveStatus, error)

Jump to

Keyboard shortcuts

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