Skip to content
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

Driver does not implement driver.DriverContext interface #236

Open
nvx opened this issue Feb 17, 2025 · 0 comments
Open

Driver does not implement driver.DriverContext interface #236

nvx opened this issue Feb 17, 2025 · 0 comments

Comments

@nvx
Copy link

nvx commented Feb 17, 2025

As per the docs at https://pkg.go.dev/database/sql/driver "Drivers should implement Connector and DriverContext interfaces."

At a quick glance you'd think this driver implements driver.DriverContext due to this method:

func (d *Driver) OpenConnector(dsn string) (*Connector, error) {

But on closer inspection the return type of this func is a *go-mssqldb.Connector not a driver.Connector interface meaning it does not actually implement the interface.

Changing the return type would fix this, but it would mean anyone relying on the concrete type being returned would need to be updated. Thankfully the failure mode for this is a compilation failure so should be fairly easy to detect and fix either by adding an appropriate cast or NewConnector could be used instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant