2014-04-12 05:18:18 +00:00
|
|
|
// Beego (http://beego.me/)
|
2014-06-25 02:39:37 +00:00
|
|
|
|
2014-04-12 05:18:18 +00:00
|
|
|
// @description beego is an open-source, high-performance web framework for the Go programming language.
|
2014-06-25 02:39:37 +00:00
|
|
|
|
2014-04-12 05:18:18 +00:00
|
|
|
// @link http://github.com/astaxie/beego for the canonical source repository
|
2014-06-25 02:39:37 +00:00
|
|
|
|
2014-04-12 05:18:18 +00:00
|
|
|
// @license http://github.com/astaxie/beego/blob/master/LICENSE
|
2014-06-25 02:39:37 +00:00
|
|
|
|
2014-04-12 05:18:18 +00:00
|
|
|
// @authors astaxie
|
|
|
|
|
2013-11-20 13:17:49 +00:00
|
|
|
package toolbox
|
2013-11-17 15:10:21 +00:00
|
|
|
|
|
|
|
//type DatabaseCheck struct {
|
|
|
|
//}
|
|
|
|
|
|
|
|
//func (dc *DatabaseCheck) Check() error {
|
|
|
|
// if dc.isConnected() {
|
|
|
|
// return nil
|
|
|
|
// } else {
|
|
|
|
// return errors.New("can't connect database")
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
|
|
|
//AddHealthCheck("database",&DatabaseCheck{})
|
|
|
|
|
2014-01-29 11:12:00 +00:00
|
|
|
// health checker map
|
2013-11-17 15:10:21 +00:00
|
|
|
var AdminCheckList map[string]HealthChecker
|
|
|
|
|
2014-01-29 11:12:00 +00:00
|
|
|
// health checker interface
|
2013-11-17 15:10:21 +00:00
|
|
|
type HealthChecker interface {
|
|
|
|
Check() error
|
|
|
|
}
|
|
|
|
|
2014-01-29 11:12:00 +00:00
|
|
|
// add health checker with name string
|
2013-11-17 15:10:21 +00:00
|
|
|
func AddHealthCheck(name string, hc HealthChecker) {
|
|
|
|
AdminCheckList[name] = hc
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
AdminCheckList = make(map[string]HealthChecker)
|
|
|
|
}
|