mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc/gen: add the Exec(X) methods for BulkCreate
This commit is contained in:
committed by
Ariel Mashraki
parent
b4ba9eb12f
commit
3307dd5323
@@ -246,3 +246,16 @@ func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User {
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (ucb *UserCreateBulk) Exec(ctx context.Context) error {
|
||||
_, err := ucb.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (ucb *UserCreateBulk) ExecX(ctx context.Context) {
|
||||
if err := ucb.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user