mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc/gen: update mutation-id on post mutation
This commit is contained in:
committed by
Ariel Mashraki
parent
ca7aa4b742
commit
11567a3926
@@ -116,8 +116,8 @@ func (m PetMutation) Tx() (*Tx, error) {
|
||||
return tx, nil
|
||||
}
|
||||
|
||||
// ID returns the ID value in the mutation. Note that the ID
|
||||
// is only available if it was provided to the builder.
|
||||
// ID returns the ID value in the mutation. Note that the ID is only available
|
||||
// if it was provided to the builder or after it was returned from the database.
|
||||
func (m *PetMutation) ID() (id int, exists bool) {
|
||||
if m.id == nil {
|
||||
return
|
||||
@@ -475,8 +475,8 @@ func (m UserMutation) Tx() (*Tx, error) {
|
||||
return tx, nil
|
||||
}
|
||||
|
||||
// ID returns the ID value in the mutation. Note that the ID
|
||||
// is only available if it was provided to the builder.
|
||||
// ID returns the ID value in the mutation. Note that the ID is only available
|
||||
// if it was provided to the builder or after it was returned from the database.
|
||||
func (m *UserMutation) ID() (id int, exists bool) {
|
||||
if m.id == nil {
|
||||
return
|
||||
|
||||
@@ -76,6 +76,7 @@ func (pc *PetCreate) Save(ctx context.Context) (*Pet, error) {
|
||||
}
|
||||
pc.mutation = mutation
|
||||
node, err = pc.sqlSave(ctx)
|
||||
mutation.id = &node.ID
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
@@ -196,6 +197,7 @@ func (pcb *PetCreateBulk) Save(ctx context.Context) ([]*Pet, error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
mutation.id = &nodes[i].ID
|
||||
mutation.done = true
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -78,6 +78,7 @@ func (uc *UserCreate) Save(ctx context.Context) (*User, error) {
|
||||
}
|
||||
uc.mutation = mutation
|
||||
node, err = uc.sqlSave(ctx)
|
||||
mutation.id = &node.ID
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
@@ -208,6 +209,7 @@ func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
mutation.id = &nodes[i].ID
|
||||
mutation.done = true
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user