forked from beego/beego
-
Notifications
You must be signed in to change notification settings - Fork 0
/
healthcheck.go
37 lines (29 loc) · 893 Bytes
/
healthcheck.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Beego (http://beego.me/)
// @description beego is an open-source, high-performance web framework for the Go programming language.
// @link http://github.com/astaxie/beego for the canonical source repository
// @license http://github.com/astaxie/beego/blob/master/LICENSE
// @authors astaxie
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)
}