shad-go/lectures/07-sql/resources/conn.go

17 lines
205 B
Go
Raw Normal View History

2020-04-09 13:00:41 +00:00
package resources
import (
"context"
"database/sql"
"log"
)
func ConnExhaust(ctx context.Context, db *sql.DB) {
c, err := db.Conn(ctx)
if err != nil {
log.Fatal(err)
}
_ = c.PingContext(ctx)
}