// Code generated by ent, DO NOT EDIT.

package ent

import (
	"context"
	"errors"
	"fmt"
	"time"

	"entgo.io/ent/dialect"
	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
	"github.com/AvengeMedia/dankcalendar/core/ent/calendar"
	"github.com/AvengeMedia/dankcalendar/core/ent/event"
)

// EventCreate is the builder for creating a Event entity.
type EventCreate struct {
	config
	mutation *EventMutation
	hooks    []Hook
	conflict []sql.ConflictOption
}

// SetUID sets the "uid" field.
func (_c *EventCreate) SetUID(v string) *EventCreate {
	_c.mutation.SetUID(v)
	return _c
}

// SetRemoteID sets the "remote_id" field.
func (_c *EventCreate) SetRemoteID(v string) *EventCreate {
	_c.mutation.SetRemoteID(v)
	return _c
}

// SetNillableRemoteID sets the "remote_id" field if the given value is not nil.
func (_c *EventCreate) SetNillableRemoteID(v *string) *EventCreate {
	if v != nil {
		_c.SetRemoteID(*v)
	}
	return _c
}

// SetEtag sets the "etag" field.
func (_c *EventCreate) SetEtag(v string) *EventCreate {
	_c.mutation.SetEtag(v)
	return _c
}

// SetNillableEtag sets the "etag" field if the given value is not nil.
func (_c *EventCreate) SetNillableEtag(v *string) *EventCreate {
	if v != nil {
		_c.SetEtag(*v)
	}
	return _c
}

// SetSummary sets the "summary" field.
func (_c *EventCreate) SetSummary(v string) *EventCreate {
	_c.mutation.SetSummary(v)
	return _c
}

// SetDescription sets the "description" field.
func (_c *EventCreate) SetDescription(v string) *EventCreate {
	_c.mutation.SetDescription(v)
	return _c
}

// SetNillableDescription sets the "description" field if the given value is not nil.
func (_c *EventCreate) SetNillableDescription(v *string) *EventCreate {
	if v != nil {
		_c.SetDescription(*v)
	}
	return _c
}

// SetLocation sets the "location" field.
func (_c *EventCreate) SetLocation(v string) *EventCreate {
	_c.mutation.SetLocation(v)
	return _c
}

// SetNillableLocation sets the "location" field if the given value is not nil.
func (_c *EventCreate) SetNillableLocation(v *string) *EventCreate {
	if v != nil {
		_c.SetLocation(*v)
	}
	return _c
}

// SetURL sets the "url" field.
func (_c *EventCreate) SetURL(v string) *EventCreate {
	_c.mutation.SetURL(v)
	return _c
}

// SetNillableURL sets the "url" field if the given value is not nil.
func (_c *EventCreate) SetNillableURL(v *string) *EventCreate {
	if v != nil {
		_c.SetURL(*v)
	}
	return _c
}

// SetMeetingURL sets the "meeting_url" field.
func (_c *EventCreate) SetMeetingURL(v string) *EventCreate {
	_c.mutation.SetMeetingURL(v)
	return _c
}

// SetNillableMeetingURL sets the "meeting_url" field if the given value is not nil.
func (_c *EventCreate) SetNillableMeetingURL(v *string) *EventCreate {
	if v != nil {
		_c.SetMeetingURL(*v)
	}
	return _c
}

// SetStatus sets the "status" field.
func (_c *EventCreate) SetStatus(v event.Status) *EventCreate {
	_c.mutation.SetStatus(v)
	return _c
}

// SetNillableStatus sets the "status" field if the given value is not nil.
func (_c *EventCreate) SetNillableStatus(v *event.Status) *EventCreate {
	if v != nil {
		_c.SetStatus(*v)
	}
	return _c
}

// SetStart sets the "start" field.
func (_c *EventCreate) SetStart(v time.Time) *EventCreate {
	_c.mutation.SetStart(v)
	return _c
}

// SetEnd sets the "end" field.
func (_c *EventCreate) SetEnd(v time.Time) *EventCreate {
	_c.mutation.SetEnd(v)
	return _c
}

// SetAllDay sets the "all_day" field.
func (_c *EventCreate) SetAllDay(v bool) *EventCreate {
	_c.mutation.SetAllDay(v)
	return _c
}

// SetNillableAllDay sets the "all_day" field if the given value is not nil.
func (_c *EventCreate) SetNillableAllDay(v *bool) *EventCreate {
	if v != nil {
		_c.SetAllDay(*v)
	}
	return _c
}

// SetStartTz sets the "start_tz" field.
func (_c *EventCreate) SetStartTz(v string) *EventCreate {
	_c.mutation.SetStartTz(v)
	return _c
}

// SetNillableStartTz sets the "start_tz" field if the given value is not nil.
func (_c *EventCreate) SetNillableStartTz(v *string) *EventCreate {
	if v != nil {
		_c.SetStartTz(*v)
	}
	return _c
}

// SetEndTz sets the "end_tz" field.
func (_c *EventCreate) SetEndTz(v string) *EventCreate {
	_c.mutation.SetEndTz(v)
	return _c
}

// SetNillableEndTz sets the "end_tz" field if the given value is not nil.
func (_c *EventCreate) SetNillableEndTz(v *string) *EventCreate {
	if v != nil {
		_c.SetEndTz(*v)
	}
	return _c
}

// SetRecurrence sets the "recurrence" field.
func (_c *EventCreate) SetRecurrence(v map[string]interface{}) *EventCreate {
	_c.mutation.SetRecurrence(v)
	return _c
}

// SetRecurringID sets the "recurring_id" field.
func (_c *EventCreate) SetRecurringID(v string) *EventCreate {
	_c.mutation.SetRecurringID(v)
	return _c
}

// SetNillableRecurringID sets the "recurring_id" field if the given value is not nil.
func (_c *EventCreate) SetNillableRecurringID(v *string) *EventCreate {
	if v != nil {
		_c.SetRecurringID(*v)
	}
	return _c
}

// SetOriginalStart sets the "original_start" field.
func (_c *EventCreate) SetOriginalStart(v time.Time) *EventCreate {
	_c.mutation.SetOriginalStart(v)
	return _c
}

// SetNillableOriginalStart sets the "original_start" field if the given value is not nil.
func (_c *EventCreate) SetNillableOriginalStart(v *time.Time) *EventCreate {
	if v != nil {
		_c.SetOriginalStart(*v)
	}
	return _c
}

// SetOrganizer sets the "organizer" field.
func (_c *EventCreate) SetOrganizer(v map[string]interface{}) *EventCreate {
	_c.mutation.SetOrganizer(v)
	return _c
}

// SetAttendees sets the "attendees" field.
func (_c *EventCreate) SetAttendees(v []map[string]interface{}) *EventCreate {
	_c.mutation.SetAttendees(v)
	return _c
}

// SetReminders sets the "reminders" field.
func (_c *EventCreate) SetReminders(v []map[string]interface{}) *EventCreate {
	_c.mutation.SetReminders(v)
	return _c
}

// SetCategories sets the "categories" field.
func (_c *EventCreate) SetCategories(v []string) *EventCreate {
	_c.mutation.SetCategories(v)
	return _c
}

