Skip to content

add function to get the driver name #1591

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ func init() {
}
}

// DriverName return driver name
func DriverName() string {
return driverName
}

// NewConnector returns new driver.Connector.
func NewConnector(cfg *Config) (driver.Connector, error) {
cfg = cfg.Clone()
Expand Down
7 changes: 7 additions & 0 deletions driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3353,6 +3353,13 @@ func configForTests(t *testing.T) *Config {
return mycnf
}

func TestName(t *testing.T) {
dn := DriverName()
if dn != driverName {
t.Errorf("driver name is incorrect, got: %s", dn)
}
}

func TestNewConnector(t *testing.T) {
mycnf := configForTests(t)
conn, err := NewConnector(mycnf)
Expand Down