Add GetDB to mysql.GetDB
This commit is contained in:
parent
338a439c91
commit
bb4a0be4c6
@ -33,6 +33,15 @@ func (this *ReplicationLagResult) HasLag() bool {
|
||||
return this.Lag > 0
|
||||
}
|
||||
|
||||
func GetDB(mysql_uri string) (*gosql.DB, error) {
|
||||
db, err := gosql.Open("mysql", mysql_uri)
|
||||
if err == nil {
|
||||
return db, nil
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// GetReplicationLag returns replication lag for a given connection config; either by explicit query
|
||||
// or via SHOW SLAVE STATUS
|
||||
func GetReplicationLag(informationSchemaDb *gosql.DB, connectionConfig *ConnectionConfig) (replicationLag time.Duration, err error) {
|
||||
|
Loading…
Reference in New Issue
Block a user