// SetTransparency sets the "transparency" field.
func (_c *EventCreate) SetTransparency(v string) *EventCreate {
	_c.mutation.SetTransparency(v)
	return _c
}

// SetNillableTransparency sets the "transparency" field if the given value is not nil.
func (_c *EventCreate) SetNillableTransparency(v *string) *EventCreate {
	if v != nil {
		_c.SetTransparency(*v)
	}
	return _c
}

// SetVisibility sets the "visibility" field.
func (_c *EventCreate) SetVisibility(v string) *EventCreate {
	_c.mutation.SetVisibility(v)
	return _c
}

// SetNillableVisibility sets the "visibility" field if the given value is not nil.
func (_c *EventCreate) SetNillableVisibility(v *string) *EventCreate {
	if v != nil {
		_c.SetVisibility(*v)
	}
	return _c
}

// SetRawIcs sets the "raw_ics" field.
func (_c *EventCreate) SetRawIcs(v string) *EventCreate {
	_c.mutation.SetRawIcs(v)
	return _c
}

// SetNillableRawIcs sets the "raw_ics" field if the given value is not nil.
func (_c *EventCreate) SetNillableRawIcs(v *string) *EventCreate {
	if v != nil {
		_c.SetRawIcs(*v)
	}
	return _c
}

// SetCreated sets the "created" field.
func (_c *EventCreate) SetCreated(v time.Time) *EventCreate {
	_c.mutation.SetCreated(v)
	return _c
}

// SetNillableCreated sets the "created" field if the given value is not nil.
func (_c *EventCreate) SetNillableCreated(v *time.Time) *EventCreate {
	if v != nil {
		_c.SetCreated(*v)
	}
	return _c
}

// SetUpdated sets the "updated" field.
func (_c *EventCreate) SetUpdated(v time.Time) *EventCreate {
	_c.mutation.SetUpdated(v)
	return _c
}

// SetNillableUpdated sets the "updated" field if the given value is not nil.
func (_c *EventCreate) SetNillableUpdated(v *time.Time) *EventCreate {
	if v != nil {
		_c.SetUpdated(*v)
	}
	return _c
}

// SetID sets the "id" field.
func (_c *EventCreate) SetID(v string) *EventCreate {
	_c.mutation.SetID(v)
	return _c
}

// SetCalendarID sets the "calendar" edge to the Calendar entity by ID.
func (_c *EventCreate) SetCalendarID(id string) *EventCreate {
	_c.mutation.SetCalendarID(id)
	return _c
}

// SetCalendar sets the "calendar" edge to the Calendar entity.
func (_c *EventCreate) SetCalendar(v *Calendar) *EventCreate {
	return _c.SetCalendarID(v.ID)
}

// Mutation returns the EventMutation object of the builder.
func (_c *EventCreate) Mutation() *EventMutation {
	return _c.mutation
}

// Save creates the Event in the database.
func (_c *EventCreate) Save(ctx context.Context) (*Event, error) {
	_c.defaults()
	return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
}

// SaveX calls Save and panics if Save returns an error.
func (_c *EventCreate) SaveX(ctx context.Context) *Event {
	v, err := _c.Save(ctx)
	if err != nil {
		panic(err)
	}
	return v
}

// Exec executes the query.
func (_c *EventCreate) Exec(ctx context.Context) error {
	_, err := _c.Save(ctx)
	return err
}

// ExecX is like Exec, but panics if an error occurs.
func (_c *EventCreate) 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 *EventCreate) defaults() {
	if _, ok := _c.mutation.Status(); !ok {
		v := event.DefaultStatus
		_c.mutation.SetStatus(v)
	}
	if _, ok := _c.mutation.AllDay(); !ok {
		v := event.DefaultAllDay
		_c.mutation.SetAllDay(v)
	}
	if _, ok := _c.mutation.Created(); !ok {
		v := event.DefaultCreated()
		_c.mutation.SetCreated(v)
	}
	if _, ok := _c.mutation.Updated(); !ok {
		v := event.DefaultUpdated()
		_c.mutation.SetUpdated(v)
	}
}

// check runs all checks and user-defined validators on the builder.
func (_c *EventCreate) check() error {
	if _, ok := _c.mutation.UID(); !ok {
		return &ValidationError{Name: "uid", err: errors.New(`ent: missing required field "Event.uid"`)}
	}
	if v, ok := _c.mutation.UID(); ok {
		if err := event.UIDValidator(v); err != nil {
			return &ValidationError{Name: "uid", err: fmt.Errorf(`ent: validator failed for field "Event.uid": %w`, err)}
		}
	}
	if _, ok := _c.mutation.Summary(); !ok {
		return &ValidationError{Name: "summary", err: errors.New(`ent: missing required field "Event.summary"`)}
	}
	if _, ok := _c.mutation.Status(); !ok {
		return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "Event.status"`)}
	}
	if v, ok := _c.mutation.Status(); ok {
		if err := event.StatusValidator(v); err != nil {
			return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "Event.status": %w`, err)}
		}
	}
	if _, ok := _c.mutation.Start(); !ok {
		return &ValidationError{Name: "start", err: errors.New(`ent: missing required field "Event.start"`)}
	}
	if _, ok := _c.mutation.End(); !ok {
		return &ValidationError{Name: "end", err: errors.New(`ent: missing required field "Event.end"`)}
	}
	if _, ok := _c.mutation.AllDay(); !ok {
		return &ValidationError{Name: "all_day", err: errors.New(`ent: missing required field "Event.all_day"`)}
	}
	if _, ok := _c.mutation.Created(); !ok {
		return &ValidationError{Name: "created", err: errors.New(`ent: missing required field "Event.created"`)}
	}
	if _, ok := _c.mutation.Updated(); !ok {
		return &ValidationError{Name: "updated", err: errors.New(`ent: missing required field "Event.updated"`)}
	}
	if v, ok := _c.mutation.ID(); ok {
		if err := event.IDValidator(v); err != nil {
			return &ValidationError{Name: "id", err: fmt.Errorf(`ent: validator failed for field "Event.id": %w`, err)}
		}
	}
	if len(_c.mutation.CalendarIDs()) == 0 {
		return &ValidationError{Name: "calendar", err: errors.New(`ent: missing required edge "Event.calendar"`)}
	}
	return nil
}

func (_c *EventCreate) sqlSave(ctx context.Context) (*Event, 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
	}
	if _spec.ID.Value != nil {
		if id, ok := _spec.ID.Value.(string); ok {
			_node.ID = id
		} else {
			return nil, fmt.Errorf("unexpected Event.ID type: %T", _spec.ID.Value)
		}
	}
	_c.mutation.id = &_node.ID
	_c.mutation.done = true
	return _node, nil
}

