func (conn *Conn) GetReplicationSlaveList() (slaveList []string, err error) {
	slaveList = []string{}
	result, err := conn.Execute(ShowSlaveHostsSQL)
	if err != nil {
		return nil, err
	}
	for i := 0; i < result.RowNumber(); i++ {
		host, err := result.GetStringByName(i, HostString)
		if err != nil {
			return nil, err
		}
		port, err := result.GetIntByName(i, PortString)
		if err != nil {
			return nil, err
		}
		addr := fmt.Sprintf("%s:%d", host, port)
		slaveList = append(slaveList, addr)
	}
	return slaveList, nil
}
GetReplicationSlaveList returns slave list of this server
package mysql
import (
	"context"
	"fmt"
	"github.com/go-mysql-org/go-mysql/client"
	"github.com/romberli/go-util/common"
	"github.com/romberli/go-util/constant"
)
type ReplicationRole string
const (
	DefaultCharSet       = "utf8mb4"
	HostString           = "host"
	PortString           = "port"
	SelectVersionSQL     = "select @@version"
	ShowSlaveStatusSQL   = "show slave status"
	ShowReplicaStatusSQL = "show replica status"
	ShowSlaveHostsSQL    = "show slave hosts"
	ReplicationSource ReplicationRole = "source"
	ReplicationReplica ReplicationRole = "replica"
	ReplicationRelay ReplicationRole = "relay"
)
type Config struct {
	Addr   string
	DBName string
	DBUser string
	DBPass string
}
func NewConfig(addr string, dbName string, dbUser string, dbPass string) Config {
	return Config{
		Addr:   addr,
		DBName: dbName,
		DBUser: dbUser,
		DBPass: dbPass,
	}
}
type Conn struct {
	Config
	*client.Conn
}
func NewConn(addr string, dbName string, dbUser string, dbPass string) (*Conn, error) {
	config := NewConfig(addr, dbName, dbUser, dbPass)
	conn, err := client.Connect(addr, dbUser, dbPass, dbName)
	if err != nil {
		return nil, err
	}
	err = conn.SetCharset(DefaultCharSet)
	if err != nil {
		return nil, err
	}
	err = conn.UseDB(dbName)
	if err != nil {
		return nil, err
	}
	return &Conn{
		Config: config,
		Conn:   conn,
	}, nil
}
func (conn *Conn) Prepare(command string) (*Statement, error) {
	return conn.prepareContext(context.Background(), command)
}
func (conn *Conn) PrepareContext(ctx context.Context, command string) (*Statement, error) {
	return conn.prepareContext(ctx, command)
}
func (conn *Conn) prepareContext(ctx context.Context, command string) (*Statement, error) {
	stmt, err := conn.Conn.Prepare(command)
	if err != nil {
		return nil, err
	}
	return NewStatement(stmt), nil
}
func (conn *Conn) Execute(command string, args ...interface{}) (*Result, error) {
	return conn.executeContext(context.Background(), command, args...)
}
func (conn *Conn) ExecuteContext(ctx context.Context, command string, args ...interface{}) (*Result, error) {
	return conn.executeContext(ctx, command, args...)
}
func (conn *Conn) executeContext(ctx context.Context, command string, args ...interface{}) (*Result, error) {
	err := common.SetRandomValueToNil(args...)
	if err != nil {
		return nil, err
	}
	result, err := conn.Conn.Execute(command, args...)
	if err != nil {
		return nil, err
	}
	return NewResult(result), nil
}
func (conn *Conn) GetVersion() (Version, error) {
	result, err := conn.Execute(SelectVersionSQL)
	if err != nil {
		return nil, err
	}
	versionStr, err := result.GetString(constant.ZeroInt, constant.ZeroInt)
	if err != nil {
		return nil, err
	}
	return Parse(versionStr)
}
func (conn *Conn) CheckInstanceStatus() bool {
	sql := "select 1 as ok;"
	result, err := conn.Execute(sql)
	if err != nil {
		return false
	}
	ok, err := result.GetIntByName(constant.ZeroInt, "ok")
	if err != nil {
		return false
	}
	return ok == 1
}