Restructure queries config into include/exclude lists#51
Merged
Conversation
85440c8 to
744483a
Compare
options.queries changes from a flat list of opt-in query names to an object with include/exclude lists, mirroring options.tables. Generated set is (defaults ∪ include) − exclude: - include adds opt-in queries on top of the default set (it does not replace it), so adding one query never drops the defaults. - exclude removes queries from what would otherwise be generated, including defaults (e.g. DeleteUser), and always takes precedence over include. - an empty include + empty exclude yields the default query set (unchanged). The template now gates the previously-unconditional Insert family and base List query through a unified should_generate predicate so they honor exclude too. The legacy flat list form (queries: [..]) no longer parses; move those entries under queries.include.
744483a to
f8de261
Compare
Contributor
Code Metrics Report
Code coverage of files in pull request scope (81.9%)
Reported by octocov |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
options.queriesfrom a flat list of opt-in query names into an object withinclude/excludelists, mirroring theoptions.tablesshape from #49.Semantics (additive)
Generated set = (defaults ∪ include) − exclude.
includeexcludeincludeadds opt-in queries on top of the default set (it does not replace it), so adding one query never drops the defaults.excluderemoves queries — including defaults likeDeleteUser— and always takes precedence.New capability
queries.excludelets you drop an unwanted default query for the first time (e.g.DeleteUser).Implementation notes
CodegenOptions.Queriesis nowQueryOptions{Include, Exclude};GetQueriesSet→GetQueryIncludeSet/GetQueryExcludeSet.Insert/ExecInsert/BatchInsert/BatchExecInsertand baseListare now gated as defaults, so they honorexcludetoo. All gating funnels through one predicate:should_generate $ $query_name $isDefault=(isDefault || included) && !excluded.Migration
Move existing
queries: [...]entries underqueries.include.Validation
go build ./...,go test ./...,nix build .#defaultinclude: [CopyUsers]+exclude: [DeleteUser]addsCopyUsersand drops onlyDeleteUserwhile keeping every other default.