func (_c *EventCreate) createSpec() (*Event, *sqlgraph.CreateSpec) {
	var (
		_node = &Event{config: _c.config}
		_spec = sqlgraph.NewCreateSpec(event.Table, sqlgraph.NewFieldSpec(event.FieldID, field.TypeString))
	)
	_spec.OnConflict = _c.conflict
	if id, ok := _c.mutation.ID(); ok {
		_node.ID = id
		_spec.ID.Value = id
	}
	if value, ok := _c.mutation.UID(); ok {
		_spec.SetField(event.FieldUID, field.TypeString, value)
		_node.UID = value
	}
	if value, ok := _c.mutation.RemoteID(); ok {
		_spec.SetField(event.FieldRemoteID, field.TypeString, value)
		_node.RemoteID = value
	}
	if value, ok := _c.mutation.Etag(); ok {
		_spec.SetField(event.FieldEtag, field.TypeString, value)
		_node.Etag = value
	}
	if value, ok := _c.mutation.Summary(); ok {
		_spec.SetField(event.FieldSummary, field.TypeString, value)
		_node.Summary = value
	}
	if value, ok := _c.mutation.Description(); ok {
		_spec.SetField(event.FieldDescription, field.TypeString, value)
		_node.Description = value
	}
	if value, ok := _c.mutation.Location(); ok {
		_spec.SetField(event.FieldLocation, field.TypeString, value)
		_node.Location = value
	}
	if value, ok := _c.mutation.URL(); ok {
		_spec.SetField(event.FieldURL, field.TypeString, value)
		_node.URL = value
	}
	if value, ok := _c.mutation.MeetingURL(); ok {
		_spec.SetField(event.FieldMeetingURL, field.TypeString, value)
		_node.MeetingURL = value
	}
	if value, ok := _c.mutation.Status(); ok {
		_spec.SetField(event.FieldStatus, field.TypeEnum, value)
		_node.Status = value
	}
	if value, ok := _c.mutation.Start(); ok {
		_spec.SetField(event.FieldStart, field.TypeTime, value)
		_node.Start = value
	}
	if value, ok := _c.mutation.End(); ok {
		_spec.SetField(event.FieldEnd, field.TypeTime, value)
		_node.End = value
	}
	if value, ok := _c.mutation.AllDay(); ok {
		_spec.SetField(event.FieldAllDay, field.TypeBool, value)
		_node.AllDay = value
	}
	if value, ok := _c.mutation.StartTz(); ok {
		_spec.SetField(event.FieldStartTz, field.TypeString, value)
		_node.StartTz = value
	}
	if value, ok := _c.mutation.EndTz(); ok {
		_spec.SetField(event.FieldEndTz, field.TypeString, value)
		_node.EndTz = value
	}
	if value, ok := _c.mutation.Recurrence(); ok {
		_spec.SetField(event.FieldRecurrence, field.TypeJSON, value)
		_node.Recurrence = value
	}
	if value, ok := _c.mutation.RecurringID(); ok {
		_spec.SetField(event.FieldRecurringID, field.TypeString, value)
		_node.RecurringID = value
	}
	if value, ok := _c.mutation.OriginalStart(); ok {
		_spec.SetField(event.FieldOriginalStart, field.TypeTime, value)
		_node.OriginalStart = &value
	}
	if value, ok := _c.mutation.Organizer(); ok {
		_spec.SetField(event.FieldOrganizer, field.TypeJSON, value)
		_node.Organizer = value
	}
	if value, ok := _c.mutation.Attendees(); ok {
		_spec.SetField(event.FieldAttendees, field.TypeJSON, value)
		_node.Attendees = value
	}
	if value, ok := _c.mutation.Reminders(); ok {
		_spec.SetField(event.FieldReminders, field.TypeJSON, value)
		_node.Reminders = value
	}
	if value, ok := _c.mutation.Categories(); ok {
		_spec.SetField(event.FieldCategories, field.TypeJSON, value)
		_node.Categories = value
	}
	if value, ok := _c.mutation.Transparency(); ok {
		_spec.SetField(event.FieldTransparency, field.TypeString, value)
		_node.Transparency = value
	}
	if value, ok := _c.mutation.Visibility(); ok {
		_spec.SetField(event.FieldVisibility, field.TypeString, value)
		_node.Visibility = value
	}
	if value, ok := _c.mutation.RawIcs(); ok {
		_spec.SetField(event.FieldRawIcs, field.TypeString, value)
		_node.RawIcs = value
	}
	if value, ok := _c.mutation.Created(); ok {
		_spec.SetField(event.FieldCreated, field.TypeTime, value)
		_node.Created = value
	}
	if value, ok := _c.mutation.Updated(); ok {
		_spec.SetField(event.FieldUpdated, field.TypeTime, value)
		_node.Updated = value
	}
	if nodes := _c.mutation.CalendarIDs(); len(nodes) > 0 {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.M2O,
			Inverse: true,
			Table:   event.CalendarTable,
			Columns: []string{event.CalendarColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(calendar.FieldID, field.TypeString),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_node.calendar_events = &nodes[0]
		_spec.Edges = append(_spec.Edges, edge)
	}
	return _node, _spec
}

// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
// of the `INSERT` statement. For example:
//
//	client.Event.Create().
//		SetUID(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.EventUpsert) {
//			SetUID(v+v).
//		}).
//		Exec(ctx)
func (_c *EventCreate) OnConflict(opts ...sql.ConflictOption) *EventUpsertOne {
	_c.conflict = opts
	return &EventUpsertOne{
		create: _c,
	}
}

// OnConflictColumns calls `OnConflict` and configures the columns
// as conflict target. Using this option is equivalent to using:
//
//	client.Event.Create().
//		OnConflict(sql.ConflictColumns(columns...)).
//		Exec(ctx)
func (_c *EventCreate) OnConflictColumns(columns ...string) *EventUpsertOne {
	_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
	return &EventUpsertOne{
		create: _c,
	}
}

type (
	// EventUpsertOne is the builder for "upsert"-ing
	//  one Event node.
	EventUpsertOne struct {
		create *EventCreate
	}

	// EventUpsert is the "OnConflict" setter.
	EventUpsert struct {
		*sql.UpdateSet
	}
)

// SetUID sets the "uid" field.
func (u *EventUpsert) SetUID(v string) *EventUpsert {
	u.Set(event.FieldUID, v)
	return u
}

// UpdateUID sets the "uid" field to the value that was provided on create.
func (u *EventUpsert) UpdateUID() *EventUpsert {
	u.SetExcluded(event.FieldUID)
	return u
}

// SetRemoteID sets the "remote_id" field.
func (u *EventUpsert) SetRemoteID(v string) *EventUpsert {
	u.Set(event.FieldRemoteID, v)
	return u
}

// UpdateRemoteID sets the "remote_id" field to the value that was provided on create.
func (u *EventUpsert) UpdateRemoteID() *EventUpsert {
	u.SetExcluded(event.FieldRemoteID)
	return u
}

// ClearRemoteID clears the value of the "remote_id" field.
func (u *EventUpsert) ClearRemoteID() *EventUpsert {
	u.SetNull(event.FieldRemoteID)
	return u
}

// SetEtag sets the "etag" field.
func (u *EventUpsert) SetEtag(v string) *EventUpsert {
	u.Set(event.FieldEtag, v)
	return u
}

// UpdateEtag sets the "etag" field to the value that was provided on create.
func (u *EventUpsert) UpdateEtag() *EventUpsert {
	u.SetExcluded(event.FieldEtag)
	return u
}

// ClearEtag clears the value of the "etag" field.
func (u *EventUpsert) ClearEtag() *EventUpsert {
	u.SetNull(event.FieldEtag)
	return u
}

// SetSummary sets the "summary" field.
func (u *EventUpsert) SetSummary(v string) *EventUpsert {
	u.Set(event.FieldSummary, v)
	return u
}

// UpdateSummary sets the "summary" field to the value that was provided on create.
func (u *EventUpsert) UpdateSummary() *EventUpsert {
	u.SetExcluded(event.FieldSummary)
	return u
}

// SetDescription sets the "description" field.
func (u *EventUpsert) SetDescription(v string) *EventUpsert {
	u.Set(event.FieldDescription, v)
	return u
}

// UpdateDescription sets the "description" field to the value that was provided on create.
func (u *EventUpsert) UpdateDescription() *EventUpsert {
	u.SetExcluded(event.FieldDescription)
	return u
}

// ClearDescription clears the value of the "description" field.
func (u *EventUpsert) ClearDescription() *EventUpsert {
	u.SetNull(event.FieldDescription)
	return u
}

// SetLocation sets the "location" field.
func (u *EventUpsert) SetLocation(v string) *EventUpsert {
	u.Set(event.FieldLocation, v)
	return u
}

// UpdateLocation sets the "location" field to the value that was provided on create.
func (u *EventUpsert) UpdateLocation() *EventUpsert {
	u.SetExcluded(event.FieldLocation)
	return u
}

// ClearLocation clears the value of the "location" field.
func (u *EventUpsert) ClearLocation() *EventUpsert {
	u.SetNull(event.FieldLocation)
	return u
}

// SetURL sets the "url" field.
func (u *EventUpsert) SetURL(v string) *EventUpsert {
	u.Set(event.FieldURL, v)
	return u
}

// UpdateURL sets the "url" field to the value that was provided on create.
func (u *EventUpsert) UpdateURL() *EventUpsert {
	u.SetExcluded(event.FieldURL)
	return u
}

// ClearURL clears the value of the "url" field.
func (u *EventUpsert) ClearURL() *EventUpsert {
	u.SetNull(event.FieldURL)
	return u
}

// SetMeetingURL sets the "meeting_url" field.
func (u *EventUpsert) SetMeetingURL(v string) *EventUpsert {
	u.Set(event.FieldMeetingURL, v)
	return u
}

// UpdateMeetingURL sets the "meeting_url" field to the value that was provided on create.
func (u *EventUpsert) UpdateMeetingURL() *EventUpsert {
	u.SetExcluded(event.FieldMeetingURL)
	return u
}

// ClearMeetingURL clears the value of the "meeting_url" field.
func (u *EventUpsert) ClearMeetingURL() *EventUpsert {
	u.SetNull(event.FieldMeetingURL)
	return u
}

// SetStatus sets the "status" field.
func (u *EventUpsert) SetStatus(v event.Status) *EventUpsert {
	u.Set(event.FieldStatus, v)
	return u
}

// UpdateStatus sets the "status" field to the value that was provided on create.
func (u *EventUpsert) UpdateStatus() *EventUpsert {
	u.SetExcluded(event.FieldStatus)
	return u
}

// SetStart sets the "start" field.
func (u *EventUpsert) SetStart(v time.Time) *EventUpsert {
	u.Set(event.FieldStart, v)
	return u
}

// UpdateStart sets the "start" field to the value that was provided on create.
func (u *EventUpsert) UpdateStart() *EventUpsert {
	u.SetExcluded(event.FieldStart)
	return u
}

// SetEnd sets the "end" field.
func (u *EventUpsert) SetEnd(v time.Time) *EventUpsert {
	u.Set(event.FieldEnd, v)
	return u
}

// UpdateEnd sets the "end" field to the value that was provided on create.
func (u *EventUpsert) UpdateEnd() *EventUpsert {
	u.SetExcluded(event.FieldEnd)
	return u
}

// SetAllDay sets the "all_day" field.
func (u *EventUpsert) SetAllDay(v bool) *EventUpsert {
	u.Set(event.FieldAllDay, v)
	return u
}

// UpdateAllDay sets the "all_day" field to the value that was provided on create.
func (u *EventUpsert) UpdateAllDay() *EventUpsert {
	u.SetExcluded(event.FieldAllDay)
	return u
}

// SetStartTz sets the "start_tz" field.
func (u *EventUpsert) SetStartTz(v string) *EventUpsert {
	u.Set(event.FieldStartTz, v)
	return u
}

// UpdateStartTz sets the "start_tz" field to the value that was provided on create.
func (u *EventUpsert) UpdateStartTz() *EventUpsert {
	u.SetExcluded(event.FieldStartTz)
	return u
}

// ClearStartTz clears the value of the "start_tz" field.
func (u *EventUpsert) ClearStartTz() *EventUpsert {
	u.SetNull(event.FieldStartTz)
	return u
}

// SetEndTz sets the "end_tz" field.
func (u *EventUpsert) SetEndTz(v string) *EventUpsert {
	u.Set(event.FieldEndTz, v)
	return u
}

// UpdateEndTz sets the "end_tz" field to the value that was provided on create.
func (u *EventUpsert) UpdateEndTz() *EventUpsert {
	u.SetExcluded(event.FieldEndTz)
	return u
}

// ClearEndTz clears the value of the "end_tz" field.
func (u *EventUpsert) ClearEndTz() *EventUpsert {
	u.SetNull(event.FieldEndTz)
	return u
}

// SetRecurrence sets the "recurrence" field.
func (u *EventUpsert) SetRecurrence(v map[string]interface{}) *EventUpsert {
	u.Set(event.FieldRecurrence, v)
	return u
}

// UpdateRecurrence sets the "recurrence" field to the value that was provided on create.
func (u *EventUpsert) UpdateRecurrence() *EventUpsert {
	u.SetExcluded(event.FieldRecurrence)
	return u
}

// ClearRecurrence clears the value of the "recurrence" field.
func (u *EventUpsert) ClearRecurrence() *EventUpsert {
	u.SetNull(event.FieldRecurrence)
	return u
}

// SetRecurringID sets the "recurring_id" field.
func (u *EventUpsert) SetRecurringID(v string) *EventUpsert {
	u.Set(event.FieldRecurringID, v)
	return u
}

// UpdateRecurringID sets the "recurring_id" field to the value that was provided on create.
func (u *EventUpsert) UpdateRecurringID() *EventUpsert {
	u.SetExcluded(event.FieldRecurringID)
	return u
}

// ClearRecurringID clears the value of the "recurring_id" field.
func (u *EventUpsert) ClearRecurringID() *EventUpsert {
	u.SetNull(event.FieldRecurringID)
	return u
}

// SetOriginalStart sets the "original_start" field.
func (u *EventUpsert) SetOriginalStart(v time.Time) *EventUpsert {
	u.Set(event.FieldOriginalStart, v)
	return u
}

// UpdateOriginalStart sets the "original_start" field to the value that was provided on create.
func (u *EventUpsert) UpdateOriginalStart() *EventUpsert {
	u.SetExcluded(event.FieldOriginalStart)
	return u
}

// ClearOriginalStart clears the value of the "original_start" field.
func (u *EventUpsert) ClearOriginalStart() *EventUpsert {
	u.SetNull(event.FieldOriginalStart)
	return u
}

// SetOrganizer sets the "organizer" field.
func (u *EventUpsert) SetOrganizer(v map[string]interface{}) *EventUpsert {
	u.Set(event.FieldOrganizer, v)
	return u
}

// UpdateOrganizer sets the "organizer" field to the value that was provided on create.
func (u *EventUpsert) UpdateOrganizer() *EventUpsert {
	u.SetExcluded(event.FieldOrganizer)
	return u
}

// ClearOrganizer clears the value of the "organizer" field.
func (u *EventUpsert) ClearOrganizer() *EventUpsert {
	u.SetNull(event.FieldOrganizer)
	return u
}

// SetAttendees sets the "attendees" field.
func (u *EventUpsert) SetAttendees(v []map[string]interface{}) *EventUpsert {
	u.Set(event.FieldAttendees, v)
	return u
}

// UpdateAttendees sets the "attendees" field to the value that was provided on create.
func (u *EventUpsert) UpdateAttendees() *EventUpsert {
	u.SetExcluded(event.FieldAttendees)
	return u
}

// ClearAttendees clears the value of the "attendees" field.
func (u *EventUpsert) ClearAttendees() *EventUpsert {
	u.SetNull(event.FieldAttendees)
	return u
}

// SetReminders sets the "reminders" field.
func (u *EventUpsert) SetReminders(v []map[string]interface{}) *EventUpsert {
	u.Set(event.FieldReminders, v)
	return u
}

// UpdateReminders sets the "reminders" field to the value that was provided on create.
func (u *EventUpsert) UpdateReminders() *EventUpsert {
	u.SetExcluded(event.FieldReminders)
	return u
}

// ClearReminders clears the value of the "reminders" field.
func (u *EventUpsert) ClearReminders() *EventUpsert {
	u.SetNull(event.FieldReminders)
	return u
}

// SetCategories sets the "categories" field.
func (u *EventUpsert) SetCategories(v []string) *EventUpsert {
	u.Set(event.FieldCategories, v)
	return u
}

// UpdateCategories sets the "categories" field to the value that was provided on create.
func (u *EventUpsert) UpdateCategories() *EventUpsert {
	u.SetExcluded(event.FieldCategories)
	return u
}

// ClearCategories clears the value of the "categories" field.
func (u *EventUpsert) ClearCategories() *EventUpsert {
	u.SetNull(event.FieldCategories)
	return u
}

// SetTransparency sets the "transparency" field.
func (u *EventUpsert) SetTransparency(v string) *EventUpsert {
	u.Set(event.FieldTransparency, v)
	return u
}

// UpdateTransparency sets the "transparency" field to the value that was provided on create.
func (u *EventUpsert) UpdateTransparency() *EventUpsert {
	u.SetExcluded(event.FieldTransparency)
	return u
}

// ClearTransparency clears the value of the "transparency" field.
func (u *EventUpsert) ClearTransparency() *EventUpsert {
	u.SetNull(event.FieldTransparency)
	return u
}

// SetVisibility sets the "visibility" field.
func (u *EventUpsert) SetVisibility(v string) *EventUpsert {
	u.Set(event.FieldVisibility, v)
	return u
}

// UpdateVisibility sets the "visibility" field to the value that was provided on create.
func (u *EventUpsert) UpdateVisibility() *EventUpsert {
	u.SetExcluded(event.FieldVisibility)
	return u
}

// ClearVisibility clears the value of the "visibility" field.
func (u *EventUpsert) ClearVisibility() *EventUpsert {
	u.SetNull(event.FieldVisibility)
	return u
}

// SetRawIcs sets the "raw_ics" field.
func (u *EventUpsert) SetRawIcs(v string) *EventUpsert {
	u.Set(event.FieldRawIcs, v)
	return u
}

// UpdateRawIcs sets the "raw_ics" field to the value that was provided on create.
func (u *EventUpsert) UpdateRawIcs() *EventUpsert {
	u.SetExcluded(event.FieldRawIcs)
	return u
}

// ClearRawIcs clears the value of the "raw_ics" field.
func (u *EventUpsert) ClearRawIcs() *EventUpsert {
	u.SetNull(event.FieldRawIcs)
	return u
}

// SetCreated sets the "created" field.
func (u *EventUpsert) SetCreated(v time.Time) *EventUpsert {
	u.Set(event.FieldCreated, v)
	return u
}

// UpdateCreated sets the "created" field to the value that was provided on create.
func (u *EventUpsert) UpdateCreated() *EventUpsert {
	u.SetExcluded(event.FieldCreated)
	return u
}

// SetUpdated sets the "updated" field.
func (u *EventUpsert) SetUpdated(v time.Time) *EventUpsert {
	u.Set(event.FieldUpdated, v)
	return u
}

// UpdateUpdated sets the "updated" field to the value that was provided on create.
func (u *EventUpsert) UpdateUpdated() *EventUpsert {
	u.SetExcluded(event.FieldUpdated)
	return u
}

// UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field.
// Using this option is equivalent to using:
//
//	client.Event.Create().
//		OnConflict(
//			sql.ResolveWithNewValues(),
//			sql.ResolveWith(func(u *sql.UpdateSet) {
//				u.SetIgnore(event.FieldID)
//			}),
//		).
//		Exec(ctx)
func (u *EventUpsertOne) UpdateNewValues() *EventUpsertOne {
	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.ID(); exists {
			s.SetIgnore(event.FieldID)
		}
	}))
	return u
}

