-
-
Notifications
You must be signed in to change notification settings - Fork 23
export the database/sql driver implementation type #79
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
export the database/sql driver implementation type #79
Conversation
I'm not against this, but it'll take some convincing. The driver was initially a singleton, now it's a global variable. You're assuming it is set on an init? |
I think I understand why you might want to export the current singleton: so it can be wrapped. I can also understand the frustration with me taking over the I don't understand why the driver would need to stop being a singleton and become a global variable. |
Okay so thoughts for designing it were as follows:
i'm not hugely tied to that second point so if you'd prefer i can remove the exported global variable! |
Yes, I would really rather not export the global variable. I can explain why I did it like this (and why I disagree with modernc using So, in a sense, I want to panic if people try to use mattn and my driver in the same process (ideally I'd panic for modernc too). The counter argument is that all 3 drivers (mattn, modernc, ncruces) have different DSNs, so they should have different registration names. Ideally, none of the drivers would "auto-register," but that's the Go convention, so that's out. The only solution I see, is what I did with package Sorry, this is the kind of stuff that I'd really like to get right at once, but that only happens when someone shows up with a weird requirement. |
no worries that makes sense! will make the change 👍 |
@ncruces have removed the global variable, and renamed the driver implementation to instead be |
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.
Thanks! I'll fix some doc nits in a followup; hope you don't mind.
Just a heads up: because I have encryption in the pipeline, it will take me some time to tag a release of this. I'm planing to make some small backwards incompatible changes to the VFS API in #82, and I really want to get them right. I also want to make sure encryption is works the way it should, as that's a sensitive matter. If you're not creating a VFS (and I guess no one is, yet), you can use main for a while, then update. |
This allows for further user customization of the database/sql sqlite driver, for example in GoToSocial where we would require translating any returned errors. This does so while not breaking the current API.