entc/gen: delete removal edges from mutation (#1654)

* Remove Edge IDs from internal Mutation state

* Update template gen

* Update integration tests

* Update examples
This commit is contained in:
Ivan Vanderbyl
2021-06-24 18:26:22 +10:00
committed by GitHub
parent a29784eb69
commit 4ba56ea901
24 changed files with 87 additions and 2 deletions

View File

@@ -601,6 +601,7 @@ func (m *GroupMutation) RemoveUserIDs(ids ...int) {
m.removedusers = make(map[int]struct{})
}
for i := range ids {
delete(m.users, ids[i])
m.removedusers[ids[i]] = struct{}{}
}
}
@@ -1041,6 +1042,7 @@ func (m *UserMutation) RemoveCarIDs(ids ...int) {
m.removedcars = make(map[int]struct{})
}
for i := range ids {
delete(m.cars, ids[i])
m.removedcars[ids[i]] = struct{}{}
}
}
@@ -1094,6 +1096,7 @@ func (m *UserMutation) RemoveGroupIDs(ids ...int) {
m.removedgroups = make(map[int]struct{})
}
for i := range ids {
delete(m.groups, ids[i])
m.removedgroups[ids[i]] = struct{}{}
}
}