// Ignore sets each column to itself in case of conflict.
// Using this option is equivalent to using:
//
//	client.Event.Create().
//	    OnConflict(sql.ResolveWithIgnore()).
//	    Exec(ctx)
func (u *EventUpsertOne) Ignore() *EventUpsertOne {
	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 *EventUpsertOne) DoNothing() *EventUpsertOne {
	u.create.conflict = append(u.create.conflict, sql.DoNothing())
	return u
}

// Update allows overriding fields `UPDATE` values. See the EventCreate.OnConflict
// documentation for more info.
func (u *EventUpsertOne) Update(set func(*EventUpsert)) *EventUpsertOne {
	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
		set(&EventUpsert{UpdateSet: update})
	}))
	return u
}

// SetUID sets the "uid" field.
func (u *EventUpsertOne) SetUID(v string) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetUID(v)
	})
}

// UpdateUID sets the "uid" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateUID() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateUID()
	})
}

// SetRemoteID sets the "remote_id" field.
func (u *EventUpsertOne) SetRemoteID(v string) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetRemoteID(v)
	})
}

// UpdateRemoteID sets the "remote_id" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateRemoteID() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateRemoteID()
	})
}

// ClearRemoteID clears the value of the "remote_id" field.
func (u *EventUpsertOne) ClearRemoteID() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.ClearRemoteID()
	})
}

