| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714 |
- // Code generated by ent, DO NOT EDIT.
- package ent
- import (
- "context"
- "errors"
- "fmt"
- "time"
- "entgo.io/ent/dialect/sql"
- "entgo.io/ent/dialect/sql/sqlgraph"
- "entgo.io/ent/schema/field"
- "github.com/Wei-Shaw/sub2api/ent/batchimageevent"
- )
- // BatchImageEventCreate is the builder for creating a BatchImageEvent entity.
- type BatchImageEventCreate struct {
- config
- mutation *BatchImageEventMutation
- hooks []Hook
- conflict []sql.ConflictOption
- }
- // SetJobID sets the "job_id" field.
- func (_c *BatchImageEventCreate) SetJobID(v string) *BatchImageEventCreate {
- _c.mutation.SetJobID(v)
- return _c
- }
- // SetEventType sets the "event_type" field.
- func (_c *BatchImageEventCreate) SetEventType(v string) *BatchImageEventCreate {
- _c.mutation.SetEventType(v)
- return _c
- }
- // SetPayload sets the "payload" field.
- func (_c *BatchImageEventCreate) SetPayload(v map[string]interface{}) *BatchImageEventCreate {
- _c.mutation.SetPayload(v)
- return _c
- }
- // SetEventHash sets the "event_hash" field.
- func (_c *BatchImageEventCreate) SetEventHash(v string) *BatchImageEventCreate {
- _c.mutation.SetEventHash(v)
- return _c
- }
- // SetNillableEventHash sets the "event_hash" field if the given value is not nil.
- func (_c *BatchImageEventCreate) SetNillableEventHash(v *string) *BatchImageEventCreate {
- if v != nil {
- _c.SetEventHash(*v)
- }
- return _c
- }
- // SetCreatedAt sets the "created_at" field.
- func (_c *BatchImageEventCreate) SetCreatedAt(v time.Time) *BatchImageEventCreate {
- _c.mutation.SetCreatedAt(v)
- return _c
- }
- // SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
- func (_c *BatchImageEventCreate) SetNillableCreatedAt(v *time.Time) *BatchImageEventCreate {
- if v != nil {
- _c.SetCreatedAt(*v)
- }
- return _c
- }
- // Mutation returns the BatchImageEventMutation object of the builder.
- func (_c *BatchImageEventCreate) Mutation() *BatchImageEventMutation {
- return _c.mutation
- }
- // Save creates the BatchImageEvent in the database.
- func (_c *BatchImageEventCreate) Save(ctx context.Context) (*BatchImageEvent, error) {
- _c.defaults()
- return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
- }
- // SaveX calls Save and panics if Save returns an error.
- func (_c *BatchImageEventCreate) SaveX(ctx context.Context) *BatchImageEvent {
- v, err := _c.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
- }
- // Exec executes the query.
- func (_c *BatchImageEventCreate) Exec(ctx context.Context) error {
- _, err := _c.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (_c *BatchImageEventCreate) ExecX(ctx context.Context) {
- if err := _c.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // defaults sets the default values of the builder before save.
- func (_c *BatchImageEventCreate) defaults() {
- if _, ok := _c.mutation.CreatedAt(); !ok {
- v := batchimageevent.DefaultCreatedAt()
- _c.mutation.SetCreatedAt(v)
- }
- }
- // check runs all checks and user-defined validators on the builder.
- func (_c *BatchImageEventCreate) check() error {
- if _, ok := _c.mutation.JobID(); !ok {
- return &ValidationError{Name: "job_id", err: errors.New(`ent: missing required field "BatchImageEvent.job_id"`)}
- }
- if v, ok := _c.mutation.JobID(); ok {
- if err := batchimageevent.JobIDValidator(v); err != nil {
- return &ValidationError{Name: "job_id", err: fmt.Errorf(`ent: validator failed for field "BatchImageEvent.job_id": %w`, err)}
- }
- }
- if _, ok := _c.mutation.EventType(); !ok {
- return &ValidationError{Name: "event_type", err: errors.New(`ent: missing required field "BatchImageEvent.event_type"`)}
- }
- if v, ok := _c.mutation.EventType(); ok {
- if err := batchimageevent.EventTypeValidator(v); err != nil {
- return &ValidationError{Name: "event_type", err: fmt.Errorf(`ent: validator failed for field "BatchImageEvent.event_type": %w`, err)}
- }
- }
- if v, ok := _c.mutation.EventHash(); ok {
- if err := batchimageevent.EventHashValidator(v); err != nil {
- return &ValidationError{Name: "event_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageEvent.event_hash": %w`, err)}
- }
- }
- if _, ok := _c.mutation.CreatedAt(); !ok {
- return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "BatchImageEvent.created_at"`)}
- }
- return nil
- }
- func (_c *BatchImageEventCreate) sqlSave(ctx context.Context) (*BatchImageEvent, error) {
- if err := _c.check(); err != nil {
- return nil, err
- }
- _node, _spec := _c.createSpec()
- if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
- if sqlgraph.IsConstraintError(err) {
- err = &ConstraintError{msg: err.Error(), wrap: err}
- }
- return nil, err
- }
- id := _spec.ID.Value.(int64)
- _node.ID = int64(id)
- _c.mutation.id = &_node.ID
- _c.mutation.done = true
- return _node, nil
- }
- func (_c *BatchImageEventCreate) createSpec() (*BatchImageEvent, *sqlgraph.CreateSpec) {
- var (
- _node = &BatchImageEvent{config: _c.config}
- _spec = sqlgraph.NewCreateSpec(batchimageevent.Table, sqlgraph.NewFieldSpec(batchimageevent.FieldID, field.TypeInt64))
- )
- _spec.OnConflict = _c.conflict
- if value, ok := _c.mutation.JobID(); ok {
- _spec.SetField(batchimageevent.FieldJobID, field.TypeString, value)
- _node.JobID = value
- }
- if value, ok := _c.mutation.EventType(); ok {
- _spec.SetField(batchimageevent.FieldEventType, field.TypeString, value)
- _node.EventType = value
- }
- if value, ok := _c.mutation.Payload(); ok {
- _spec.SetField(batchimageevent.FieldPayload, field.TypeJSON, value)
- _node.Payload = value
- }
- if value, ok := _c.mutation.EventHash(); ok {
- _spec.SetField(batchimageevent.FieldEventHash, field.TypeString, value)
- _node.EventHash = &value
- }
- if value, ok := _c.mutation.CreatedAt(); ok {
- _spec.SetField(batchimageevent.FieldCreatedAt, field.TypeTime, value)
- _node.CreatedAt = value
- }
- return _node, _spec
- }
- // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
- // of the `INSERT` statement. For example:
- //
- // client.BatchImageEvent.Create().
- // SetJobID(v).
- // OnConflict(
- // // Update the row with the new values
- // // the was proposed for insertion.
- // sql.ResolveWithNewValues(),
- // ).
- // // Override some of the fields with custom
- // // update values.
- // Update(func(u *ent.BatchImageEventUpsert) {
- // SetJobID(v+v).
- // }).
- // Exec(ctx)
- func (_c *BatchImageEventCreate) OnConflict(opts ...sql.ConflictOption) *BatchImageEventUpsertOne {
- _c.conflict = opts
- return &BatchImageEventUpsertOne{
- create: _c,
- }
- }
- // OnConflictColumns calls `OnConflict` and configures the columns
- // as conflict target. Using this option is equivalent to using:
- //
- // client.BatchImageEvent.Create().
- // OnConflict(sql.ConflictColumns(columns...)).
- // Exec(ctx)
- func (_c *BatchImageEventCreate) OnConflictColumns(columns ...string) *BatchImageEventUpsertOne {
- _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
- return &BatchImageEventUpsertOne{
- create: _c,
- }
- }
- type (
- // BatchImageEventUpsertOne is the builder for "upsert"-ing
- // one BatchImageEvent node.
- BatchImageEventUpsertOne struct {
- create *BatchImageEventCreate
- }
- // BatchImageEventUpsert is the "OnConflict" setter.
- BatchImageEventUpsert struct {
- *sql.UpdateSet
- }
- )
- // SetJobID sets the "job_id" field.
- func (u *BatchImageEventUpsert) SetJobID(v string) *BatchImageEventUpsert {
- u.Set(batchimageevent.FieldJobID, v)
- return u
- }
- // UpdateJobID sets the "job_id" field to the value that was provided on create.
- func (u *BatchImageEventUpsert) UpdateJobID() *BatchImageEventUpsert {
- u.SetExcluded(batchimageevent.FieldJobID)
- return u
- }
- // SetEventType sets the "event_type" field.
- func (u *BatchImageEventUpsert) SetEventType(v string) *BatchImageEventUpsert {
- u.Set(batchimageevent.FieldEventType, v)
- return u
- }
- // UpdateEventType sets the "event_type" field to the value that was provided on create.
- func (u *BatchImageEventUpsert) UpdateEventType() *BatchImageEventUpsert {
- u.SetExcluded(batchimageevent.FieldEventType)
- return u
- }
- // SetPayload sets the "payload" field.
- func (u *BatchImageEventUpsert) SetPayload(v map[string]interface{}) *BatchImageEventUpsert {
- u.Set(batchimageevent.FieldPayload, v)
- return u
- }
- // UpdatePayload sets the "payload" field to the value that was provided on create.
- func (u *BatchImageEventUpsert) UpdatePayload() *BatchImageEventUpsert {
- u.SetExcluded(batchimageevent.FieldPayload)
- return u
- }
- // ClearPayload clears the value of the "payload" field.
- func (u *BatchImageEventUpsert) ClearPayload() *BatchImageEventUpsert {
- u.SetNull(batchimageevent.FieldPayload)
- return u
- }
- // SetEventHash sets the "event_hash" field.
- func (u *BatchImageEventUpsert) SetEventHash(v string) *BatchImageEventUpsert {
- u.Set(batchimageevent.FieldEventHash, v)
- return u
- }
- // UpdateEventHash sets the "event_hash" field to the value that was provided on create.
- func (u *BatchImageEventUpsert) UpdateEventHash() *BatchImageEventUpsert {
- u.SetExcluded(batchimageevent.FieldEventHash)
- return u
- }
- // ClearEventHash clears the value of the "event_hash" field.
- func (u *BatchImageEventUpsert) ClearEventHash() *BatchImageEventUpsert {
- u.SetNull(batchimageevent.FieldEventHash)
- return u
- }
- // UpdateNewValues updates the mutable fields using the new values that were set on create.
- // Using this option is equivalent to using:
- //
- // client.BatchImageEvent.Create().
- // OnConflict(
- // sql.ResolveWithNewValues(),
- // ).
- // Exec(ctx)
- func (u *BatchImageEventUpsertOne) UpdateNewValues() *BatchImageEventUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
- if _, exists := u.create.mutation.CreatedAt(); exists {
- s.SetIgnore(batchimageevent.FieldCreatedAt)
- }
- }))
- return u
- }
- // Ignore sets each column to itself in case of conflict.
- // Using this option is equivalent to using:
- //
- // client.BatchImageEvent.Create().
- // OnConflict(sql.ResolveWithIgnore()).
- // Exec(ctx)
- func (u *BatchImageEventUpsertOne) Ignore() *BatchImageEventUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
- return u
- }
- // DoNothing configures the conflict_action to `DO NOTHING`.
- // Supported only by SQLite and PostgreSQL.
- func (u *BatchImageEventUpsertOne) DoNothing() *BatchImageEventUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
- }
- // Update allows overriding fields `UPDATE` values. See the BatchImageEventCreate.OnConflict
- // documentation for more info.
- func (u *BatchImageEventUpsertOne) Update(set func(*BatchImageEventUpsert)) *BatchImageEventUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&BatchImageEventUpsert{UpdateSet: update})
- }))
- return u
- }
- // SetJobID sets the "job_id" field.
- func (u *BatchImageEventUpsertOne) SetJobID(v string) *BatchImageEventUpsertOne {
- return u.Update(func(s *BatchImageEventUpsert) {
- s.SetJobID(v)
- })
- }
- // UpdateJobID sets the "job_id" field to the value that was provided on create.
- func (u *BatchImageEventUpsertOne) UpdateJobID() *BatchImageEventUpsertOne {
- return u.Update(func(s *BatchImageEventUpsert) {
- s.UpdateJobID()
- })
- }
- // SetEventType sets the "event_type" field.
- func (u *BatchImageEventUpsertOne) SetEventType(v string) *BatchImageEventUpsertOne {
- return u.Update(func(s *BatchImageEventUpsert) {
- s.SetEventType(v)
- })
- }
- // UpdateEventType sets the "event_type" field to the value that was provided on create.
- func (u *BatchImageEventUpsertOne) UpdateEventType() *BatchImageEventUpsertOne {
- return u.Update(func(s *BatchImageEventUpsert) {
- s.UpdateEventType()
- })
- }
- // SetPayload sets the "payload" field.
- func (u *BatchImageEventUpsertOne) SetPayload(v map[string]interface{}) *BatchImageEventUpsertOne {
- return u.Update(func(s *BatchImageEventUpsert) {
- s.SetPayload(v)
- })
- }
- // UpdatePayload sets the "payload" field to the value that was provided on create.
- func (u *BatchImageEventUpsertOne) UpdatePayload() *BatchImageEventUpsertOne {
- return u.Update(func(s *BatchImageEventUpsert) {
- s.UpdatePayload()
- })
- }
- // ClearPayload clears the value of the "payload" field.
- func (u *BatchImageEventUpsertOne) ClearPayload() *BatchImageEventUpsertOne {
- return u.Update(func(s *BatchImageEventUpsert) {
- s.ClearPayload()
- })
- }
- // SetEventHash sets the "event_hash" field.
- func (u *BatchImageEventUpsertOne) SetEventHash(v string) *BatchImageEventUpsertOne {
- return u.Update(func(s *BatchImageEventUpsert) {
- s.SetEventHash(v)
- })
- }
- // UpdateEventHash sets the "event_hash" field to the value that was provided on create.
- func (u *BatchImageEventUpsertOne) UpdateEventHash() *BatchImageEventUpsertOne {
- return u.Update(func(s *BatchImageEventUpsert) {
- s.UpdateEventHash()
- })
- }
- // ClearEventHash clears the value of the "event_hash" field.
- func (u *BatchImageEventUpsertOne) ClearEventHash() *BatchImageEventUpsertOne {
- return u.Update(func(s *BatchImageEventUpsert) {
- s.ClearEventHash()
- })
- }
- // Exec executes the query.
- func (u *BatchImageEventUpsertOne) Exec(ctx context.Context) error {
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for BatchImageEventCreate.OnConflict")
- }
- return u.create.Exec(ctx)
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (u *BatchImageEventUpsertOne) ExecX(ctx context.Context) {
- if err := u.create.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // Exec executes the UPSERT query and returns the inserted/updated ID.
- func (u *BatchImageEventUpsertOne) ID(ctx context.Context) (id int64, err error) {
- node, err := u.create.Save(ctx)
- if err != nil {
- return id, err
- }
- return node.ID, nil
- }
- // IDX is like ID, but panics if an error occurs.
- func (u *BatchImageEventUpsertOne) IDX(ctx context.Context) int64 {
- id, err := u.ID(ctx)
- if err != nil {
- panic(err)
- }
- return id
- }
- // BatchImageEventCreateBulk is the builder for creating many BatchImageEvent entities in bulk.
- type BatchImageEventCreateBulk struct {
- config
- err error
- builders []*BatchImageEventCreate
- conflict []sql.ConflictOption
- }
- // Save creates the BatchImageEvent entities in the database.
- func (_c *BatchImageEventCreateBulk) Save(ctx context.Context) ([]*BatchImageEvent, error) {
- if _c.err != nil {
- return nil, _c.err
- }
- specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
- nodes := make([]*BatchImageEvent, len(_c.builders))
- mutators := make([]Mutator, len(_c.builders))
- for i := range _c.builders {
- func(i int, root context.Context) {
- builder := _c.builders[i]
- builder.defaults()
- var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
- mutation, ok := m.(*BatchImageEventMutation)
- if !ok {
- return nil, fmt.Errorf("unexpected mutation type %T", m)
- }
- if err := builder.check(); err != nil {
- return nil, err
- }
- builder.mutation = mutation
- var err error
- nodes[i], specs[i] = builder.createSpec()
- if i < len(mutators)-1 {
- _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
- } else {
- spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
- spec.OnConflict = _c.conflict
- // Invoke the actual operation on the latest mutation in the chain.
- if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
- if sqlgraph.IsConstraintError(err) {
- err = &ConstraintError{msg: err.Error(), wrap: err}
- }
- }
- }
- if err != nil {
- return nil, err
- }
- mutation.id = &nodes[i].ID
- if specs[i].ID.Value != nil {
- id := specs[i].ID.Value.(int64)
- nodes[i].ID = int64(id)
- }
- mutation.done = true
- return nodes[i], nil
- })
- for i := len(builder.hooks) - 1; i >= 0; i-- {
- mut = builder.hooks[i](mut)
- }
- mutators[i] = mut
- }(i, ctx)
- }
- if len(mutators) > 0 {
- if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
- return nil, err
- }
- }
- return nodes, nil
- }
- // SaveX is like Save, but panics if an error occurs.
- func (_c *BatchImageEventCreateBulk) SaveX(ctx context.Context) []*BatchImageEvent {
- v, err := _c.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
- }
- // Exec executes the query.
- func (_c *BatchImageEventCreateBulk) Exec(ctx context.Context) error {
- _, err := _c.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (_c *BatchImageEventCreateBulk) ExecX(ctx context.Context) {
- if err := _c.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
- // of the `INSERT` statement. For example:
- //
- // client.BatchImageEvent.CreateBulk(builders...).
- // OnConflict(
- // // Update the row with the new values
- // // the was proposed for insertion.
- // sql.ResolveWithNewValues(),
- // ).
- // // Override some of the fields with custom
- // // update values.
- // Update(func(u *ent.BatchImageEventUpsert) {
- // SetJobID(v+v).
- // }).
- // Exec(ctx)
- func (_c *BatchImageEventCreateBulk) OnConflict(opts ...sql.ConflictOption) *BatchImageEventUpsertBulk {
- _c.conflict = opts
- return &BatchImageEventUpsertBulk{
- create: _c,
- }
- }
- // OnConflictColumns calls `OnConflict` and configures the columns
- // as conflict target. Using this option is equivalent to using:
- //
- // client.BatchImageEvent.Create().
- // OnConflict(sql.ConflictColumns(columns...)).
- // Exec(ctx)
- func (_c *BatchImageEventCreateBulk) OnConflictColumns(columns ...string) *BatchImageEventUpsertBulk {
- _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
- return &BatchImageEventUpsertBulk{
- create: _c,
- }
- }
- // BatchImageEventUpsertBulk is the builder for "upsert"-ing
- // a bulk of BatchImageEvent nodes.
- type BatchImageEventUpsertBulk struct {
- create *BatchImageEventCreateBulk
- }
- // UpdateNewValues updates the mutable fields using the new values that
- // were set on create. Using this option is equivalent to using:
- //
- // client.BatchImageEvent.Create().
- // OnConflict(
- // sql.ResolveWithNewValues(),
- // ).
- // Exec(ctx)
- func (u *BatchImageEventUpsertBulk) UpdateNewValues() *BatchImageEventUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
- for _, b := range u.create.builders {
- if _, exists := b.mutation.CreatedAt(); exists {
- s.SetIgnore(batchimageevent.FieldCreatedAt)
- }
- }
- }))
- return u
- }
- // Ignore sets each column to itself in case of conflict.
- // Using this option is equivalent to using:
- //
- // client.BatchImageEvent.Create().
- // OnConflict(sql.ResolveWithIgnore()).
- // Exec(ctx)
- func (u *BatchImageEventUpsertBulk) Ignore() *BatchImageEventUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
- return u
- }
- // DoNothing configures the conflict_action to `DO NOTHING`.
- // Supported only by SQLite and PostgreSQL.
- func (u *BatchImageEventUpsertBulk) DoNothing() *BatchImageEventUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
- }
- // Update allows overriding fields `UPDATE` values. See the BatchImageEventCreateBulk.OnConflict
- // documentation for more info.
- func (u *BatchImageEventUpsertBulk) Update(set func(*BatchImageEventUpsert)) *BatchImageEventUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&BatchImageEventUpsert{UpdateSet: update})
- }))
- return u
- }
- // SetJobID sets the "job_id" field.
- func (u *BatchImageEventUpsertBulk) SetJobID(v string) *BatchImageEventUpsertBulk {
- return u.Update(func(s *BatchImageEventUpsert) {
- s.SetJobID(v)
- })
- }
- // UpdateJobID sets the "job_id" field to the value that was provided on create.
- func (u *BatchImageEventUpsertBulk) UpdateJobID() *BatchImageEventUpsertBulk {
- return u.Update(func(s *BatchImageEventUpsert) {
- s.UpdateJobID()
- })
- }
- // SetEventType sets the "event_type" field.
- func (u *BatchImageEventUpsertBulk) SetEventType(v string) *BatchImageEventUpsertBulk {
- return u.Update(func(s *BatchImageEventUpsert) {
- s.SetEventType(v)
- })
- }
- // UpdateEventType sets the "event_type" field to the value that was provided on create.
- func (u *BatchImageEventUpsertBulk) UpdateEventType() *BatchImageEventUpsertBulk {
- return u.Update(func(s *BatchImageEventUpsert) {
- s.UpdateEventType()
- })
- }
- // SetPayload sets the "payload" field.
- func (u *BatchImageEventUpsertBulk) SetPayload(v map[string]interface{}) *BatchImageEventUpsertBulk {
- return u.Update(func(s *BatchImageEventUpsert) {
- s.SetPayload(v)
- })
- }
- // UpdatePayload sets the "payload" field to the value that was provided on create.
- func (u *BatchImageEventUpsertBulk) UpdatePayload() *BatchImageEventUpsertBulk {
- return u.Update(func(s *BatchImageEventUpsert) {
- s.UpdatePayload()
- })
- }
- // ClearPayload clears the value of the "payload" field.
- func (u *BatchImageEventUpsertBulk) ClearPayload() *BatchImageEventUpsertBulk {
- return u.Update(func(s *BatchImageEventUpsert) {
- s.ClearPayload()
- })
- }
- // SetEventHash sets the "event_hash" field.
- func (u *BatchImageEventUpsertBulk) SetEventHash(v string) *BatchImageEventUpsertBulk {
- return u.Update(func(s *BatchImageEventUpsert) {
- s.SetEventHash(v)
- })
- }
- // UpdateEventHash sets the "event_hash" field to the value that was provided on create.
- func (u *BatchImageEventUpsertBulk) UpdateEventHash() *BatchImageEventUpsertBulk {
- return u.Update(func(s *BatchImageEventUpsert) {
- s.UpdateEventHash()
- })
- }
- // ClearEventHash clears the value of the "event_hash" field.
- func (u *BatchImageEventUpsertBulk) ClearEventHash() *BatchImageEventUpsertBulk {
- return u.Update(func(s *BatchImageEventUpsert) {
- s.ClearEventHash()
- })
- }
- // Exec executes the query.
- func (u *BatchImageEventUpsertBulk) Exec(ctx context.Context) error {
- if u.create.err != nil {
- return u.create.err
- }
- for i, b := range u.create.builders {
- if len(b.conflict) != 0 {
- return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the BatchImageEventCreateBulk instead", i)
- }
- }
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for BatchImageEventCreateBulk.OnConflict")
- }
- return u.create.Exec(ctx)
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (u *BatchImageEventUpsertBulk) ExecX(ctx context.Context) {
- if err := u.create.Exec(ctx); err != nil {
- panic(err)
- }
- }
|