Skip to content

Commit

Permalink
Update postgres.tmpl (Melkeydev#115)
Browse files Browse the repository at this point in the history
Added PGX as Postgres Driver since PG is unmaintained
  • Loading branch information
jpx40 authored Nov 20, 2023
1 parent 963d0f3 commit d93c556
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/template/dbdriver/files/service/postgres.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"os"
"time"

_ "github.com/lib/pq"
_ "github.com/jackc/pgx/v5/stdlib"
_ "github.com/joho/godotenv/autoload"
)

Expand All @@ -30,7 +30,7 @@ var (

func New() Service {
connStr := fmt.Sprintf("postgres:https://%s:%s@%s:%s/%s?sslmode=disable", username, password, host, port, database)
db, err := sql.Open("postgres", connStr)
db, err := sql.Open("pgx", connStr)
if err != nil {
log.Fatal(err)
}
Expand All @@ -50,4 +50,4 @@ func (s *service) Health() map[string]string {
return map[string]string{
"message": "It's healthy",
}
}
}

0 comments on commit d93c556

Please sign in to comment.