// SetEtag sets the "etag" field.
func (u *EventUpsertOne) SetEtag(v string) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetEtag(v)
	})
}

// UpdateEtag sets the "etag" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateEtag() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateEtag()
	})
}

// ClearEtag clears the value of the "etag" field.
func (u *EventUpsertOne) ClearEtag() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.ClearEtag()
	})
}

// SetSummary sets the "summary" field.
func (u *EventUpsertOne) SetSummary(v string) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetSummary(v)
	})
}

// UpdateSummary sets the "summary" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateSummary() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateSummary()
	})
}

// SetDescription sets the "description" field.
func (u *EventUpsertOne) SetDescription(v string) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetDescription(v)
	})
}

// UpdateDescription sets the "description" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateDescription() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateDescription()
	})
}

// ClearDescription clears the value of the "description" field.
func (u *EventUpsertOne) ClearDescription() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.ClearDescription()
	})
}

// SetLocation sets the "location" field.
func (u *EventUpsertOne) SetLocation(v string) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetLocation(v)
	})
}

// UpdateLocation sets the "location" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateLocation() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateLocation()
	})
}

// ClearLocation clears the value of the "location" field.
func (u *EventUpsertOne) ClearLocation() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.ClearLocation()
	})
}

// SetURL sets the "url" field.
func (u *EventUpsertOne) SetURL(v string) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetURL(v)
	})
}

