aboutsummaryrefslogtreecommitdiff
path: root/src/db/db.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/db/db.go')
-rw-r--r--src/db/db.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/db/db.go b/src/db/db.go
index 4daf561..2b72382 100644
--- a/src/db/db.go
+++ b/src/db/db.go
@@ -9,7 +9,11 @@ import (
"gitlab.com/alexkavon/newsstand/src/conf"
)
-func NewDb(config *conf.Conf) *pgxpool.Pool {
+type Database struct {
+ p *pgxpool.Pool
+}
+
+func NewDb(config *conf.Conf) *Database {
pool, err := pgxpool.New(context.Background(), config.Db.Url)
if err != nil {
log.Fatal(err)
@@ -22,5 +26,7 @@ func NewDb(config *conf.Conf) *pgxpool.Pool {
log.Fatal(err)
}
log.Println("Database connection pool created.", testquery)
- return pool
+ return &Database{
+ p: pool,
+ }
}