mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc/gen: ignore query execution on empty batch (#648)
This commit is contained in:
@@ -201,8 +201,10 @@ func (gcb *GroupCreateBulk) Save(ctx context.Context) ([]*Group, error) {
|
||||
mutators[i] = mut
|
||||
}(i, ctx)
|
||||
}
|
||||
if _, err := mutators[0].Mutate(ctx, gcb.builders[0].mutation); err != nil {
|
||||
return nil, err
|
||||
if len(mutators) > 0 {
|
||||
if _, err := mutators[0].Mutate(ctx, gcb.builders[0].mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
@@ -218,8 +218,10 @@ func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error) {
|
||||
mutators[i] = mut
|
||||
}(i, ctx)
|
||||
}
|
||||
if _, err := mutators[0].Mutate(ctx, ucb.builders[0].mutation); err != nil {
|
||||
return nil, err
|
||||
if len(mutators) > 0 {
|
||||
if _, err := mutators[0].Mutate(ctx, ucb.builders[0].mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user