Skip to content

Conversation

pbberlin
Copy link

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

colFilter = acceptAllFilter
} else {
t.updatePlan = bindPlan{} // a new bindPlan everytime; since we cannot compare colFilter funcs
t.colFilter = colFilter
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

gotype reflect.Type
Columns []*ColumnMap
keys []*ColumnMap
keys []*ColumnMap // primary key column; can be autoIncrement
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this comment is related to this PR.

case "autoincrement":
isAuto = true
case "notnull":
case "notnull", "not null":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is not related to this PR, and it also doesn't have any tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants