24 lines
309 B
Go
24 lines
309 B
Go
|
package bundb
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
"github.com/uptrace/bun"
|
||
|
)
|
||
|
|
||
|
type Checker struct {
|
||
|
db *bun.DB
|
||
|
}
|
||
|
|
||
|
func NewChecker(db *bun.DB) *Checker {
|
||
|
return &Checker{db: db}
|
||
|
}
|
||
|
|
||
|
func (c *Checker) Name() string {
|
||
|
return "db:ping"
|
||
|
}
|
||
|
|
||
|
func (c *Checker) Check(ctx context.Context) error {
|
||
|
return c.db.PingContext(ctx)
|
||
|
}
|