mirror of
https://github.com/Drop-OSS/drop.git
synced 2026-06-22 20:31:31 +10:00
20 lines
315 B
Go
20 lines
315 B
Go
package core
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/jackc/pgx/v5"
|
|
)
|
|
|
|
func connect() {
|
|
conn, err := pgx.Connect(context.Background(), os.Getenv("DATABASE_URL"))
|
|
if err != nil {
|
|
fmt.Fprintf(os.Stderr, "Unable to connect to database: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
defer conn.Close(context.Background())
|
|
|
|
}
|