health

package
v1.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL