From d93c556955d45e3fa40c34122f735400b6e2855c Mon Sep 17 00:00:00 2001 From: jpx40 <92295347+jpx40@users.noreply.github.com> Date: Mon, 20 Nov 2023 04:01:09 +0100 Subject: [PATCH] Update postgres.tmpl (#115) Added PGX as Postgres Driver since PG is unmaintained --- cmd/template/dbdriver/files/service/postgres.tmpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/template/dbdriver/files/service/postgres.tmpl b/cmd/template/dbdriver/files/service/postgres.tmpl index 9f953c98..e53d11c0 100644 --- a/cmd/template/dbdriver/files/service/postgres.tmpl +++ b/cmd/template/dbdriver/files/service/postgres.tmpl @@ -8,7 +8,7 @@ import ( "os" "time" - _ "github.com/lib/pq" + _ "github.com/jackc/pgx/v5/stdlib" _ "github.com/joho/godotenv/autoload" ) @@ -30,7 +30,7 @@ var ( func New() Service { connStr := fmt.Sprintf("postgres://%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) } @@ -50,4 +50,4 @@ func (s *service) Health() map[string]string { return map[string]string{ "message": "It's healthy", } -} \ No newline at end of file +}