mirror of
https://github.com/astaxie/beego.git
synced 2024-12-23 12:30:49 +00:00
29 lines
494 B
Go
29 lines
494 B
Go
package toolbox
|
|
|
|
//type DatabaseCheck struct {
|
|
//}
|
|
|
|
//func (dc *DatabaseCheck) Check() error {
|
|
// if dc.isConnected() {
|
|
// return nil
|
|
// } else {
|
|
// return errors.New("can't connect database")
|
|
// }
|
|
//}
|
|
|
|
//AddHealthCheck("database",&DatabaseCheck{})
|
|
|
|
var AdminCheckList map[string]HealthChecker
|
|
|
|
type HealthChecker interface {
|
|
Check() error
|
|
}
|
|
|
|
func AddHealthCheck(name string, hc HealthChecker) {
|
|
AdminCheckList[name] = hc
|
|
}
|
|
|
|
func init() {
|
|
AdminCheckList = make(map[string]HealthChecker)
|
|
}
|