Fix: Each updateFilter must have corresponding bindPlan#373
Open
pbberlin wants to merge 1 commit intogo-gorp:mainfrom
Open
Fix: Each updateFilter must have corresponding bindPlan#373pbberlin wants to merge 1 commit intogo-gorp:mainfrom
pbberlin wants to merge 1 commit intogo-gorp:mainfrom
Conversation
nelsam
reviewed
Jul 30, 2018
| colFilter = acceptAllFilter | ||
| } else { | ||
| t.updatePlan = bindPlan{} // a new bindPlan everytime; since we cannot compare colFilter funcs | ||
| t.colFilter = colFilter |
Member
There was a problem hiding this comment.
I'm a firm believer in avoiding else at nearly all costs. Branches are really harsh on the mental stack when reading code, and else statements are the worst (especially in go, where they can carry extra context). Can we try something more like:
if t.colFilter != nil || colFilter != nil {
t.updatePlan = bindPlan{}
}
if colFilter == nil {
colFilter = acceptAllFilter
}
t.colFilter = colFilter
nelsam
reviewed
Jul 30, 2018
| gotype reflect.Type | ||
| Columns []*ColumnMap | ||
| keys []*ColumnMap | ||
| keys []*ColumnMap // primary key column; can be autoIncrement |
Member
There was a problem hiding this comment.
I don't think this comment is related to this PR.
nelsam
reviewed
Jul 30, 2018
| case "autoincrement": | ||
| isAuto = true | ||
| case "notnull": | ||
| case "notnull", "not null": |
Member
There was a problem hiding this comment.
This change is not related to this PR, and it also doesn't have any tests.
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.
Current behavior:
I set an updateFilter - then I update => works.
Now I remove the updateFilter - then I update => broken - still only the columns from previous updateFilter are updated. Reason: the bindPlan does not reflect the removal of the update filter.
I added tests, to demonstrate the fixed behavior.
Kind regards
Peter