-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[extension/storage/dbstorage] Create component #7061
Conversation
4516e71
to
95ca006
Compare
Hey @atoulme , we are in the process of introducing new guidelines for adding new component. Please check the this issue and add the checklist to this PR or create an issue. You can add me as sponsor. |
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.
One nit. Otherwise LGTM
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.
LGTM, the clarification about how to extend a distribution to use a new driver can be part of a follow-up PR.
|
||
`driver`: the name of the database driver to use. By default, the storage client supports "sqlite3" and "pgx". | ||
|
||
Implementors can add additional driver support by importing SQL drivers into the program. |
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.
How would it work concretely? I can't think of a clean way of doing that using the builder, and not using it means having to manage more than just an import statement. But perhaps I'm missing something?
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.
From what I get, folks building their own distros can add imports of additional drivers and import them using the underscore import, just like this SO thread explains: https://stackoverflow.com/questions/21220077/what-does-an-underscore-in-front-of-an-import-statement-mean
As long the init() function of those side-effect imports registers the driver, it should be fine.
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.
Right, but this import has to be in a source file that is included in the distribution. So, either a downstream distribution creates a whole new extension just for the import statement, or they have to maintain the source code for their distribution (main.go essentially) because of that import line. Or perhaps there's a better solution I'm not seeing?
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.
Yes, I guess they'd add that to their main.go
? I just don't know any better, I'm sorry.
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.
Right -- they might just not have a main.go yet. I'm OK with approving and merging this as is, but would still be good to have an end-to-end example for users interested in extending with their SQL drivers.
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.
Would you please file an issue, sorry - especially interested in where such a sample would live?
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.
Done: #7157
Description:
Add an experimental dbstorage extension, similar to filestorage.
Supports Postgres and sqlite.
Sponsor: @dmitryax
Testing:
Unit tests.
Documentation:
README added
Fixes #7114