- Fix error return value checks (errcheck) - Fix unused parameters by using underscore prefix - Add missing package comments to all packages - Fix context key type issue in middleware (use typed contextKey) - Replace deprecated trace.NewNoopTracerProvider with noop.NewTracerProvider - Fix embedded field selector in database client - Remove trailing whitespace - Remove revive linter (as requested) to avoid stuttering warnings for public API interfaces All linting and formatting checks now pass.
27 lines
663 B
Go
27 lines
663 B
Go
// Package health provides health check implementations for various components.
|
|
package health
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.dcentral.systems/toolz/goplt/internal/infra/database"
|
|
"git.dcentral.systems/toolz/goplt/pkg/health"
|
|
)
|
|
|
|
// DatabaseChecker implements health checks for the database.
|
|
type DatabaseChecker struct {
|
|
client *database.Client
|
|
}
|
|
|
|
// NewDatabaseChecker creates a new database health checker.
|
|
func NewDatabaseChecker(client *database.Client) health.HealthChecker {
|
|
return &DatabaseChecker{
|
|
client: client,
|
|
}
|
|
}
|
|
|
|
// Check performs a database health check.
|
|
func (d *DatabaseChecker) Check(ctx context.Context) error {
|
|
return d.client.Ping(ctx)
|
|
}
|