Documentation ¶
Index ¶
- Constants
- Variables
- 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 Config
- type Manager
- func (mgr *Manager) AddCurrentMemberToCluster(cluster *dcs.Cluster) error
- func (mgr *Manager) DeleteMemberFromCluster(cluster *dcs.Cluster, host string) error
- func (mgr *Manager) Demote() error
- func (mgr *Manager) EnsureServerID(ctx context.Context) (bool, error)
- func (mgr *Manager) Follow(cluster *dcs.Cluster) error
- func (mgr *Manager) GetHealthiestMember(cluster *dcs.Cluster, candidate string) *dcs.Member
- func (mgr *Manager) GetLeaderClient(ctx context.Context, cluster *dcs.Cluster) (*sql.DB, error)
- func (mgr *Manager) GetMemberAddrs(cluster *dcs.Cluster) []string
- func (mgr *Manager) HasOtherHealthyLeader(cluster *dcs.Cluster) *dcs.Member
- func (mgr *Manager) HasOtherHealthyMembers(cluster *dcs.Cluster, leader string) []*dcs.Member
- func (mgr *Manager) Initialize()
- func (mgr *Manager) InitiateCluster(cluster *dcs.Cluster) error
- func (mgr *Manager) IsClusterHealthy(ctx context.Context, cluster *dcs.Cluster) bool
- func (mgr *Manager) IsClusterInitialized(ctx context.Context, cluster *dcs.Cluster) (bool, error)
- func (mgr *Manager) IsCurrentMemberHealthy() bool
- func (mgr *Manager) IsCurrentMemberInCluster(cluster *dcs.Cluster) bool
- func (mgr *Manager) IsDBStartupReady() bool
- func (mgr *Manager) IsLeader(ctx context.Context, cluster *dcs.Cluster) (bool, error)
- func (mgr *Manager) IsLeaderMember(ctx context.Context, cluster *dcs.Cluster, member *dcs.Member) (bool, error)
- func (mgr *Manager) IsMemberHealthy(cluster *dcs.Cluster, member *dcs.Member) bool
- func (mgr *Manager) IsReadonly(ctx context.Context, cluster *dcs.Cluster, member *dcs.Member) (bool, error)
- func (mgr *Manager) IsRunning() bool
- func (mgr *Manager) Premote() error
- func (mgr *Manager) Recover()
- 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 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 poviding 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 databse 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 Config ¶
type Config struct {
// contains filtered or unexported fields
}
func (*Config) GetDBConnWithAddr ¶
type Manager ¶
type Manager struct { component.DBManagerBase DB *sql.DB // contains filtered or unexported fields }
var Mgr *Manager
func (*Manager) AddCurrentMemberToCluster ¶
func (*Manager) DeleteMemberFromCluster ¶
func (*Manager) EnsureServerID ¶
func (*Manager) GetHealthiestMember ¶
func (*Manager) GetLeaderClient ¶
func (*Manager) HasOtherHealthyLeader ¶
func (*Manager) HasOtherHealthyMembers ¶
HasOtherHealthyMembers checks if there are any healthy members, excluding the leader
func (*Manager) Initialize ¶
func (mgr *Manager) Initialize()
func (*Manager) IsClusterHealthy ¶
func (*Manager) IsClusterInitialized ¶
IsClusterInitialized is a method to check if cluster is initailized or not
func (*Manager) IsCurrentMemberHealthy ¶
func (*Manager) IsCurrentMemberInCluster ¶
func (*Manager) IsDBStartupReady ¶
func (*Manager) IsLeaderMember ¶
func (*Manager) IsMemberHealthy ¶
func (*Manager) IsReadonly ¶
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