2023-07-16 05:29:40 +00:00

21 lines
335 B
Go

package main
import (
"context"
"os"
"github.com/jackc/pgx/v4/pgxpool"
)
var pool *pgxpool.Pool
func getDbPool() *pgxpool.Pool {
// Setup Database
dburl := os.Getenv("DATABASE_URL")
pool, err := pgxpool.Connect(context.Background(), dburl)
if err != nil {
logFatal("Unable to connect to database:", err)
}
return pool
}