entc/gen: mark field as cleared when clearing edges (#3651)

* mark field as cleared when clearing edges

* regenerate examples

* run go generate in entc/integration

* runn go mod tidy
This commit is contained in:
Yasser Sobhy
2023-07-21 16:17:39 +03:00
committed by GitHub
parent da2ff50ff8
commit 0b0cc90245
13 changed files with 51 additions and 2 deletions

View File

@@ -271,6 +271,7 @@ func (m *FileMutation) ResetParentID() {
// ClearParent clears the "parent" edge to the File entity.
func (m *FileMutation) ClearParent() {
m.clearedparent = true
m.clearedFields[file.FieldParentID] = struct{}{}
}
// ParentCleared reports if the "parent" edge to the File entity was cleared.

View File

@@ -606,6 +606,7 @@ func (m *PetMutation) ResetOwnerID() {
// ClearOwner clears the "owner" edge to the User entity.
func (m *PetMutation) ClearOwner() {
m.clearedowner = true
m.clearedFields[pet.FieldOwnerID] = struct{}{}
}
// OwnerCleared reports if the "owner" edge to the User entity was cleared.

View File

@@ -186,6 +186,7 @@ func (m *CardMutation) ResetOwnerID() {
// ClearOwner clears the "owner" edge to the User entity.
func (m *CardMutation) ClearOwner() {
m.clearedowner = true
m.clearedFields[card.FieldOwnerID] = struct{}{}
}
// OwnerCleared reports if the "owner" edge to the User entity was cleared.
@@ -612,6 +613,7 @@ func (m *PetMutation) ResetOwnerID() {
// ClearBestFriend clears the "best_friend" edge to the Pet entity.
func (m *PetMutation) ClearBestFriend() {
m.clearedbest_friend = true
m.clearedFields[pet.FieldBestFriendID] = struct{}{}
}
// BestFriendCleared reports if the "best_friend" edge to the Pet entity was cleared.
@@ -638,6 +640,7 @@ func (m *PetMutation) ResetBestFriend() {
// ClearOwner clears the "owner" edge to the User entity.
func (m *PetMutation) ClearOwner() {
m.clearedowner = true
m.clearedFields[pet.FieldOwnerID] = struct{}{}
}
// OwnerCleared reports if the "owner" edge to the User entity was cleared.

View File

@@ -255,6 +255,7 @@ func (m *NodeMutation) ResetParentID() {
// ClearParent clears the "parent" edge to the Node entity.
func (m *NodeMutation) ClearParent() {
m.clearedparent = true
m.clearedFields[node.FieldParentID] = struct{}{}
}
// ParentCleared reports if the "parent" edge to the Node entity was cleared.

View File

@@ -254,6 +254,7 @@ func (m *NodeMutation) ResetPrevID() {
// ClearPrev clears the "prev" edge to the Node entity.
func (m *NodeMutation) ClearPrev() {
m.clearedprev = true
m.clearedFields[node.FieldPrevID] = struct{}{}
}
// PrevCleared reports if the "prev" edge to the Node entity was cleared.

View File

@@ -225,6 +225,7 @@ func (m *GroupMutation) ResetName() {
// ClearTenant clears the "tenant" edge to the Tenant entity.
func (m *GroupMutation) ClearTenant() {
m.clearedtenant = true
m.clearedFields[group.FieldTenantID] = struct{}{}
}
// TenantCleared reports if the "tenant" edge to the Tenant entity was cleared.
@@ -1139,6 +1140,7 @@ func (m *UserMutation) ResetFoods() {
// ClearTenant clears the "tenant" edge to the Tenant entity.
func (m *UserMutation) ClearTenant() {
m.clearedtenant = true
m.clearedFields[user.FieldTenantID] = struct{}{}
}
// TenantCleared reports if the "tenant" edge to the Tenant entity was cleared.