// UpdateURL sets the "url" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateURL() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateURL()
	})
}

// ClearURL clears the value of the "url" field.
func (u *EventUpsertOne) ClearURL() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.ClearURL()
	})
}

// SetMeetingURL sets the "meeting_url" field.
func (u *EventUpsertOne) SetMeetingURL(v string) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetMeetingURL(v)
	})
}

// UpdateMeetingURL sets the "meeting_url" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateMeetingURL() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateMeetingURL()
	})
}

// ClearMeetingURL clears the value of the "meeting_url" field.
func (u *EventUpsertOne) ClearMeetingURL() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.ClearMeetingURL()
	})
}

// SetStatus sets the "status" field.
func (u *EventUpsertOne) SetStatus(v event.Status) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetStatus(v)
	})
}

// UpdateStatus sets the "status" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateStatus() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateStatus()
	})
}

// SetStart sets the "start" field.
func (u *EventUpsertOne) SetStart(v time.Time) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetStart(v)
	})
}

// UpdateStart sets the "start" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateStart() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateStart()
	})
}

// SetEnd sets the "end" field.
func (u *EventUpsertOne) SetEnd(v time.Time) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetEnd(v)
	})
}

// UpdateEnd sets the "end" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateEnd() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateEnd()
	})
}

// SetAllDay sets the "all_day" field.
func (u *EventUpsertOne) SetAllDay(v bool) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetAllDay(v)
	})
}

// UpdateAllDay sets the "all_day" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateAllDay() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateAllDay()
	})
}

// SetStartTz sets the "start_tz" field.
func (u *EventUpsertOne) SetStartTz(v string) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetStartTz(v)
	})
}

// UpdateStartTz sets the "start_tz" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateStartTz() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateStartTz()
	})
}

// ClearStartTz clears the value of the "start_tz" field.
func (u *EventUpsertOne) ClearStartTz() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.ClearStartTz()
	})
}

// SetEndTz sets the "end_tz" field.
func (u *EventUpsertOne) SetEndTz(v string) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetEndTz(v)
	})
}

// UpdateEndTz sets the "end_tz" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateEndTz() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateEndTz()
	})
}

// ClearEndTz clears the value of the "end_tz" field.
func (u *EventUpsertOne) ClearEndTz() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.ClearEndTz()
	})
}

// SetRecurrence sets the "recurrence" field.
func (u *EventUpsertOne) SetRecurrence(v map[string]interface{}) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetRecurrence(v)
	})
}

// UpdateRecurrence sets the "recurrence" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateRecurrence() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateRecurrence()
	})
}

// ClearRecurrence clears the value of the "recurrence" field.
func (u *EventUpsertOne) ClearRecurrence() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.ClearRecurrence()
	})
}

// SetRecurringID sets the "recurring_id" field.
func (u *EventUpsertOne) SetRecurringID(v string) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetRecurringID(v)
	})
}

// UpdateRecurringID sets the "recurring_id" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateRecurringID() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateRecurringID()
	})
}

// ClearRecurringID clears the value of the "recurring_id" field.
func (u *EventUpsertOne) ClearRecurringID() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.ClearRecurringID()
	})
}

// SetOriginalStart sets the "original_start" field.
func (u *EventUpsertOne) SetOriginalStart(v time.Time) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetOriginalStart(v)
	})
}

// UpdateOriginalStart sets the "original_start" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateOriginalStart() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateOriginalStart()
	})
}

// ClearOriginalStart clears the value of the "original_start" field.
func (u *EventUpsertOne) ClearOriginalStart() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.ClearOriginalStart()
	})
}

// SetOrganizer sets the "organizer" field.
func (u *EventUpsertOne) SetOrganizer(v map[string]interface{}) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetOrganizer(v)
	})
}

// UpdateOrganizer sets the "organizer" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateOrganizer() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateOrganizer()
	})
}

// ClearOrganizer clears the value of the "organizer" field.
func (u *EventUpsertOne) ClearOrganizer() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.ClearOrganizer()
	})
}

// SetAttendees sets the "attendees" field.
func (u *EventUpsertOne) SetAttendees(v []map[string]interface{}) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetAttendees(v)
	})
}

// UpdateAttendees sets the "attendees" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateAttendees() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateAttendees()
	})
}

// ClearAttendees clears the value of the "attendees" field.
func (u *EventUpsertOne) ClearAttendees() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.ClearAttendees()
	})
}

// SetReminders sets the "reminders" field.
func (u *EventUpsertOne) SetReminders(v []map[string]interface{}) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetReminders(v)
	})
}

// UpdateReminders sets the "reminders" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateReminders() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateReminders()
	})
}

// ClearReminders clears the value of the "reminders" field.
func (u *EventUpsertOne) ClearReminders() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.ClearReminders()
	})
}

// SetCategories sets the "categories" field.
func (u *EventUpsertOne) SetCategories(v []string) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetCategories(v)
	})
}

// UpdateCategories sets the "categories" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateCategories() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateCategories()
	})
}

// ClearCategories clears the value of the "categories" field.
func (u *EventUpsertOne) ClearCategories() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.ClearCategories()
	})
}

// SetTransparency sets the "transparency" field.
func (u *EventUpsertOne) SetTransparency(v string) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetTransparency(v)
	})
}

// UpdateTransparency sets the "transparency" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateTransparency() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateTransparency()
	})
}

// ClearTransparency clears the value of the "transparency" field.
func (u *EventUpsertOne) ClearTransparency() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.ClearTransparency()
	})
}

// SetVisibility sets the "visibility" field.
func (u *EventUpsertOne) SetVisibility(v string) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetVisibility(v)
	})
}

// UpdateVisibility sets the "visibility" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateVisibility() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateVisibility()
	})
}

// ClearVisibility clears the value of the "visibility" field.
func (u *EventUpsertOne) ClearVisibility() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.ClearVisibility()
	})
}

// SetRawIcs sets the "raw_ics" field.
func (u *EventUpsertOne) SetRawIcs(v string) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetRawIcs(v)
	})
}

// UpdateRawIcs sets the "raw_ics" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateRawIcs() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateRawIcs()
	})
}

