aboutsummaryrefslogtreecommitdiff
path: root/db.go
blob: 830bc0cba97092af8f55eca637849cb0d4a62c7d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package main

import (
	"context"
	"errors"

	"github.com/jackc/pgx/v5/pgxpool"
)

var db *pgxpool.Pool

func setup_database() error {
	var err error
	if config.Db.Type != "postgres" {
		return errors.New("At the moment, the only supported database type is postgres")
	}
	db, err = pgxpool.New(context.Background(), config.Db.Conn)
	return err
}