Documentation ¶
Index ¶
- Constants
- Variables
- func GetDBConnection(dsn string) (*sql.DB, error)
- func NewCommands() engines.ClusterCommands
- func NewManager(properties engines.Properties) (engines.DBManager, error)
- func QueryRowsMap(db *sql.DB, query string, onRow func(RowMap) error, args ...interface{}) (err error)
- func ScanRowsToArrays(rows *sql.Rows, onRow func([]CellData) error) error
- func ScanRowsToMaps(rows *sql.Rows, onRow func(RowMap) error) error
- type CellData
- type Commands
- type Config
- type GTIDItem
- type GTIDSet
- func (gtidSet *GTIDSet) Explode() (result []*GTIDItem)
- func (gtidSet *GTIDSet) IsEmpty() bool
- func (gtidSet *GTIDSet) RemoveUUID(uuid string) (removed bool)
- func (gtidSet *GTIDSet) RetainUUID(uuid string) (anythingRemoved bool)
- func (gtidSet *GTIDSet) RetainUUIDs(uuids []string) (anythingRemoved bool)
- func (gtidSet *GTIDSet) SharedUUIDs(other *GTIDSet) (shared []string)
- func (gtidSet *GTIDSet) String() string
- type Manager
- func (mgr *Manager) CreateRoot(context.Context) error
- func (mgr *Manager) CreateUser(ctx context.Context, userName, password string) error
- func (mgr *Manager) DeleteUser(ctx context.Context, userName string) error
- func (mgr *Manager) Demote(context.Context) error
- func (mgr *Manager) DescribeUser(ctx context.Context, userName string) (*models.UserInfo, error)
- func (mgr *Manager) EnableSemiSyncIfNeed(ctx context.Context) error
- func (mgr *Manager) EnsureServerID(ctx context.Context) (bool, error)
- func (mgr *Manager) Exec(ctx context.Context, sql string) (int64, error)
- func (mgr *Manager) Follow(ctx context.Context, cluster *dcs.Cluster) error
- func (mgr *Manager) GetDBState(ctx context.Context, cluster *dcs.Cluster) *dcs.DBState
- func (mgr *Manager) GetGlobalState(ctx context.Context, db *sql.DB) (map[string]string, error)
- func (mgr *Manager) GetHealthiestMember(*dcs.Cluster, string) *dcs.Member
- func (mgr *Manager) GetMasterStatus(context.Context, *sql.DB) (RowMap, error)
- func (mgr *Manager) GetMemberAddrs(_ context.Context, cluster *dcs.Cluster) []string
- func (mgr *Manager) GetMemberConnection(cluster *dcs.Cluster, member *dcs.Member) (db *sql.DB, err error)
- func (mgr *Manager) GetOpTimestamp(ctx context.Context, db *sql.DB) (int64, error)
- func (mgr *Manager) GetReplicaRole(ctx context.Context, cluster *dcs.Cluster) (string, error)
- func (mgr *Manager) GetSlaveStatus(context.Context, *sql.DB) (RowMap, error)
- func (mgr *Manager) GrantUserRole(ctx context.Context, userName, roleName string) error
- func (mgr *Manager) HasOtherHealthyMembers(ctx context.Context, cluster *dcs.Cluster, leader string) []*dcs.Member
- func (mgr *Manager) InitializeCluster(context.Context, *dcs.Cluster) error
- func (mgr *Manager) InitiateCluster(*dcs.Cluster) error
- func (mgr *Manager) IsClusterInitialized(ctx context.Context, _ *dcs.Cluster) (bool, error)
- func (mgr *Manager) IsCurrentMemberHealthy(ctx context.Context, cluster *dcs.Cluster) bool
- func (mgr *Manager) IsCurrentMemberInCluster(context.Context, *dcs.Cluster) bool
- func (mgr *Manager) IsDBStartupReady() bool
- func (mgr *Manager) IsLeader(ctx context.Context, _ *dcs.Cluster) (bool, error)
- func (mgr *Manager) IsLeaderMember(ctx context.Context, cluster *dcs.Cluster, member *dcs.Member) (bool, error)
- func (mgr *Manager) IsMemberHealthy(ctx context.Context, cluster *dcs.Cluster, member *dcs.Member) bool
- func (mgr *Manager) IsMemberLagging(ctx context.Context, cluster *dcs.Cluster, member *dcs.Member) (bool, int64)
- func (mgr *Manager) IsReadonly(ctx context.Context, cluster *dcs.Cluster, member *dcs.Member) (bool, error)
- func (mgr *Manager) IsRootCreated(context.Context) (bool, error)
- func (mgr *Manager) IsRunning() bool
- func (mgr *Manager) JoinCurrentMemberToCluster(context.Context, *dcs.Cluster) error
- func (mgr *Manager) LeaveMemberFromCluster(context.Context, *dcs.Cluster, string) error
- func (mgr *Manager) ListSystemAccounts(ctx context.Context) ([]models.UserInfo, error)
- func (mgr *Manager) ListUsers(ctx context.Context) ([]models.UserInfo, error)
- func (mgr *Manager) Lock(context.Context, string) error
- func (mgr *Manager) Promote(ctx context.Context, cluster *dcs.Cluster) error
- func (mgr *Manager) Query(ctx context.Context, sql string) ([]byte, error)
- func (mgr *Manager) ReadCheck(ctx context.Context, db *sql.DB) bool
- func (mgr *Manager) Recover(context.Context) error
- func (mgr *Manager) RevokeUserRole(ctx context.Context, userName, roleName string) error
- func (mgr *Manager) ShutDownWithWait()
- func (mgr *Manager) Unlock(context.Context) error
- func (mgr *Manager) WriteCheck(ctx context.Context, db *sql.DB) bool
- type NamedResultData
- type ResultData
- type RowData
- type RowMap
- func (rm *RowMap) GetBool(key string) bool
- func (rm *RowMap) GetInt(key string) int
- func (rm *RowMap) GetInt64(key string) int64
- func (rm *RowMap) GetIntD(key string, def int) int
- func (rm *RowMap) GetNullInt64(key string) sql.NullInt64
- func (rm *RowMap) GetString(key string) string
- func (rm *RowMap) GetStringD(key string, def string) string
- func (rm *RowMap) GetTime(key string) time.Time
- func (rm *RowMap) GetUint(key string) uint
- func (rm *RowMap) GetUint64(key string) uint64
- func (rm *RowMap) GetUint64D(key string, def uint64) uint64
- func (rm *RowMap) GetUintD(key string, def uint) uint
Constants ¶
const DateTimeFormat = "2006-01-02 15:04:05.999999"
Variables ¶
var EmptyResultData = ResultData{}
Functions ¶
func GetDBConnection ¶
GetDBConnection returns a DB Connection based on dsn.
func NewCommands ¶
func NewCommands() engines.ClusterCommands
func NewManager ¶
func NewManager(properties engines.Properties) (engines.DBManager, error)
func QueryRowsMap ¶
func QueryRowsMap(db *sql.DB, query string, onRow func(RowMap) error, args ...interface{}) (err error)
QueryRowsMap is a convenience function allowing querying a result set while providing a callback function activated per read row.
func ScanRowsToArrays ¶
ScanRowsToArrays is a convenience function, typically not called directly, which maps rows already read from the database into arrays of NullString
Types ¶
type CellData ¶
type CellData sql.NullString
CellData is the result of a single (atomic) column in a single row
func (*CellData) MarshalJSON ¶
func (*CellData) NullString ¶
func (cd *CellData) NullString() *sql.NullString
func (*CellData) UnmarshalJSON ¶
UnmarshalJSON reds this object from JSON
type Commands ¶
type Commands struct {
// contains filtered or unexported fields
}
func (*Commands) ConnectCommand ¶
func (*Commands) ConnectExample ¶
func (m *Commands) ConnectExample(info *engines.ConnectionInfo, client string) string
type Config ¶
type Config struct { Username string // contains filtered or unexported fields }
func (*Config) GetDBConnWithAddr ¶
type GTIDItem ¶
GTIDItem represents an item in a set of GTID ranges, for example, the item: "ee194423-3040-11ee-9393-eab5dfc9b22a:1-5:8-10"
func NewGTIDItem ¶
type GTIDSet ¶
type GTIDSet struct {
Items []*GTIDItem
}
func NewOracleGtidSet ¶
func (*GTIDSet) RemoveUUID ¶
func (*GTIDSet) RetainUUID ¶
func (*GTIDSet) RetainUUIDs ¶
func (*GTIDSet) SharedUUIDs ¶
type Manager ¶
type Manager struct { engines.DBManagerBase DB *sql.DB // contains filtered or unexported fields }
func (*Manager) CreateUser ¶
func (*Manager) DeleteUser ¶
func (*Manager) DescribeUser ¶
func (*Manager) EnableSemiSyncIfNeed ¶
func (*Manager) EnsureServerID ¶
func (*Manager) GetDBState ¶
func (*Manager) GetGlobalState ¶
func (*Manager) GetHealthiestMember ¶
func (*Manager) GetMasterStatus ¶
func (*Manager) GetMemberAddrs ¶
func (*Manager) GetMemberConnection ¶
func (*Manager) GetOpTimestamp ¶
func (*Manager) GetReplicaRole ¶
func (*Manager) GetSlaveStatus ¶
func (*Manager) GrantUserRole ¶
func (*Manager) HasOtherHealthyMembers ¶
func (mgr *Manager) HasOtherHealthyMembers(ctx context.Context, cluster *dcs.Cluster, leader string) []*dcs.Member
HasOtherHealthyMembers checks if there are any healthy members, excluding the leader
func (*Manager) InitializeCluster ¶
func (*Manager) IsClusterInitialized ¶
IsClusterInitialized is a method to check if cluster is initialized or not
func (*Manager) IsCurrentMemberHealthy ¶
func (*Manager) IsCurrentMemberInCluster ¶
func (*Manager) IsDBStartupReady ¶
func (*Manager) IsLeaderMember ¶
func (*Manager) IsMemberHealthy ¶
func (*Manager) IsMemberLagging ¶
func (*Manager) IsReadonly ¶
func (*Manager) JoinCurrentMemberToCluster ¶
func (*Manager) LeaveMemberFromCluster ¶
func (*Manager) ListSystemAccounts ¶
func (*Manager) RevokeUserRole ¶
func (*Manager) ShutDownWithWait ¶
func (mgr *Manager) ShutDownWithWait()
type NamedResultData ¶
type NamedResultData struct { Columns []string Data ResultData }
type RowData ¶
type RowData []CellData
RowData is the result of a single row, in positioned array format
func (*RowData) MarshalJSON ¶
MarshalJSON will marshal this map as JSON
type RowMap ¶
RowMap represents one row in a result set. Its objective is to allow for easy, typed getters by column name.
func (*RowMap) GetStringD ¶
GetStringD returns a string from the map, or a default value if the key does not exist