Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Define a simple sql db status check using the Go Health Checks Framework
// Create a db object by opening the connection
db, err := sql.Open("mysql", "user:password@tcp(")
if err != nil {
// Define a StatusEndpoint at '/status/db' for a database dependency
dbs := healthchecks.StatusEndpoint{
Name: "The DB",
Slug: "db",
Type: "internal",
IsTraversable: false,
StatusCheck: sqlsc.SQLDBStatusChecker{
DB: db
TraverseCheck: nil,
// Add all your StatusEndpoints to a slice for your service.
// This will be used to initialize the framework in the next step.
statusEndpoints := []healthchecks.StatusEndpoint{ dbs }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.