2021-04-08 11:32:08 +00:00
|
|
|
|
package resources
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"database/sql"
|
|
|
|
|
"log"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func NoContext(ctx context.Context, db *sql.DB) {
|
|
|
|
|
// У Conn() нет версии без контекста
|
|
|
|
|
c, err := db.Conn(ctx)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
defer c.Close()
|
|
|
|
|
|
|
|
|
|
// Потенциально вечный Ping
|
2023-02-22 13:02:34 +00:00
|
|
|
|
_ = db.Ping()
|
2021-04-08 11:32:08 +00:00
|
|
|
|
}
|