package health

import (
	"context"

	"github.com/go-pg/pg/v10/orm"
)

type CheckDBInterface interface {
	Ping(ctx context.Context) error
	Exec(query interface{}, params ...interface{}) (res orm.Result, err error)
}

func NewPostgresCheck(conn CheckDBInterface) CheckFunc {
	return func(ctx context.Context) error {
		err := conn.Ping(ctx)
		return err
	}
}
