From 01ae1ec1910fd23411a111d2fcf9e8de14ae57f3 Mon Sep 17 00:00:00 2001 From: namhq1989 Date: Fri, 3 Feb 2023 20:58:03 +0700 Subject: [PATCH] add register driver --- postgresql.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/postgresql.go b/postgresql.go index e6c60bd..d6992f5 100644 --- a/postgresql.go +++ b/postgresql.go @@ -5,7 +5,7 @@ import ( "fmt" "time" - _ "github.com/jackc/pgx/v4/stdlib" + "github.com/jackc/pgx/v4/stdlib" "github.com/volatiletech/sqlboiler/v4/boil" "go.elastic.co/apm/module/apmsql/v2" _ "go.elastic.co/apm/module/apmsql/v2/pgxv4" @@ -32,6 +32,7 @@ func Connect(cfg Config, server string) (db *sql.DB, err error) { // connect if cfg.UseElasticAPM { + apmsql.Register("pgx", &stdlib.Driver{}) db, err = apmsql.Open("pgx", uri) } else { db, err = sql.Open("pgx", uri)