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
@@ -105,6 +105,7 @@ func (fc *FileCreate) Save(ctx context.Context) (*File, error) {
|
||||
}
|
||||
fc.mutation = mutation
|
||||
node, err = fc.sqlSave(ctx)
|
||||
mutation.id = &node.ID
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
@@ -264,6 +265,7 @@ func (fcb *FileCreateBulk) Save(ctx context.Context) ([]*File, error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
mutation.id = &nodes[i].ID
|
||||
mutation.done = true
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -118,8 +118,8 @@ func (m FileMutation) 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 *FileMutation) ID() (id int, exists bool) {
|
||||
if m.id == nil {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user