Add ncruces/go-sqlite3 support #431
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As discussed on Reddit, and as a first approximation, this is what should be required to support my driver.
What's the simplest, but still realistic, way to test this? I ask because my driver has a few peculiarities, and I'd like to be sure I'm not messing anything up.
The one that matters the most here, is that the driver is split into 3 packages:
github.com/ncruces/go-sqlite3
wraps the C SQLite API - this is needed for thesqlite3.Error
typegithub.com/ncruces/go-sqlite3/driver
registers thedatabase/sql
drivergithub.com/ncruces/go-sqlite3/embed
embeds/links SQLite into your applicationYou don't need to import
driver
orembed
everywhere in your project, and in fact I'd argue if you're creating (or in this case generating) a library you shouldn't import them at all.The reason is that, e.g., for the
embed
package in particular, you may decide to embed/link a modified SQLite build. I have an alternative package that includes "experimental" SQLite features, Alex publishes another one that supports vector search, etc.It's up to the final end user which build of SQLite they want to link with, and they can decide by importing the correct package in the
main.go
of their application (or some other place where it makes sense).I'm sorry if this over complicates things.