// ClearRawIcs clears the value of the "raw_ics" field.
func (u *EventUpsertOne) ClearRawIcs() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.ClearRawIcs()
	})
}

// SetCreated sets the "created" field.
func (u *EventUpsertOne) SetCreated(v time.Time) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetCreated(v)
	})
}

// UpdateCreated sets the "created" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateCreated() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateCreated()
	})
}

// SetUpdated sets the "updated" field.
func (u *EventUpsertOne) SetUpdated(v time.Time) *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.SetUpdated(v)
	})
}

// UpdateUpdated sets the "updated" field to the value that was provided on create.
func (u *EventUpsertOne) UpdateUpdated() *EventUpsertOne {
	return u.Update(func(s *EventUpsert) {
		s.UpdateUpdated()
	})
}

// Exec executes the query.
func (u *EventUpsertOne) Exec(ctx context.Context) error {
	if len(u.create.conflict) == 0 {
		return errors.New("ent: missing options for EventCreate.OnConflict")
	}
	return u.create.Exec(ctx)
}

// ExecX is like Exec, but panics if an error occurs.
func (u *EventUpsertOne) 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 *EventUpsertOne) ID(ctx context.Context) (id string, err error) {
	if u.create.driver.Dialect() == dialect.MySQL {
		// In case of "ON CONFLICT", there is no way to get back non-numeric ID
		// fields from the database since MySQL does not support the RETURNING clause.
		return id, errors.New("ent: EventUpsertOne.ID is not supported by MySQL driver. Use EventUpsertOne.Exec instead")
	}
	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 *EventUpsertOne) IDX(ctx context.Context) string {
	id, err := u.ID(ctx)
	if err != nil {
		panic(err)
	}
	return id
}

// EventCreateBulk is the builder for creating many Event entities in bulk.
type EventCreateBulk struct {
	config
	err      error
	builders []*EventCreate
	conflict []sql.ConflictOption
}

// Save creates the Event entities in the database.
func (_c *EventCreateBulk) Save(ctx context.Context) ([]*Event, error) {
	if _c.err != nil {
		return nil, _c.err
	}
	specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
	nodes := make([]*Event, 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.(*EventMutation)
				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
				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 *EventCreateBulk) SaveX(ctx context.Context) []*Event {
	v, err := _c.Save(ctx)
	if err != nil {
		panic(err)
	}
	return v
}

// Exec executes the query.
func (_c *EventCreateBulk) Exec(ctx context.Context) error {
	_, err := _c.Save(ctx)
	return err
}

// ExecX is like Exec, but panics if an error occurs.
func (_c *EventCreateBulk) 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.Event.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.EventUpsert) {
//			SetUID(v+v).
//		}).
//		Exec(ctx)
func (_c *EventCreateBulk) OnConflict(opts ...sql.ConflictOption) *EventUpsertBulk {
	_c.conflict = opts
	return &EventUpsertBulk{
		create: _c,
	}
}

// OnConflictColumns calls `OnConflict` and configures the columns
// as conflict target. Using this option is equivalent to using:
//
//	client.Event.Create().
//		OnConflict(sql.ConflictColumns(columns...)).
//		Exec(ctx)
func (_c *EventCreateBulk) OnConflictColumns(columns ...string) *EventUpsertBulk {
	_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
	return &EventUpsertBulk{
		create: _c,
	}
}

// EventUpsertBulk is the builder for "upsert"-ing
// a bulk of Event nodes.
type EventUpsertBulk struct {
	create *EventCreateBulk
}

// UpdateNewValues updates the mutable fields using the new values that
// were set on create. Using this option is equivalent to using:
//
//	client.Event.Create().
//		OnConflict(
//			sql.ResolveWithNewValues(),
//			sql.ResolveWith(func(u *sql.UpdateSet) {
//				u.SetIgnore(event.FieldID)
//			}),
//		).
//		Exec(ctx)
func (u *EventUpsertBulk) UpdateNewValues() *EventUpsertBulk {
	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.ID(); exists {
				s.SetIgnore(event.FieldID)
			}
		}
	}))
	return u
}

// Ignore sets each column to itself in case of conflict.
// Using this option is equivalent to using:
//
//	client.Event.Create().
//		OnConflict(sql.ResolveWithIgnore()).
//		Exec(ctx)
func (u *EventUpsertBulk) Ignore() *EventUpsertBulk {
	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 *EventUpsertBulk) DoNothing() *EventUpsertBulk {
	u.create.conflict = append(u.create.conflict, sql.DoNothing())
	return u
}

// Update allows overriding fields `UPDATE` values. See the EventCreateBulk.OnConflict
// documentation for more info.
func (u *EventUpsertBulk) Update(set func(*EventUpsert)) *EventUpsertBulk {
	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
		set(&EventUpsert{UpdateSet: update})
	}))
	return u
}

// SetUID sets the "uid" field.
func (u *EventUpsertBulk) SetUID(v string) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetUID(v)
	})
}

// UpdateUID sets the "uid" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateUID() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateUID()
	})
}

// SetRemoteID sets the "remote_id" field.
func (u *EventUpsertBulk) SetRemoteID(v string) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetRemoteID(v)
	})
}

// UpdateRemoteID sets the "remote_id" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateRemoteID() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateRemoteID()
	})
}

// ClearRemoteID clears the value of the "remote_id" field.
func (u *EventUpsertBulk) ClearRemoteID() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.ClearRemoteID()
	})
}

// SetEtag sets the "etag" field.
func (u *EventUpsertBulk) SetEtag(v string) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetEtag(v)
	})
}

// UpdateEtag sets the "etag" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateEtag() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateEtag()
	})
}

// ClearEtag clears the value of the "etag" field.
func (u *EventUpsertBulk) ClearEtag() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.ClearEtag()
	})
}

// SetSummary sets the "summary" field.
func (u *EventUpsertBulk) SetSummary(v string) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetSummary(v)
	})
}

// UpdateSummary sets the "summary" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateSummary() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateSummary()
	})
}

// SetDescription sets the "description" field.
func (u *EventUpsertBulk) SetDescription(v string) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetDescription(v)
	})
}

// UpdateDescription sets the "description" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateDescription() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateDescription()
	})
}

// ClearDescription clears the value of the "description" field.
func (u *EventUpsertBulk) ClearDescription() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.ClearDescription()
	})
}

// SetLocation sets the "location" field.
func (u *EventUpsertBulk) SetLocation(v string) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetLocation(v)
	})
}

// UpdateLocation sets the "location" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateLocation() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateLocation()
	})
}

// ClearLocation clears the value of the "location" field.
func (u *EventUpsertBulk) ClearLocation() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.ClearLocation()
	})
}

// SetURL sets the "url" field.
func (u *EventUpsertBulk) SetURL(v string) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetURL(v)
	})
}

// UpdateURL sets the "url" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateURL() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateURL()
	})
}

// ClearURL clears the value of the "url" field.
func (u *EventUpsertBulk) ClearURL() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.ClearURL()
	})
}

// SetMeetingURL sets the "meeting_url" field.
func (u *EventUpsertBulk) SetMeetingURL(v string) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetMeetingURL(v)
	})
}

