-
Notifications
You must be signed in to change notification settings - Fork 43
Add support for driver.ConnBeginTx #33
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
Conversation
Thank @asdine for doing this! |
Hey @gchaincl ! I added a test in here https://github.com/gchaincl/sqlhooks/blob/b4e3892e2d1633b251602e96e1be9f83c77a82b3/sqlhooks_interface_test.go#L66-L71, do you have something else in mind? |
I think you can add it here: https://github.com/gchaincl/sqlhooks/blob/b4e3892e2d1633b251602e96e1be9f83c77a82b3/sqlhooks_interface_test.go#L15 |
I wasn't aware that there were +50 drivers, that's crazy! |
It is possible by running a simple type assertion. The problem is that because we have different types implementing different interfaces, we cannot write a wrapper around them: https://play.golang.org/p/9fD_7jKW6gt One solution would be to add one additional struct for each implementation (one for *Execer, one for *ExecerQueryer, etc.), but that seems a bit overkill. Since very few active drivers don't support BeginTx (7), and since the type has been introduced since Go 1.8, I believe it would be easier to cut a new version with support for BeginTx and people using one of the 7 incompatible drivers could still use the current version of sqlhooks. |
That makes sense, which are the drivers that don't support BeginTx? |
They are listed here in this comment, you can click on the arrows on this comment it's a dropdown (not the best UI choice sorry) #33 (comment) |
ah sorry, my bad. |
95649df
to
e048d48
Compare
e048d48
to
4803583
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks LGTM to me
As this drops support for drivers that don't implement |
@gchaincl Good idea, should I create a v2 directory or should we simply merge this and create a v2.0.0 release? |
I'd just merge it and release v2.0.0 |
This PR adds support for drivers implementing the driver.ConnBeginTx interface.
Fixes #20
Closes #24