Skip to content

Commit b8f5ca0

Browse files
committed
Add function to get the driver name
1 parent af8d793 commit b8f5ca0

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

driver.go

+5
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ func init() {
9797
}
9898
}
9999

100+
// DriverName return driver name
101+
func DriverName() string {
102+
return driverName
103+
}
104+
100105
// NewConnector returns new driver.Connector.
101106
func NewConnector(cfg *Config) (driver.Connector, error) {
102107
cfg = cfg.Clone()

driver_test.go

+7
Original file line numberDiff line numberDiff line change
@@ -3353,6 +3353,13 @@ func configForTests(t *testing.T) *Config {
33533353
return mycnf
33543354
}
33553355

3356+
func TestName(t *testing.T) {
3357+
dn := DriverName()
3358+
if dn != driverName {
3359+
t.Errorf("driver name is incorrect, got: %s", dn)
3360+
}
3361+
}
3362+
33563363
func TestNewConnector(t *testing.T) {
33573364
mycnf := configForTests(t)
33583365
conn, err := NewConnector(mycnf)

0 commit comments

Comments
 (0)