// UpdateMeetingURL sets the "meeting_url" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateMeetingURL() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateMeetingURL()
	})
}

// ClearMeetingURL clears the value of the "meeting_url" field.
func (u *EventUpsertBulk) ClearMeetingURL() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.ClearMeetingURL()
	})
}

// SetStatus sets the "status" field.
func (u *EventUpsertBulk) SetStatus(v event.Status) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetStatus(v)
	})
}

// UpdateStatus sets the "status" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateStatus() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateStatus()
	})
}

// SetStart sets the "start" field.
func (u *EventUpsertBulk) SetStart(v time.Time) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetStart(v)
	})
}

// UpdateStart sets the "start" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateStart() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateStart()
	})
}

// SetEnd sets the "end" field.
func (u *EventUpsertBulk) SetEnd(v time.Time) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetEnd(v)
	})
}

// UpdateEnd sets the "end" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateEnd() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateEnd()
	})
}

// SetAllDay sets the "all_day" field.
func (u *EventUpsertBulk) SetAllDay(v bool) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetAllDay(v)
	})
}

// UpdateAllDay sets the "all_day" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateAllDay() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateAllDay()
	})
}

// SetStartTz sets the "start_tz" field.
func (u *EventUpsertBulk) SetStartTz(v string) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetStartTz(v)
	})
}

// UpdateStartTz sets the "start_tz" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateStartTz() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateStartTz()
	})
}

// ClearStartTz clears the value of the "start_tz" field.
func (u *EventUpsertBulk) ClearStartTz() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.ClearStartTz()
	})
}

// SetEndTz sets the "end_tz" field.
func (u *EventUpsertBulk) SetEndTz(v string) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetEndTz(v)
	})
}

// UpdateEndTz sets the "end_tz" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateEndTz() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateEndTz()
	})
}

// ClearEndTz clears the value of the "end_tz" field.
func (u *EventUpsertBulk) ClearEndTz() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.ClearEndTz()
	})
}

// SetRecurrence sets the "recurrence" field.
func (u *EventUpsertBulk) SetRecurrence(v map[string]interface{}) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetRecurrence(v)
	})
}

// UpdateRecurrence sets the "recurrence" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateRecurrence() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateRecurrence()
	})
}

// ClearRecurrence clears the value of the "recurrence" field.
func (u *EventUpsertBulk) ClearRecurrence() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.ClearRecurrence()
	})
}

// SetRecurringID sets the "recurring_id" field.
func (u *EventUpsertBulk) SetRecurringID(v string) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetRecurringID(v)
	})
}

// UpdateRecurringID sets the "recurring_id" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateRecurringID() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateRecurringID()
	})
}

// ClearRecurringID clears the value of the "recurring_id" field.
func (u *EventUpsertBulk) ClearRecurringID() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.ClearRecurringID()
	})
}

// SetOriginalStart sets the "original_start" field.
func (u *EventUpsertBulk) SetOriginalStart(v time.Time) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetOriginalStart(v)
	})
}

// UpdateOriginalStart sets the "original_start" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateOriginalStart() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateOriginalStart()
	})
}

// ClearOriginalStart clears the value of the "original_start" field.
func (u *EventUpsertBulk) ClearOriginalStart() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.ClearOriginalStart()
	})
}

// SetOrganizer sets the "organizer" field.
func (u *EventUpsertBulk) SetOrganizer(v map[string]interface{}) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetOrganizer(v)
	})
}

// UpdateOrganizer sets the "organizer" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateOrganizer() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateOrganizer()
	})
}

// ClearOrganizer clears the value of the "organizer" field.
func (u *EventUpsertBulk) ClearOrganizer() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.ClearOrganizer()
	})
}

// SetAttendees sets the "attendees" field.
func (u *EventUpsertBulk) SetAttendees(v []map[string]interface{}) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetAttendees(v)
	})
}

// UpdateAttendees sets the "attendees" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateAttendees() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateAttendees()
	})
}

// ClearAttendees clears the value of the "attendees" field.
func (u *EventUpsertBulk) ClearAttendees() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.ClearAttendees()
	})
}

// SetReminders sets the "reminders" field.
func (u *EventUpsertBulk) SetReminders(v []map[string]interface{}) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetReminders(v)
	})
}

// UpdateReminders sets the "reminders" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateReminders() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateReminders()
	})
}

// ClearReminders clears the value of the "reminders" field.
func (u *EventUpsertBulk) ClearReminders() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.ClearReminders()
	})
}

// SetCategories sets the "categories" field.
func (u *EventUpsertBulk) SetCategories(v []string) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetCategories(v)
	})
}

// UpdateCategories sets the "categories" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateCategories() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateCategories()
	})
}

// ClearCategories clears the value of the "categories" field.
func (u *EventUpsertBulk) ClearCategories() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.ClearCategories()
	})
}

// SetTransparency sets the "transparency" field.
func (u *EventUpsertBulk) SetTransparency(v string) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetTransparency(v)
	})
}

// UpdateTransparency sets the "transparency" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateTransparency() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateTransparency()
	})
}

// ClearTransparency clears the value of the "transparency" field.
func (u *EventUpsertBulk) ClearTransparency() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.ClearTransparency()
	})
}

// SetVisibility sets the "visibility" field.
func (u *EventUpsertBulk) SetVisibility(v string) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetVisibility(v)
	})
}

// UpdateVisibility sets the "visibility" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateVisibility() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateVisibility()
	})
}

// ClearVisibility clears the value of the "visibility" field.
func (u *EventUpsertBulk) ClearVisibility() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.ClearVisibility()
	})
}

// SetRawIcs sets the "raw_ics" field.
func (u *EventUpsertBulk) SetRawIcs(v string) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetRawIcs(v)
	})
}

// UpdateRawIcs sets the "raw_ics" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateRawIcs() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateRawIcs()
	})
}

// ClearRawIcs clears the value of the "raw_ics" field.
func (u *EventUpsertBulk) ClearRawIcs() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.ClearRawIcs()
	})
}

// SetCreated sets the "created" field.
func (u *EventUpsertBulk) SetCreated(v time.Time) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetCreated(v)
	})
}

// UpdateCreated sets the "created" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateCreated() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateCreated()
	})
}

// SetUpdated sets the "updated" field.
func (u *EventUpsertBulk) SetUpdated(v time.Time) *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.SetUpdated(v)
	})
}

// UpdateUpdated sets the "updated" field to the value that was provided on create.
func (u *EventUpsertBulk) UpdateUpdated() *EventUpsertBulk {
	return u.Update(func(s *EventUpsert) {
		s.UpdateUpdated()
	})
}

// Exec executes the query.
func (u *EventUpsertBulk) 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 EventCreateBulk instead", i)
		}
	}
	if len(u.create.conflict) == 0 {
		return errors.New("ent: missing options for EventCreateBulk.OnConflict")
	}
	return u.create.Exec(ctx)
}

// ExecX is like Exec, but panics if an error occurs.
func (u *EventUpsertBulk) ExecX(ctx context.Context) {
	if err := u.create.Exec(ctx); err != nil {
		panic(err)
	}
}
