1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-23 07:20:55 +00:00
Beego/toolbox/healthcheck.go
2014-01-29 19:12:00 +08:00

32 lines
583 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{})
// health checker map
var AdminCheckList map[string]HealthChecker
// health checker interface
type HealthChecker interface {
Check() error
}
// add health checker with name string
func AddHealthCheck(name string, hc HealthChecker) {
AdminCheckList[name] = hc
}
func init() {
AdminCheckList = make(map[string]HealthChecker)
}