Simplify default database resolution in sqlite #2840
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.
This greatly simplifies how labels are resolved to connection creators in
factor-sqlite
.Instead of treating default labels as something special, the factor loses all knowledge of "default" labels. The label to connection creator mapping resides entirely inside of the factor's runtime config. The sqlite factor's runtime config was previously responsible for label to connection creator mapping for all database labels except for the default one. Now it handles the default one as well.
This removes the very notion of a "default" labeled database from the factor and instead moves that to a higher level concern (how the runtime configures each factors runtime config).
The tests for the sqlite factor have also be massively simplified as they no longer use the Spin CLI's notion of runtime config toml and instead just supply the runtime config directly. This makes it much easier to understand the what the test is actually testing.
If you're happy with this approach, I'd like to also do the same thing for key-value.