feat: use pgxpool instead of row connection
This commit is contained in:
@ -10,7 +10,7 @@ import (
|
|||||||
"gitea.local/admin/hspguard/internal/repository"
|
"gitea.local/admin/hspguard/internal/repository"
|
||||||
"gitea.local/admin/hspguard/internal/storage"
|
"gitea.local/admin/hspguard/internal/storage"
|
||||||
"gitea.local/admin/hspguard/internal/user"
|
"gitea.local/admin/hspguard/internal/user"
|
||||||
"github.com/jackc/pgx/v5"
|
"github.com/jackc/pgx/v5/pgxpool"
|
||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ func main() {
|
|||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
conn, err := pgx.Connect(ctx, cfg.DatabaseURL)
|
conn, err := pgxpool.New(ctx, cfg.DatabaseURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalln("ERR: Failed to connect to db:", err)
|
log.Fatalln("ERR: Failed to connect to db:", err)
|
||||||
return
|
return
|
||||||
|
Reference in New Issue
Block a user