Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Check ¶
type Check struct {
Status string `json:"status"`
Message string `json:"message,omitempty"`
Duration time.Duration `json:"duration"`
LastChecked time.Time `json:"last_checked"`
}
Check 单个检查项结果
type CheckResult ¶
type CheckResult struct {
Status string `json:"status"`
Timestamp time.Time `json:"timestamp"`
Checks map[string]Check `json:"checks"`
}
CheckResult 健康检查结果
type HealthChecker ¶
type HealthChecker struct {
// contains filtered or unexported fields
}
HealthChecker 健康检查器
func NewHealthChecker ¶
func NewHealthChecker(db *gorm.DB, redis *redis.Client) *HealthChecker
NewHealthChecker 创建健康检查器
func (*HealthChecker) CheckAll ¶
func (hc *HealthChecker) CheckAll(ctx context.Context) CheckResult
CheckAll 执行所有健康检查
func (*HealthChecker) CheckDatabase ¶
func (hc *HealthChecker) CheckDatabase(ctx context.Context) Check
CheckDatabase 单独检查数据库
func (*HealthChecker) CheckRedis ¶
func (hc *HealthChecker) CheckRedis(ctx context.Context) Check
CheckRedis 单独检查Redis
Click to show internal directories.
Click to hide internal directories.