Skip to content

Commit

Permalink
Merge pull request #5 from nicholasxuu/fix-update-problem
Browse files Browse the repository at this point in the history
fix update problem
  • Loading branch information
HeathLee authored Sep 8, 2020
2 parents 1cd214f + 68f6ca7 commit cc2389d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dialect/sql/sqlgraph/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,9 @@ func (u *updater) nodes(ctx context.Context, tx dialect.ExecQuerier) (int, error
)
selector := u.builder.Select(u.Node.ID.Column).
From(u.builder.Table(u.Node.Table))

archivedWherePredicate := selector.Clone().P()

if pred := u.Predicate; pred != nil {
pred(selector)
}
Expand All @@ -670,7 +673,7 @@ func (u *updater) nodes(ctx context.Context, tx dialect.ExecQuerier) (int, error
if len(ids) == 0 {
return 0, nil
}
update := u.builder.Update(u.Node.Table).Where(selector.Clone().P())
update := u.builder.Update(u.Node.Table).Where(archivedWherePredicate)
if err := u.setTableColumns(update, addEdges, clearEdges); err != nil {
return 0, err
}
Expand Down

0 comments on commit cc2389d

Please sign in to comment.