From 74ea479b0ca6b4fa850ac4ebf0ed36cd481c8d6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?PLATEL=20K=C3=A9vin?= Date: Tue, 5 Feb 2019 11:01:22 +0100 Subject: [PATCH] Close issue #481 : Give access to the registered driver instance Some library use a driver to wrap its behavior and give additional functionality, as the datadog tracing library ("gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql") This commit aims to give access to this instance which can't be correctly initialized to due private fields without default values (the configuration map inside the driver) --- stdlib/sql.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/stdlib/sql.go b/stdlib/sql.go index b83e527b..ec5933f3 100644 --- a/stdlib/sql.go +++ b/stdlib/sql.go @@ -126,6 +126,12 @@ var ( fakeTxConns map[*pgx.Conn]*sql.Tx ) +// GetDefaultDriver return the driver initialize in the init function +// and used when register pgx driver +func GetDefaultDriver() *Driver { + return pgxDriver +} + type Driver struct { configMutex sync.Mutex configCount int64