Skip to main content
Glama

Storyden

by Southclaws
Mozilla Public License 2.0
227
event_create.go55.9 kB
// 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/Southclaws/storyden/internal/ent/asset" "github.com/Southclaws/storyden/internal/ent/event" "github.com/Southclaws/storyden/internal/ent/eventparticipant" "github.com/Southclaws/storyden/internal/ent/post" "github.com/rs/xid" ) // EventCreate is the builder for creating a Event entity. type EventCreate struct { config mutation *EventMutation hooks []Hook conflict []sql.ConflictOption } // SetCreatedAt sets the "created_at" field. func (_c *EventCreate) SetCreatedAt(v time.Time) *EventCreate { _c.mutation.SetCreatedAt(v) return _c } // SetNillableCreatedAt sets the "created_at" field if the given value is not nil. func (_c *EventCreate) SetNillableCreatedAt(v *time.Time) *EventCreate { if v != nil { _c.SetCreatedAt(*v) } return _c } // SetUpdatedAt sets the "updated_at" field. func (_c *EventCreate) SetUpdatedAt(v time.Time) *EventCreate { _c.mutation.SetUpdatedAt(v) return _c } // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil. func (_c *EventCreate) SetNillableUpdatedAt(v *time.Time) *EventCreate { if v != nil { _c.SetUpdatedAt(*v) } return _c } // SetDeletedAt sets the "deleted_at" field. func (_c *EventCreate) SetDeletedAt(v time.Time) *EventCreate { _c.mutation.SetDeletedAt(v) return _c } // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil. func (_c *EventCreate) SetNillableDeletedAt(v *time.Time) *EventCreate { if v != nil { _c.SetDeletedAt(*v) } return _c } // SetIndexedAt sets the "indexed_at" field. func (_c *EventCreate) SetIndexedAt(v time.Time) *EventCreate { _c.mutation.SetIndexedAt(v) return _c } // SetNillableIndexedAt sets the "indexed_at" field if the given value is not nil. func (_c *EventCreate) SetNillableIndexedAt(v *time.Time) *EventCreate { if v != nil { _c.SetIndexedAt(*v) } return _c } // SetName sets the "name" field. func (_c *EventCreate) SetName(v string) *EventCreate { _c.mutation.SetName(v) return _c } // SetSlug sets the "slug" field. func (_c *EventCreate) SetSlug(v string) *EventCreate { _c.mutation.SetSlug(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 } // SetStartTime sets the "start_time" field. func (_c *EventCreate) SetStartTime(v time.Time) *EventCreate { _c.mutation.SetStartTime(v) return _c } // SetEndTime sets the "end_time" field. func (_c *EventCreate) SetEndTime(v time.Time) *EventCreate { _c.mutation.SetEndTime(v) return _c } // SetParticipationPolicy sets the "participation_policy" field. func (_c *EventCreate) SetParticipationPolicy(v string) *EventCreate { _c.mutation.SetParticipationPolicy(v) return _c } // SetVisibility sets the "visibility" field. func (_c *EventCreate) SetVisibility(v event.Visibility) *EventCreate { _c.mutation.SetVisibility(v) return _c } // SetNillableVisibility sets the "visibility" field if the given value is not nil. func (_c *EventCreate) SetNillableVisibility(v *event.Visibility) *EventCreate { if v != nil { _c.SetVisibility(*v) } return _c } // SetLocationType sets the "location_type" field. func (_c *EventCreate) SetLocationType(v string) *EventCreate { _c.mutation.SetLocationType(v) return _c } // SetNillableLocationType sets the "location_type" field if the given value is not nil. func (_c *EventCreate) SetNillableLocationType(v *string) *EventCreate { if v != nil { _c.SetLocationType(*v) } return _c } // SetLocationName sets the "location_name" field. func (_c *EventCreate) SetLocationName(v string) *EventCreate { _c.mutation.SetLocationName(v) return _c } // SetNillableLocationName sets the "location_name" field if the given value is not nil. func (_c *EventCreate) SetNillableLocationName(v *string) *EventCreate { if v != nil { _c.SetLocationName(*v) } return _c } // SetLocationAddress sets the "location_address" field. func (_c *EventCreate) SetLocationAddress(v string) *EventCreate { _c.mutation.SetLocationAddress(v) return _c } // SetNillableLocationAddress sets the "location_address" field if the given value is not nil. func (_c *EventCreate) SetNillableLocationAddress(v *string) *EventCreate { if v != nil { _c.SetLocationAddress(*v) } return _c } // SetLocationLatitude sets the "location_latitude" field. func (_c *EventCreate) SetLocationLatitude(v float64) *EventCreate { _c.mutation.SetLocationLatitude(v) return _c } // SetNillableLocationLatitude sets the "location_latitude" field if the given value is not nil. func (_c *EventCreate) SetNillableLocationLatitude(v *float64) *EventCreate { if v != nil { _c.SetLocationLatitude(*v) } return _c } // SetLocationLongitude sets the "location_longitude" field. func (_c *EventCreate) SetLocationLongitude(v float64) *EventCreate { _c.mutation.SetLocationLongitude(v) return _c } // SetNillableLocationLongitude sets the "location_longitude" field if the given value is not nil. func (_c *EventCreate) SetNillableLocationLongitude(v *float64) *EventCreate { if v != nil { _c.SetLocationLongitude(*v) } return _c } // SetLocationURL sets the "location_url" field. func (_c *EventCreate) SetLocationURL(v string) *EventCreate { _c.mutation.SetLocationURL(v) return _c } // SetNillableLocationURL sets the "location_url" field if the given value is not nil. func (_c *EventCreate) SetNillableLocationURL(v *string) *EventCreate { if v != nil { _c.SetLocationURL(*v) } return _c } // SetCapacity sets the "capacity" field. func (_c *EventCreate) SetCapacity(v int) *EventCreate { _c.mutation.SetCapacity(v) return _c } // SetNillableCapacity sets the "capacity" field if the given value is not nil. func (_c *EventCreate) SetNillableCapacity(v *int) *EventCreate { if v != nil { _c.SetCapacity(*v) } return _c } // SetMetadata sets the "metadata" field. func (_c *EventCreate) SetMetadata(v map[string]interface{}) *EventCreate { _c.mutation.SetMetadata(v) return _c } // SetID sets the "id" field. func (_c *EventCreate) SetID(v xid.ID) *EventCreate { _c.mutation.SetID(v) return _c } // SetNillableID sets the "id" field if the given value is not nil. func (_c *EventCreate) SetNillableID(v *xid.ID) *EventCreate { if v != nil { _c.SetID(*v) } return _c } // AddParticipantIDs adds the "participants" edge to the EventParticipant entity by IDs. func (_c *EventCreate) AddParticipantIDs(ids ...xid.ID) *EventCreate { _c.mutation.AddParticipantIDs(ids...) return _c } // AddParticipants adds the "participants" edges to the EventParticipant entity. func (_c *EventCreate) AddParticipants(v ...*EventParticipant) *EventCreate { ids := make([]xid.ID, len(v)) for i := range v { ids[i] = v[i].ID } return _c.AddParticipantIDs(ids...) } // SetThreadID sets the "thread" edge to the Post entity by ID. func (_c *EventCreate) SetThreadID(id xid.ID) *EventCreate { _c.mutation.SetThreadID(id) return _c } // SetThread sets the "thread" edge to the Post entity. func (_c *EventCreate) SetThread(v *Post) *EventCreate { return _c.SetThreadID(v.ID) } // SetPrimaryImageID sets the "primary_image" edge to the Asset entity by ID. func (_c *EventCreate) SetPrimaryImageID(id xid.ID) *EventCreate { _c.mutation.SetPrimaryImageID(id) return _c } // SetNillablePrimaryImageID sets the "primary_image" edge to the Asset entity by ID if the given value is not nil. func (_c *EventCreate) SetNillablePrimaryImageID(id *xid.ID) *EventCreate { if id != nil { _c = _c.SetPrimaryImageID(*id) } return _c } // SetPrimaryImage sets the "primary_image" edge to the Asset entity. func (_c *EventCreate) SetPrimaryImage(v *Asset) *EventCreate { return _c.SetPrimaryImageID(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.CreatedAt(); !ok { v := event.DefaultCreatedAt() _c.mutation.SetCreatedAt(v) } if _, ok := _c.mutation.UpdatedAt(); !ok { v := event.DefaultUpdatedAt() _c.mutation.SetUpdatedAt(v) } if _, ok := _c.mutation.Visibility(); !ok { v := event.DefaultVisibility _c.mutation.SetVisibility(v) } if _, ok := _c.mutation.ID(); !ok { v := event.DefaultID() _c.mutation.SetID(v) } } // check runs all checks and user-defined validators on the builder. func (_c *EventCreate) check() error { if _, ok := _c.mutation.CreatedAt(); !ok { return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Event.created_at"`)} } if _, ok := _c.mutation.UpdatedAt(); !ok { return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Event.updated_at"`)} } if _, ok := _c.mutation.Name(); !ok { return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "Event.name"`)} } if _, ok := _c.mutation.Slug(); !ok { return &ValidationError{Name: "slug", err: errors.New(`ent: missing required field "Event.slug"`)} } if _, ok := _c.mutation.StartTime(); !ok { return &ValidationError{Name: "start_time", err: errors.New(`ent: missing required field "Event.start_time"`)} } if _, ok := _c.mutation.EndTime(); !ok { return &ValidationError{Name: "end_time", err: errors.New(`ent: missing required field "Event.end_time"`)} } if _, ok := _c.mutation.ParticipationPolicy(); !ok { return &ValidationError{Name: "participation_policy", err: errors.New(`ent: missing required field "Event.participation_policy"`)} } if _, ok := _c.mutation.Visibility(); !ok { return &ValidationError{Name: "visibility", err: errors.New(`ent: missing required field "Event.visibility"`)} } if v, ok := _c.mutation.Visibility(); ok { if err := event.VisibilityValidator(v); err != nil { return &ValidationError{Name: "visibility", err: fmt.Errorf(`ent: validator failed for field "Event.visibility": %w`, err)} } } if v, ok := _c.mutation.ID(); ok { if err := event.IDValidator(v.String()); err != nil { return &ValidationError{Name: "id", err: fmt.Errorf(`ent: validator failed for field "Event.id": %w`, err)} } } if len(_c.mutation.ThreadIDs()) == 0 { return &ValidationError{Name: "thread", err: errors.New(`ent: missing required edge "Event.thread"`)} } 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.(*xid.ID); ok { _node.ID = *id } else if err := _node.ID.Scan(_spec.ID.Value); err != nil { return nil, err } } _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.CreatedAt(); ok { _spec.SetField(event.FieldCreatedAt, field.TypeTime, value) _node.CreatedAt = value } if value, ok := _c.mutation.UpdatedAt(); ok { _spec.SetField(event.FieldUpdatedAt, field.TypeTime, value) _node.UpdatedAt = value } if value, ok := _c.mutation.DeletedAt(); ok { _spec.SetField(event.FieldDeletedAt, field.TypeTime, value) _node.DeletedAt = &value } if value, ok := _c.mutation.IndexedAt(); ok { _spec.SetField(event.FieldIndexedAt, field.TypeTime, value) _node.IndexedAt = &value } if value, ok := _c.mutation.Name(); ok { _spec.SetField(event.FieldName, field.TypeString, value) _node.Name = value } if value, ok := _c.mutation.Slug(); ok { _spec.SetField(event.FieldSlug, field.TypeString, value) _node.Slug = value } if value, ok := _c.mutation.Description(); ok { _spec.SetField(event.FieldDescription, field.TypeString, value) _node.Description = &value } if value, ok := _c.mutation.StartTime(); ok { _spec.SetField(event.FieldStartTime, field.TypeTime, value) _node.StartTime = value } if value, ok := _c.mutation.EndTime(); ok { _spec.SetField(event.FieldEndTime, field.TypeTime, value) _node.EndTime = value } if value, ok := _c.mutation.ParticipationPolicy(); ok { _spec.SetField(event.FieldParticipationPolicy, field.TypeString, value) _node.ParticipationPolicy = value } if value, ok := _c.mutation.Visibility(); ok { _spec.SetField(event.FieldVisibility, field.TypeEnum, value) _node.Visibility = value } if value, ok := _c.mutation.LocationType(); ok { _spec.SetField(event.FieldLocationType, field.TypeString, value) _node.LocationType = &value } if value, ok := _c.mutation.LocationName(); ok { _spec.SetField(event.FieldLocationName, field.TypeString, value) _node.LocationName = &value } if value, ok := _c.mutation.LocationAddress(); ok { _spec.SetField(event.FieldLocationAddress, field.TypeString, value) _node.LocationAddress = &value } if value, ok := _c.mutation.LocationLatitude(); ok { _spec.SetField(event.FieldLocationLatitude, field.TypeFloat64, value) _node.LocationLatitude = &value } if value, ok := _c.mutation.LocationLongitude(); ok { _spec.SetField(event.FieldLocationLongitude, field.TypeFloat64, value) _node.LocationLongitude = &value } if value, ok := _c.mutation.LocationURL(); ok { _spec.SetField(event.FieldLocationURL, field.TypeString, value) _node.LocationURL = &value } if value, ok := _c.mutation.Capacity(); ok { _spec.SetField(event.FieldCapacity, field.TypeInt, value) _node.Capacity = &value } if value, ok := _c.mutation.Metadata(); ok { _spec.SetField(event.FieldMetadata, field.TypeJSON, value) _node.Metadata = value } if nodes := _c.mutation.ParticipantsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: event.ParticipantsTable, Columns: []string{event.ParticipantsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(eventparticipant.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges = append(_spec.Edges, edge) } if nodes := _c.mutation.ThreadIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: event.ThreadTable, Columns: []string{event.ThreadColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(post.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _node.post_event = &nodes[0] _spec.Edges = append(_spec.Edges, edge) } if nodes := _c.mutation.PrimaryImageIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: event.PrimaryImageTable, Columns: []string{event.PrimaryImageColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(asset.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _node.asset_event = &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(). // SetCreatedAt(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) { // SetCreatedAt(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 } ) // SetUpdatedAt sets the "updated_at" field. func (u *EventUpsert) SetUpdatedAt(v time.Time) *EventUpsert { u.Set(event.FieldUpdatedAt, v) return u } // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create. func (u *EventUpsert) UpdateUpdatedAt() *EventUpsert { u.SetExcluded(event.FieldUpdatedAt) return u } // SetDeletedAt sets the "deleted_at" field. func (u *EventUpsert) SetDeletedAt(v time.Time) *EventUpsert { u.Set(event.FieldDeletedAt, v) return u } // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create. func (u *EventUpsert) UpdateDeletedAt() *EventUpsert { u.SetExcluded(event.FieldDeletedAt) return u } // ClearDeletedAt clears the value of the "deleted_at" field. func (u *EventUpsert) ClearDeletedAt() *EventUpsert { u.SetNull(event.FieldDeletedAt) return u } // SetIndexedAt sets the "indexed_at" field. func (u *EventUpsert) SetIndexedAt(v time.Time) *EventUpsert { u.Set(event.FieldIndexedAt, v) return u } // UpdateIndexedAt sets the "indexed_at" field to the value that was provided on create. func (u *EventUpsert) UpdateIndexedAt() *EventUpsert { u.SetExcluded(event.FieldIndexedAt) return u } // ClearIndexedAt clears the value of the "indexed_at" field. func (u *EventUpsert) ClearIndexedAt() *EventUpsert { u.SetNull(event.FieldIndexedAt) return u } // SetName sets the "name" field. func (u *EventUpsert) SetName(v string) *EventUpsert { u.Set(event.FieldName, v) return u } // UpdateName sets the "name" field to the value that was provided on create. func (u *EventUpsert) UpdateName() *EventUpsert { u.SetExcluded(event.FieldName) return u } // SetSlug sets the "slug" field. func (u *EventUpsert) SetSlug(v string) *EventUpsert { u.Set(event.FieldSlug, v) return u } // UpdateSlug sets the "slug" field to the value that was provided on create. func (u *EventUpsert) UpdateSlug() *EventUpsert { u.SetExcluded(event.FieldSlug) 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 } // SetStartTime sets the "start_time" field. func (u *EventUpsert) SetStartTime(v time.Time) *EventUpsert { u.Set(event.FieldStartTime, v) return u } // UpdateStartTime sets the "start_time" field to the value that was provided on create. func (u *EventUpsert) UpdateStartTime() *EventUpsert { u.SetExcluded(event.FieldStartTime) return u } // SetEndTime sets the "end_time" field. func (u *EventUpsert) SetEndTime(v time.Time) *EventUpsert { u.Set(event.FieldEndTime, v) return u } // UpdateEndTime sets the "end_time" field to the value that was provided on create. func (u *EventUpsert) UpdateEndTime() *EventUpsert { u.SetExcluded(event.FieldEndTime) return u } // SetParticipationPolicy sets the "participation_policy" field. func (u *EventUpsert) SetParticipationPolicy(v string) *EventUpsert { u.Set(event.FieldParticipationPolicy, v) return u } // UpdateParticipationPolicy sets the "participation_policy" field to the value that was provided on create. func (u *EventUpsert) UpdateParticipationPolicy() *EventUpsert { u.SetExcluded(event.FieldParticipationPolicy) return u } // SetVisibility sets the "visibility" field. func (u *EventUpsert) SetVisibility(v event.Visibility) *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 } // SetLocationType sets the "location_type" field. func (u *EventUpsert) SetLocationType(v string) *EventUpsert { u.Set(event.FieldLocationType, v) return u } // UpdateLocationType sets the "location_type" field to the value that was provided on create. func (u *EventUpsert) UpdateLocationType() *EventUpsert { u.SetExcluded(event.FieldLocationType) return u } // ClearLocationType clears the value of the "location_type" field. func (u *EventUpsert) ClearLocationType() *EventUpsert { u.SetNull(event.FieldLocationType) return u } // SetLocationName sets the "location_name" field. func (u *EventUpsert) SetLocationName(v string) *EventUpsert { u.Set(event.FieldLocationName, v) return u } // UpdateLocationName sets the "location_name" field to the value that was provided on create. func (u *EventUpsert) UpdateLocationName() *EventUpsert { u.SetExcluded(event.FieldLocationName) return u } // ClearLocationName clears the value of the "location_name" field. func (u *EventUpsert) ClearLocationName() *EventUpsert { u.SetNull(event.FieldLocationName) return u } // SetLocationAddress sets the "location_address" field. func (u *EventUpsert) SetLocationAddress(v string) *EventUpsert { u.Set(event.FieldLocationAddress, v) return u } // UpdateLocationAddress sets the "location_address" field to the value that was provided on create. func (u *EventUpsert) UpdateLocationAddress() *EventUpsert { u.SetExcluded(event.FieldLocationAddress) return u } // ClearLocationAddress clears the value of the "location_address" field. func (u *EventUpsert) ClearLocationAddress() *EventUpsert { u.SetNull(event.FieldLocationAddress) return u } // SetLocationLatitude sets the "location_latitude" field. func (u *EventUpsert) SetLocationLatitude(v float64) *EventUpsert { u.Set(event.FieldLocationLatitude, v) return u } // UpdateLocationLatitude sets the "location_latitude" field to the value that was provided on create. func (u *EventUpsert) UpdateLocationLatitude() *EventUpsert { u.SetExcluded(event.FieldLocationLatitude) return u } // AddLocationLatitude adds v to the "location_latitude" field. func (u *EventUpsert) AddLocationLatitude(v float64) *EventUpsert { u.Add(event.FieldLocationLatitude, v) return u } // ClearLocationLatitude clears the value of the "location_latitude" field. func (u *EventUpsert) ClearLocationLatitude() *EventUpsert { u.SetNull(event.FieldLocationLatitude) return u } // SetLocationLongitude sets the "location_longitude" field. func (u *EventUpsert) SetLocationLongitude(v float64) *EventUpsert { u.Set(event.FieldLocationLongitude, v) return u } // UpdateLocationLongitude sets the "location_longitude" field to the value that was provided on create. func (u *EventUpsert) UpdateLocationLongitude() *EventUpsert { u.SetExcluded(event.FieldLocationLongitude) return u } // AddLocationLongitude adds v to the "location_longitude" field. func (u *EventUpsert) AddLocationLongitude(v float64) *EventUpsert { u.Add(event.FieldLocationLongitude, v) return u } // ClearLocationLongitude clears the value of the "location_longitude" field. func (u *EventUpsert) ClearLocationLongitude() *EventUpsert { u.SetNull(event.FieldLocationLongitude) return u } // SetLocationURL sets the "location_url" field. func (u *EventUpsert) SetLocationURL(v string) *EventUpsert { u.Set(event.FieldLocationURL, v) return u } // UpdateLocationURL sets the "location_url" field to the value that was provided on create. func (u *EventUpsert) UpdateLocationURL() *EventUpsert { u.SetExcluded(event.FieldLocationURL) return u } // ClearLocationURL clears the value of the "location_url" field. func (u *EventUpsert) ClearLocationURL() *EventUpsert { u.SetNull(event.FieldLocationURL) return u } // SetCapacity sets the "capacity" field. func (u *EventUpsert) SetCapacity(v int) *EventUpsert { u.Set(event.FieldCapacity, v) return u } // UpdateCapacity sets the "capacity" field to the value that was provided on create. func (u *EventUpsert) UpdateCapacity() *EventUpsert { u.SetExcluded(event.FieldCapacity) return u } // AddCapacity adds v to the "capacity" field. func (u *EventUpsert) AddCapacity(v int) *EventUpsert { u.Add(event.FieldCapacity, v) return u } // ClearCapacity clears the value of the "capacity" field. func (u *EventUpsert) ClearCapacity() *EventUpsert { u.SetNull(event.FieldCapacity) return u } // SetMetadata sets the "metadata" field. func (u *EventUpsert) SetMetadata(v map[string]interface{}) *EventUpsert { u.Set(event.FieldMetadata, v) return u } // UpdateMetadata sets the "metadata" field to the value that was provided on create. func (u *EventUpsert) UpdateMetadata() *EventUpsert { u.SetExcluded(event.FieldMetadata) return u } // ClearMetadata clears the value of the "metadata" field. func (u *EventUpsert) ClearMetadata() *EventUpsert { u.SetNull(event.FieldMetadata) 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) } if _, exists := u.create.mutation.CreatedAt(); exists { s.SetIgnore(event.FieldCreatedAt) } })) 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 } // SetUpdatedAt sets the "updated_at" field. func (u *EventUpsertOne) SetUpdatedAt(v time.Time) *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.SetUpdatedAt(v) }) } // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create. func (u *EventUpsertOne) UpdateUpdatedAt() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.UpdateUpdatedAt() }) } // SetDeletedAt sets the "deleted_at" field. func (u *EventUpsertOne) SetDeletedAt(v time.Time) *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.SetDeletedAt(v) }) } // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create. func (u *EventUpsertOne) UpdateDeletedAt() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.UpdateDeletedAt() }) } // ClearDeletedAt clears the value of the "deleted_at" field. func (u *EventUpsertOne) ClearDeletedAt() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.ClearDeletedAt() }) } // SetIndexedAt sets the "indexed_at" field. func (u *EventUpsertOne) SetIndexedAt(v time.Time) *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.SetIndexedAt(v) }) } // UpdateIndexedAt sets the "indexed_at" field to the value that was provided on create. func (u *EventUpsertOne) UpdateIndexedAt() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.UpdateIndexedAt() }) } // ClearIndexedAt clears the value of the "indexed_at" field. func (u *EventUpsertOne) ClearIndexedAt() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.ClearIndexedAt() }) } // SetName sets the "name" field. func (u *EventUpsertOne) SetName(v string) *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.SetName(v) }) } // UpdateName sets the "name" field to the value that was provided on create. func (u *EventUpsertOne) UpdateName() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.UpdateName() }) } // SetSlug sets the "slug" field. func (u *EventUpsertOne) SetSlug(v string) *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.SetSlug(v) }) } // UpdateSlug sets the "slug" field to the value that was provided on create. func (u *EventUpsertOne) UpdateSlug() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.UpdateSlug() }) } // 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() }) } // SetStartTime sets the "start_time" field. func (u *EventUpsertOne) SetStartTime(v time.Time) *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.SetStartTime(v) }) } // UpdateStartTime sets the "start_time" field to the value that was provided on create. func (u *EventUpsertOne) UpdateStartTime() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.UpdateStartTime() }) } // SetEndTime sets the "end_time" field. func (u *EventUpsertOne) SetEndTime(v time.Time) *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.SetEndTime(v) }) } // UpdateEndTime sets the "end_time" field to the value that was provided on create. func (u *EventUpsertOne) UpdateEndTime() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.UpdateEndTime() }) } // SetParticipationPolicy sets the "participation_policy" field. func (u *EventUpsertOne) SetParticipationPolicy(v string) *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.SetParticipationPolicy(v) }) } // UpdateParticipationPolicy sets the "participation_policy" field to the value that was provided on create. func (u *EventUpsertOne) UpdateParticipationPolicy() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.UpdateParticipationPolicy() }) } // SetVisibility sets the "visibility" field. func (u *EventUpsertOne) SetVisibility(v event.Visibility) *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() }) } // SetLocationType sets the "location_type" field. func (u *EventUpsertOne) SetLocationType(v string) *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.SetLocationType(v) }) } // UpdateLocationType sets the "location_type" field to the value that was provided on create. func (u *EventUpsertOne) UpdateLocationType() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.UpdateLocationType() }) } // ClearLocationType clears the value of the "location_type" field. func (u *EventUpsertOne) ClearLocationType() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.ClearLocationType() }) } // SetLocationName sets the "location_name" field. func (u *EventUpsertOne) SetLocationName(v string) *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.SetLocationName(v) }) } // UpdateLocationName sets the "location_name" field to the value that was provided on create. func (u *EventUpsertOne) UpdateLocationName() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.UpdateLocationName() }) } // ClearLocationName clears the value of the "location_name" field. func (u *EventUpsertOne) ClearLocationName() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.ClearLocationName() }) } // SetLocationAddress sets the "location_address" field. func (u *EventUpsertOne) SetLocationAddress(v string) *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.SetLocationAddress(v) }) } // UpdateLocationAddress sets the "location_address" field to the value that was provided on create. func (u *EventUpsertOne) UpdateLocationAddress() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.UpdateLocationAddress() }) } // ClearLocationAddress clears the value of the "location_address" field. func (u *EventUpsertOne) ClearLocationAddress() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.ClearLocationAddress() }) } // SetLocationLatitude sets the "location_latitude" field. func (u *EventUpsertOne) SetLocationLatitude(v float64) *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.SetLocationLatitude(v) }) } // AddLocationLatitude adds v to the "location_latitude" field. func (u *EventUpsertOne) AddLocationLatitude(v float64) *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.AddLocationLatitude(v) }) } // UpdateLocationLatitude sets the "location_latitude" field to the value that was provided on create. func (u *EventUpsertOne) UpdateLocationLatitude() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.UpdateLocationLatitude() }) } // ClearLocationLatitude clears the value of the "location_latitude" field. func (u *EventUpsertOne) ClearLocationLatitude() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.ClearLocationLatitude() }) } // SetLocationLongitude sets the "location_longitude" field. func (u *EventUpsertOne) SetLocationLongitude(v float64) *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.SetLocationLongitude(v) }) } // AddLocationLongitude adds v to the "location_longitude" field. func (u *EventUpsertOne) AddLocationLongitude(v float64) *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.AddLocationLongitude(v) }) } // UpdateLocationLongitude sets the "location_longitude" field to the value that was provided on create. func (u *EventUpsertOne) UpdateLocationLongitude() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.UpdateLocationLongitude() }) } // ClearLocationLongitude clears the value of the "location_longitude" field. func (u *EventUpsertOne) ClearLocationLongitude() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.ClearLocationLongitude() }) } // SetLocationURL sets the "location_url" field. func (u *EventUpsertOne) SetLocationURL(v string) *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.SetLocationURL(v) }) } // UpdateLocationURL sets the "location_url" field to the value that was provided on create. func (u *EventUpsertOne) UpdateLocationURL() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.UpdateLocationURL() }) } // ClearLocationURL clears the value of the "location_url" field. func (u *EventUpsertOne) ClearLocationURL() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.ClearLocationURL() }) } // SetCapacity sets the "capacity" field. func (u *EventUpsertOne) SetCapacity(v int) *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.SetCapacity(v) }) } // AddCapacity adds v to the "capacity" field. func (u *EventUpsertOne) AddCapacity(v int) *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.AddCapacity(v) }) } // UpdateCapacity sets the "capacity" field to the value that was provided on create. func (u *EventUpsertOne) UpdateCapacity() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.UpdateCapacity() }) } // ClearCapacity clears the value of the "capacity" field. func (u *EventUpsertOne) ClearCapacity() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.ClearCapacity() }) } // SetMetadata sets the "metadata" field. func (u *EventUpsertOne) SetMetadata(v map[string]interface{}) *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.SetMetadata(v) }) } // UpdateMetadata sets the "metadata" field to the value that was provided on create. func (u *EventUpsertOne) UpdateMetadata() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.UpdateMetadata() }) } // ClearMetadata clears the value of the "metadata" field. func (u *EventUpsertOne) ClearMetadata() *EventUpsertOne { return u.Update(func(s *EventUpsert) { s.ClearMetadata() }) } // 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 xid.ID, 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) xid.ID { 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) { // SetCreatedAt(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) } if _, exists := b.mutation.CreatedAt(); exists { s.SetIgnore(event.FieldCreatedAt) } } })) 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 } // SetUpdatedAt sets the "updated_at" field. func (u *EventUpsertBulk) SetUpdatedAt(v time.Time) *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.SetUpdatedAt(v) }) } // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create. func (u *EventUpsertBulk) UpdateUpdatedAt() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.UpdateUpdatedAt() }) } // SetDeletedAt sets the "deleted_at" field. func (u *EventUpsertBulk) SetDeletedAt(v time.Time) *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.SetDeletedAt(v) }) } // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create. func (u *EventUpsertBulk) UpdateDeletedAt() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.UpdateDeletedAt() }) } // ClearDeletedAt clears the value of the "deleted_at" field. func (u *EventUpsertBulk) ClearDeletedAt() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.ClearDeletedAt() }) } // SetIndexedAt sets the "indexed_at" field. func (u *EventUpsertBulk) SetIndexedAt(v time.Time) *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.SetIndexedAt(v) }) } // UpdateIndexedAt sets the "indexed_at" field to the value that was provided on create. func (u *EventUpsertBulk) UpdateIndexedAt() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.UpdateIndexedAt() }) } // ClearIndexedAt clears the value of the "indexed_at" field. func (u *EventUpsertBulk) ClearIndexedAt() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.ClearIndexedAt() }) } // SetName sets the "name" field. func (u *EventUpsertBulk) SetName(v string) *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.SetName(v) }) } // UpdateName sets the "name" field to the value that was provided on create. func (u *EventUpsertBulk) UpdateName() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.UpdateName() }) } // SetSlug sets the "slug" field. func (u *EventUpsertBulk) SetSlug(v string) *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.SetSlug(v) }) } // UpdateSlug sets the "slug" field to the value that was provided on create. func (u *EventUpsertBulk) UpdateSlug() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.UpdateSlug() }) } // 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() }) } // SetStartTime sets the "start_time" field. func (u *EventUpsertBulk) SetStartTime(v time.Time) *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.SetStartTime(v) }) } // UpdateStartTime sets the "start_time" field to the value that was provided on create. func (u *EventUpsertBulk) UpdateStartTime() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.UpdateStartTime() }) } // SetEndTime sets the "end_time" field. func (u *EventUpsertBulk) SetEndTime(v time.Time) *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.SetEndTime(v) }) } // UpdateEndTime sets the "end_time" field to the value that was provided on create. func (u *EventUpsertBulk) UpdateEndTime() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.UpdateEndTime() }) } // SetParticipationPolicy sets the "participation_policy" field. func (u *EventUpsertBulk) SetParticipationPolicy(v string) *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.SetParticipationPolicy(v) }) } // UpdateParticipationPolicy sets the "participation_policy" field to the value that was provided on create. func (u *EventUpsertBulk) UpdateParticipationPolicy() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.UpdateParticipationPolicy() }) } // SetVisibility sets the "visibility" field. func (u *EventUpsertBulk) SetVisibility(v event.Visibility) *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() }) } // SetLocationType sets the "location_type" field. func (u *EventUpsertBulk) SetLocationType(v string) *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.SetLocationType(v) }) } // UpdateLocationType sets the "location_type" field to the value that was provided on create. func (u *EventUpsertBulk) UpdateLocationType() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.UpdateLocationType() }) } // ClearLocationType clears the value of the "location_type" field. func (u *EventUpsertBulk) ClearLocationType() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.ClearLocationType() }) } // SetLocationName sets the "location_name" field. func (u *EventUpsertBulk) SetLocationName(v string) *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.SetLocationName(v) }) } // UpdateLocationName sets the "location_name" field to the value that was provided on create. func (u *EventUpsertBulk) UpdateLocationName() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.UpdateLocationName() }) } // ClearLocationName clears the value of the "location_name" field. func (u *EventUpsertBulk) ClearLocationName() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.ClearLocationName() }) } // SetLocationAddress sets the "location_address" field. func (u *EventUpsertBulk) SetLocationAddress(v string) *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.SetLocationAddress(v) }) } // UpdateLocationAddress sets the "location_address" field to the value that was provided on create. func (u *EventUpsertBulk) UpdateLocationAddress() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.UpdateLocationAddress() }) } // ClearLocationAddress clears the value of the "location_address" field. func (u *EventUpsertBulk) ClearLocationAddress() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.ClearLocationAddress() }) } // SetLocationLatitude sets the "location_latitude" field. func (u *EventUpsertBulk) SetLocationLatitude(v float64) *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.SetLocationLatitude(v) }) } // AddLocationLatitude adds v to the "location_latitude" field. func (u *EventUpsertBulk) AddLocationLatitude(v float64) *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.AddLocationLatitude(v) }) } // UpdateLocationLatitude sets the "location_latitude" field to the value that was provided on create. func (u *EventUpsertBulk) UpdateLocationLatitude() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.UpdateLocationLatitude() }) } // ClearLocationLatitude clears the value of the "location_latitude" field. func (u *EventUpsertBulk) ClearLocationLatitude() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.ClearLocationLatitude() }) } // SetLocationLongitude sets the "location_longitude" field. func (u *EventUpsertBulk) SetLocationLongitude(v float64) *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.SetLocationLongitude(v) }) } // AddLocationLongitude adds v to the "location_longitude" field. func (u *EventUpsertBulk) AddLocationLongitude(v float64) *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.AddLocationLongitude(v) }) } // UpdateLocationLongitude sets the "location_longitude" field to the value that was provided on create. func (u *EventUpsertBulk) UpdateLocationLongitude() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.UpdateLocationLongitude() }) } // ClearLocationLongitude clears the value of the "location_longitude" field. func (u *EventUpsertBulk) ClearLocationLongitude() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.ClearLocationLongitude() }) } // SetLocationURL sets the "location_url" field. func (u *EventUpsertBulk) SetLocationURL(v string) *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.SetLocationURL(v) }) } // UpdateLocationURL sets the "location_url" field to the value that was provided on create. func (u *EventUpsertBulk) UpdateLocationURL() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.UpdateLocationURL() }) } // ClearLocationURL clears the value of the "location_url" field. func (u *EventUpsertBulk) ClearLocationURL() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.ClearLocationURL() }) } // SetCapacity sets the "capacity" field. func (u *EventUpsertBulk) SetCapacity(v int) *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.SetCapacity(v) }) } // AddCapacity adds v to the "capacity" field. func (u *EventUpsertBulk) AddCapacity(v int) *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.AddCapacity(v) }) } // UpdateCapacity sets the "capacity" field to the value that was provided on create. func (u *EventUpsertBulk) UpdateCapacity() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.UpdateCapacity() }) } // ClearCapacity clears the value of the "capacity" field. func (u *EventUpsertBulk) ClearCapacity() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.ClearCapacity() }) } // SetMetadata sets the "metadata" field. func (u *EventUpsertBulk) SetMetadata(v map[string]interface{}) *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.SetMetadata(v) }) } // UpdateMetadata sets the "metadata" field to the value that was provided on create. func (u *EventUpsertBulk) UpdateMetadata() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.UpdateMetadata() }) } // ClearMetadata clears the value of the "metadata" field. func (u *EventUpsertBulk) ClearMetadata() *EventUpsertBulk { return u.Update(func(s *EventUpsert) { s.ClearMetadata() }) } // 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) } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Southclaws/storyden'

If you have feedback or need assistance with the MCP directory API, please join our Discord server