versia-go/ent/instancemetadata_create.go
2024-09-22 03:58:42 +02:00

1997 lines
67 KiB
Go

// 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/google/uuid"
"github.com/versia-pub/versia-go/ent/instancemetadata"
"github.com/versia-pub/versia-go/ent/user"
"github.com/versia-pub/versia-go/pkg/versia"
)
// InstanceMetadataCreate is the builder for creating a InstanceMetadata entity.
type InstanceMetadataCreate struct {
config
mutation *InstanceMetadataMutation
hooks []Hook
conflict []sql.ConflictOption
}
// SetIsRemote sets the "isRemote" field.
func (imc *InstanceMetadataCreate) SetIsRemote(b bool) *InstanceMetadataCreate {
imc.mutation.SetIsRemote(b)
return imc
}
// SetURI sets the "uri" field.
func (imc *InstanceMetadataCreate) SetURI(s string) *InstanceMetadataCreate {
imc.mutation.SetURI(s)
return imc
}
// SetExtensions sets the "extensions" field.
func (imc *InstanceMetadataCreate) SetExtensions(v versia.Extensions) *InstanceMetadataCreate {
imc.mutation.SetExtensions(v)
return imc
}
// SetCreatedAt sets the "created_at" field.
func (imc *InstanceMetadataCreate) SetCreatedAt(t time.Time) *InstanceMetadataCreate {
imc.mutation.SetCreatedAt(t)
return imc
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (imc *InstanceMetadataCreate) SetNillableCreatedAt(t *time.Time) *InstanceMetadataCreate {
if t != nil {
imc.SetCreatedAt(*t)
}
return imc
}
// SetUpdatedAt sets the "updated_at" field.
func (imc *InstanceMetadataCreate) SetUpdatedAt(t time.Time) *InstanceMetadataCreate {
imc.mutation.SetUpdatedAt(t)
return imc
}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (imc *InstanceMetadataCreate) SetNillableUpdatedAt(t *time.Time) *InstanceMetadataCreate {
if t != nil {
imc.SetUpdatedAt(*t)
}
return imc
}
// SetName sets the "name" field.
func (imc *InstanceMetadataCreate) SetName(s string) *InstanceMetadataCreate {
imc.mutation.SetName(s)
return imc
}
// SetDescription sets the "description" field.
func (imc *InstanceMetadataCreate) SetDescription(s string) *InstanceMetadataCreate {
imc.mutation.SetDescription(s)
return imc
}
// SetNillableDescription sets the "description" field if the given value is not nil.
func (imc *InstanceMetadataCreate) SetNillableDescription(s *string) *InstanceMetadataCreate {
if s != nil {
imc.SetDescription(*s)
}
return imc
}
// SetHost sets the "host" field.
func (imc *InstanceMetadataCreate) SetHost(s string) *InstanceMetadataCreate {
imc.mutation.SetHost(s)
return imc
}
// SetPublicKey sets the "publicKey" field.
func (imc *InstanceMetadataCreate) SetPublicKey(b []byte) *InstanceMetadataCreate {
imc.mutation.SetPublicKey(b)
return imc
}
// SetPublicKeyAlgorithm sets the "publicKeyAlgorithm" field.
func (imc *InstanceMetadataCreate) SetPublicKeyAlgorithm(s string) *InstanceMetadataCreate {
imc.mutation.SetPublicKeyAlgorithm(s)
return imc
}
// SetPrivateKey sets the "privateKey" field.
func (imc *InstanceMetadataCreate) SetPrivateKey(b []byte) *InstanceMetadataCreate {
imc.mutation.SetPrivateKey(b)
return imc
}
// SetSoftwareName sets the "softwareName" field.
func (imc *InstanceMetadataCreate) SetSoftwareName(s string) *InstanceMetadataCreate {
imc.mutation.SetSoftwareName(s)
return imc
}
// SetSoftwareVersion sets the "softwareVersion" field.
func (imc *InstanceMetadataCreate) SetSoftwareVersion(s string) *InstanceMetadataCreate {
imc.mutation.SetSoftwareVersion(s)
return imc
}
// SetSharedInboxURI sets the "sharedInboxURI" field.
func (imc *InstanceMetadataCreate) SetSharedInboxURI(s string) *InstanceMetadataCreate {
imc.mutation.SetSharedInboxURI(s)
return imc
}
// SetNillableSharedInboxURI sets the "sharedInboxURI" field if the given value is not nil.
func (imc *InstanceMetadataCreate) SetNillableSharedInboxURI(s *string) *InstanceMetadataCreate {
if s != nil {
imc.SetSharedInboxURI(*s)
}
return imc
}
// SetModeratorsURI sets the "moderatorsURI" field.
func (imc *InstanceMetadataCreate) SetModeratorsURI(s string) *InstanceMetadataCreate {
imc.mutation.SetModeratorsURI(s)
return imc
}
// SetNillableModeratorsURI sets the "moderatorsURI" field if the given value is not nil.
func (imc *InstanceMetadataCreate) SetNillableModeratorsURI(s *string) *InstanceMetadataCreate {
if s != nil {
imc.SetModeratorsURI(*s)
}
return imc
}
// SetAdminsURI sets the "adminsURI" field.
func (imc *InstanceMetadataCreate) SetAdminsURI(s string) *InstanceMetadataCreate {
imc.mutation.SetAdminsURI(s)
return imc
}
// SetNillableAdminsURI sets the "adminsURI" field if the given value is not nil.
func (imc *InstanceMetadataCreate) SetNillableAdminsURI(s *string) *InstanceMetadataCreate {
if s != nil {
imc.SetAdminsURI(*s)
}
return imc
}
// SetLogoEndpoint sets the "logoEndpoint" field.
func (imc *InstanceMetadataCreate) SetLogoEndpoint(s string) *InstanceMetadataCreate {
imc.mutation.SetLogoEndpoint(s)
return imc
}
// SetNillableLogoEndpoint sets the "logoEndpoint" field if the given value is not nil.
func (imc *InstanceMetadataCreate) SetNillableLogoEndpoint(s *string) *InstanceMetadataCreate {
if s != nil {
imc.SetLogoEndpoint(*s)
}
return imc
}
// SetLogoMimeType sets the "logoMimeType" field.
func (imc *InstanceMetadataCreate) SetLogoMimeType(s string) *InstanceMetadataCreate {
imc.mutation.SetLogoMimeType(s)
return imc
}
// SetNillableLogoMimeType sets the "logoMimeType" field if the given value is not nil.
func (imc *InstanceMetadataCreate) SetNillableLogoMimeType(s *string) *InstanceMetadataCreate {
if s != nil {
imc.SetLogoMimeType(*s)
}
return imc
}
// SetBannerEndpoint sets the "bannerEndpoint" field.
func (imc *InstanceMetadataCreate) SetBannerEndpoint(s string) *InstanceMetadataCreate {
imc.mutation.SetBannerEndpoint(s)
return imc
}
// SetNillableBannerEndpoint sets the "bannerEndpoint" field if the given value is not nil.
func (imc *InstanceMetadataCreate) SetNillableBannerEndpoint(s *string) *InstanceMetadataCreate {
if s != nil {
imc.SetBannerEndpoint(*s)
}
return imc
}
// SetBannerMimeType sets the "bannerMimeType" field.
func (imc *InstanceMetadataCreate) SetBannerMimeType(s string) *InstanceMetadataCreate {
imc.mutation.SetBannerMimeType(s)
return imc
}
// SetNillableBannerMimeType sets the "bannerMimeType" field if the given value is not nil.
func (imc *InstanceMetadataCreate) SetNillableBannerMimeType(s *string) *InstanceMetadataCreate {
if s != nil {
imc.SetBannerMimeType(*s)
}
return imc
}
// SetSupportedVersions sets the "supportedVersions" field.
func (imc *InstanceMetadataCreate) SetSupportedVersions(s []string) *InstanceMetadataCreate {
imc.mutation.SetSupportedVersions(s)
return imc
}
// SetSupportedExtensions sets the "supportedExtensions" field.
func (imc *InstanceMetadataCreate) SetSupportedExtensions(s []string) *InstanceMetadataCreate {
imc.mutation.SetSupportedExtensions(s)
return imc
}
// SetID sets the "id" field.
func (imc *InstanceMetadataCreate) SetID(u uuid.UUID) *InstanceMetadataCreate {
imc.mutation.SetID(u)
return imc
}
// SetNillableID sets the "id" field if the given value is not nil.
func (imc *InstanceMetadataCreate) SetNillableID(u *uuid.UUID) *InstanceMetadataCreate {
if u != nil {
imc.SetID(*u)
}
return imc
}
// AddUserIDs adds the "users" edge to the User entity by IDs.
func (imc *InstanceMetadataCreate) AddUserIDs(ids ...uuid.UUID) *InstanceMetadataCreate {
imc.mutation.AddUserIDs(ids...)
return imc
}
// AddUsers adds the "users" edges to the User entity.
func (imc *InstanceMetadataCreate) AddUsers(u ...*User) *InstanceMetadataCreate {
ids := make([]uuid.UUID, len(u))
for i := range u {
ids[i] = u[i].ID
}
return imc.AddUserIDs(ids...)
}
// AddModeratorIDs adds the "moderators" edge to the User entity by IDs.
func (imc *InstanceMetadataCreate) AddModeratorIDs(ids ...uuid.UUID) *InstanceMetadataCreate {
imc.mutation.AddModeratorIDs(ids...)
return imc
}
// AddModerators adds the "moderators" edges to the User entity.
func (imc *InstanceMetadataCreate) AddModerators(u ...*User) *InstanceMetadataCreate {
ids := make([]uuid.UUID, len(u))
for i := range u {
ids[i] = u[i].ID
}
return imc.AddModeratorIDs(ids...)
}
// AddAdminIDs adds the "admins" edge to the User entity by IDs.
func (imc *InstanceMetadataCreate) AddAdminIDs(ids ...uuid.UUID) *InstanceMetadataCreate {
imc.mutation.AddAdminIDs(ids...)
return imc
}
// AddAdmins adds the "admins" edges to the User entity.
func (imc *InstanceMetadataCreate) AddAdmins(u ...*User) *InstanceMetadataCreate {
ids := make([]uuid.UUID, len(u))
for i := range u {
ids[i] = u[i].ID
}
return imc.AddAdminIDs(ids...)
}
// Mutation returns the InstanceMetadataMutation object of the builder.
func (imc *InstanceMetadataCreate) Mutation() *InstanceMetadataMutation {
return imc.mutation
}
// Save creates the InstanceMetadata in the database.
func (imc *InstanceMetadataCreate) Save(ctx context.Context) (*InstanceMetadata, error) {
imc.defaults()
return withHooks(ctx, imc.sqlSave, imc.mutation, imc.hooks)
}
// SaveX calls Save and panics if Save returns an error.
func (imc *InstanceMetadataCreate) SaveX(ctx context.Context) *InstanceMetadata {
v, err := imc.Save(ctx)
if err != nil {
panic(err)
}
return v
}
// Exec executes the query.
func (imc *InstanceMetadataCreate) Exec(ctx context.Context) error {
_, err := imc.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (imc *InstanceMetadataCreate) ExecX(ctx context.Context) {
if err := imc.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
func (imc *InstanceMetadataCreate) defaults() {
if _, ok := imc.mutation.Extensions(); !ok {
v := instancemetadata.DefaultExtensions
imc.mutation.SetExtensions(v)
}
if _, ok := imc.mutation.CreatedAt(); !ok {
v := instancemetadata.DefaultCreatedAt()
imc.mutation.SetCreatedAt(v)
}
if _, ok := imc.mutation.UpdatedAt(); !ok {
v := instancemetadata.DefaultUpdatedAt()
imc.mutation.SetUpdatedAt(v)
}
if _, ok := imc.mutation.SupportedVersions(); !ok {
v := instancemetadata.DefaultSupportedVersions
imc.mutation.SetSupportedVersions(v)
}
if _, ok := imc.mutation.SupportedExtensions(); !ok {
v := instancemetadata.DefaultSupportedExtensions
imc.mutation.SetSupportedExtensions(v)
}
if _, ok := imc.mutation.ID(); !ok {
v := instancemetadata.DefaultID()
imc.mutation.SetID(v)
}
}
// check runs all checks and user-defined validators on the builder.
func (imc *InstanceMetadataCreate) check() error {
if _, ok := imc.mutation.IsRemote(); !ok {
return &ValidationError{Name: "isRemote", err: errors.New(`ent: missing required field "InstanceMetadata.isRemote"`)}
}
if _, ok := imc.mutation.URI(); !ok {
return &ValidationError{Name: "uri", err: errors.New(`ent: missing required field "InstanceMetadata.uri"`)}
}
if v, ok := imc.mutation.URI(); ok {
if err := instancemetadata.URIValidator(v); err != nil {
return &ValidationError{Name: "uri", err: fmt.Errorf(`ent: validator failed for field "InstanceMetadata.uri": %w`, err)}
}
}
if _, ok := imc.mutation.Extensions(); !ok {
return &ValidationError{Name: "extensions", err: errors.New(`ent: missing required field "InstanceMetadata.extensions"`)}
}
if _, ok := imc.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "InstanceMetadata.created_at"`)}
}
if _, ok := imc.mutation.UpdatedAt(); !ok {
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "InstanceMetadata.updated_at"`)}
}
if _, ok := imc.mutation.Name(); !ok {
return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "InstanceMetadata.name"`)}
}
if v, ok := imc.mutation.Name(); ok {
if err := instancemetadata.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "InstanceMetadata.name": %w`, err)}
}
}
if _, ok := imc.mutation.Host(); !ok {
return &ValidationError{Name: "host", err: errors.New(`ent: missing required field "InstanceMetadata.host"`)}
}
if v, ok := imc.mutation.Host(); ok {
if err := instancemetadata.HostValidator(v); err != nil {
return &ValidationError{Name: "host", err: fmt.Errorf(`ent: validator failed for field "InstanceMetadata.host": %w`, err)}
}
}
if _, ok := imc.mutation.PublicKey(); !ok {
return &ValidationError{Name: "publicKey", err: errors.New(`ent: missing required field "InstanceMetadata.publicKey"`)}
}
if _, ok := imc.mutation.PublicKeyAlgorithm(); !ok {
return &ValidationError{Name: "publicKeyAlgorithm", err: errors.New(`ent: missing required field "InstanceMetadata.publicKeyAlgorithm"`)}
}
if _, ok := imc.mutation.SoftwareName(); !ok {
return &ValidationError{Name: "softwareName", err: errors.New(`ent: missing required field "InstanceMetadata.softwareName"`)}
}
if v, ok := imc.mutation.SoftwareName(); ok {
if err := instancemetadata.SoftwareNameValidator(v); err != nil {
return &ValidationError{Name: "softwareName", err: fmt.Errorf(`ent: validator failed for field "InstanceMetadata.softwareName": %w`, err)}
}
}
if _, ok := imc.mutation.SoftwareVersion(); !ok {
return &ValidationError{Name: "softwareVersion", err: errors.New(`ent: missing required field "InstanceMetadata.softwareVersion"`)}
}
if v, ok := imc.mutation.SoftwareVersion(); ok {
if err := instancemetadata.SoftwareVersionValidator(v); err != nil {
return &ValidationError{Name: "softwareVersion", err: fmt.Errorf(`ent: validator failed for field "InstanceMetadata.softwareVersion": %w`, err)}
}
}
if v, ok := imc.mutation.SharedInboxURI(); ok {
if err := instancemetadata.SharedInboxURIValidator(v); err != nil {
return &ValidationError{Name: "sharedInboxURI", err: fmt.Errorf(`ent: validator failed for field "InstanceMetadata.sharedInboxURI": %w`, err)}
}
}
if v, ok := imc.mutation.ModeratorsURI(); ok {
if err := instancemetadata.ModeratorsURIValidator(v); err != nil {
return &ValidationError{Name: "moderatorsURI", err: fmt.Errorf(`ent: validator failed for field "InstanceMetadata.moderatorsURI": %w`, err)}
}
}
if v, ok := imc.mutation.AdminsURI(); ok {
if err := instancemetadata.AdminsURIValidator(v); err != nil {
return &ValidationError{Name: "adminsURI", err: fmt.Errorf(`ent: validator failed for field "InstanceMetadata.adminsURI": %w`, err)}
}
}
if v, ok := imc.mutation.LogoEndpoint(); ok {
if err := instancemetadata.LogoEndpointValidator(v); err != nil {
return &ValidationError{Name: "logoEndpoint", err: fmt.Errorf(`ent: validator failed for field "InstanceMetadata.logoEndpoint": %w`, err)}
}
}
if v, ok := imc.mutation.LogoMimeType(); ok {
if err := instancemetadata.LogoMimeTypeValidator(v); err != nil {
return &ValidationError{Name: "logoMimeType", err: fmt.Errorf(`ent: validator failed for field "InstanceMetadata.logoMimeType": %w`, err)}
}
}
if v, ok := imc.mutation.BannerEndpoint(); ok {
if err := instancemetadata.BannerEndpointValidator(v); err != nil {
return &ValidationError{Name: "bannerEndpoint", err: fmt.Errorf(`ent: validator failed for field "InstanceMetadata.bannerEndpoint": %w`, err)}
}
}
if v, ok := imc.mutation.BannerMimeType(); ok {
if err := instancemetadata.BannerMimeTypeValidator(v); err != nil {
return &ValidationError{Name: "bannerMimeType", err: fmt.Errorf(`ent: validator failed for field "InstanceMetadata.bannerMimeType": %w`, err)}
}
}
if _, ok := imc.mutation.SupportedVersions(); !ok {
return &ValidationError{Name: "supportedVersions", err: errors.New(`ent: missing required field "InstanceMetadata.supportedVersions"`)}
}
if _, ok := imc.mutation.SupportedExtensions(); !ok {
return &ValidationError{Name: "supportedExtensions", err: errors.New(`ent: missing required field "InstanceMetadata.supportedExtensions"`)}
}
return nil
}
func (imc *InstanceMetadataCreate) sqlSave(ctx context.Context) (*InstanceMetadata, error) {
if err := imc.check(); err != nil {
return nil, err
}
_node, _spec := imc.createSpec()
if err := sqlgraph.CreateNode(ctx, imc.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.(*uuid.UUID); ok {
_node.ID = *id
} else if err := _node.ID.Scan(_spec.ID.Value); err != nil {
return nil, err
}
}
imc.mutation.id = &_node.ID
imc.mutation.done = true
return _node, nil
}
func (imc *InstanceMetadataCreate) createSpec() (*InstanceMetadata, *sqlgraph.CreateSpec) {
var (
_node = &InstanceMetadata{config: imc.config}
_spec = sqlgraph.NewCreateSpec(instancemetadata.Table, sqlgraph.NewFieldSpec(instancemetadata.FieldID, field.TypeUUID))
)
_spec.OnConflict = imc.conflict
if id, ok := imc.mutation.ID(); ok {
_node.ID = id
_spec.ID.Value = &id
}
if value, ok := imc.mutation.IsRemote(); ok {
_spec.SetField(instancemetadata.FieldIsRemote, field.TypeBool, value)
_node.IsRemote = value
}
if value, ok := imc.mutation.URI(); ok {
_spec.SetField(instancemetadata.FieldURI, field.TypeString, value)
_node.URI = value
}
if value, ok := imc.mutation.Extensions(); ok {
_spec.SetField(instancemetadata.FieldExtensions, field.TypeJSON, value)
_node.Extensions = value
}
if value, ok := imc.mutation.CreatedAt(); ok {
_spec.SetField(instancemetadata.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
if value, ok := imc.mutation.UpdatedAt(); ok {
_spec.SetField(instancemetadata.FieldUpdatedAt, field.TypeTime, value)
_node.UpdatedAt = value
}
if value, ok := imc.mutation.Name(); ok {
_spec.SetField(instancemetadata.FieldName, field.TypeString, value)
_node.Name = value
}
if value, ok := imc.mutation.Description(); ok {
_spec.SetField(instancemetadata.FieldDescription, field.TypeString, value)
_node.Description = &value
}
if value, ok := imc.mutation.Host(); ok {
_spec.SetField(instancemetadata.FieldHost, field.TypeString, value)
_node.Host = value
}
if value, ok := imc.mutation.PublicKey(); ok {
_spec.SetField(instancemetadata.FieldPublicKey, field.TypeBytes, value)
_node.PublicKey = value
}
if value, ok := imc.mutation.PublicKeyAlgorithm(); ok {
_spec.SetField(instancemetadata.FieldPublicKeyAlgorithm, field.TypeString, value)
_node.PublicKeyAlgorithm = value
}
if value, ok := imc.mutation.PrivateKey(); ok {
_spec.SetField(instancemetadata.FieldPrivateKey, field.TypeBytes, value)
_node.PrivateKey = value
}
if value, ok := imc.mutation.SoftwareName(); ok {
_spec.SetField(instancemetadata.FieldSoftwareName, field.TypeString, value)
_node.SoftwareName = value
}
if value, ok := imc.mutation.SoftwareVersion(); ok {
_spec.SetField(instancemetadata.FieldSoftwareVersion, field.TypeString, value)
_node.SoftwareVersion = value
}
if value, ok := imc.mutation.SharedInboxURI(); ok {
_spec.SetField(instancemetadata.FieldSharedInboxURI, field.TypeString, value)
_node.SharedInboxURI = &value
}
if value, ok := imc.mutation.ModeratorsURI(); ok {
_spec.SetField(instancemetadata.FieldModeratorsURI, field.TypeString, value)
_node.ModeratorsURI = &value
}
if value, ok := imc.mutation.AdminsURI(); ok {
_spec.SetField(instancemetadata.FieldAdminsURI, field.TypeString, value)
_node.AdminsURI = &value
}
if value, ok := imc.mutation.LogoEndpoint(); ok {
_spec.SetField(instancemetadata.FieldLogoEndpoint, field.TypeString, value)
_node.LogoEndpoint = &value
}
if value, ok := imc.mutation.LogoMimeType(); ok {
_spec.SetField(instancemetadata.FieldLogoMimeType, field.TypeString, value)
_node.LogoMimeType = &value
}
if value, ok := imc.mutation.BannerEndpoint(); ok {
_spec.SetField(instancemetadata.FieldBannerEndpoint, field.TypeString, value)
_node.BannerEndpoint = &value
}
if value, ok := imc.mutation.BannerMimeType(); ok {
_spec.SetField(instancemetadata.FieldBannerMimeType, field.TypeString, value)
_node.BannerMimeType = &value
}
if value, ok := imc.mutation.SupportedVersions(); ok {
_spec.SetField(instancemetadata.FieldSupportedVersions, field.TypeJSON, value)
_node.SupportedVersions = value
}
if value, ok := imc.mutation.SupportedExtensions(); ok {
_spec.SetField(instancemetadata.FieldSupportedExtensions, field.TypeJSON, value)
_node.SupportedExtensions = value
}
if nodes := imc.mutation.UsersIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: false,
Table: instancemetadata.UsersTable,
Columns: instancemetadata.UsersPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges = append(_spec.Edges, edge)
}
if nodes := imc.mutation.ModeratorsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: false,
Table: instancemetadata.ModeratorsTable,
Columns: instancemetadata.ModeratorsPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges = append(_spec.Edges, edge)
}
if nodes := imc.mutation.AdminsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: false,
Table: instancemetadata.AdminsTable,
Columns: instancemetadata.AdminsPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_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.InstanceMetadata.Create().
// SetIsRemote(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.InstanceMetadataUpsert) {
// SetIsRemote(v+v).
// }).
// Exec(ctx)
func (imc *InstanceMetadataCreate) OnConflict(opts ...sql.ConflictOption) *InstanceMetadataUpsertOne {
imc.conflict = opts
return &InstanceMetadataUpsertOne{
create: imc,
}
}
// OnConflictColumns calls `OnConflict` and configures the columns
// as conflict target. Using this option is equivalent to using:
//
// client.InstanceMetadata.Create().
// OnConflict(sql.ConflictColumns(columns...)).
// Exec(ctx)
func (imc *InstanceMetadataCreate) OnConflictColumns(columns ...string) *InstanceMetadataUpsertOne {
imc.conflict = append(imc.conflict, sql.ConflictColumns(columns...))
return &InstanceMetadataUpsertOne{
create: imc,
}
}
type (
// InstanceMetadataUpsertOne is the builder for "upsert"-ing
// one InstanceMetadata node.
InstanceMetadataUpsertOne struct {
create *InstanceMetadataCreate
}
// InstanceMetadataUpsert is the "OnConflict" setter.
InstanceMetadataUpsert struct {
*sql.UpdateSet
}
)
// SetIsRemote sets the "isRemote" field.
func (u *InstanceMetadataUpsert) SetIsRemote(v bool) *InstanceMetadataUpsert {
u.Set(instancemetadata.FieldIsRemote, v)
return u
}
// UpdateIsRemote sets the "isRemote" field to the value that was provided on create.
func (u *InstanceMetadataUpsert) UpdateIsRemote() *InstanceMetadataUpsert {
u.SetExcluded(instancemetadata.FieldIsRemote)
return u
}
// SetURI sets the "uri" field.
func (u *InstanceMetadataUpsert) SetURI(v string) *InstanceMetadataUpsert {
u.Set(instancemetadata.FieldURI, v)
return u
}
// UpdateURI sets the "uri" field to the value that was provided on create.
func (u *InstanceMetadataUpsert) UpdateURI() *InstanceMetadataUpsert {
u.SetExcluded(instancemetadata.FieldURI)
return u
}
// SetExtensions sets the "extensions" field.
func (u *InstanceMetadataUpsert) SetExtensions(v versia.Extensions) *InstanceMetadataUpsert {
u.Set(instancemetadata.FieldExtensions, v)
return u
}
// UpdateExtensions sets the "extensions" field to the value that was provided on create.
func (u *InstanceMetadataUpsert) UpdateExtensions() *InstanceMetadataUpsert {
u.SetExcluded(instancemetadata.FieldExtensions)
return u
}
// SetUpdatedAt sets the "updated_at" field.
func (u *InstanceMetadataUpsert) SetUpdatedAt(v time.Time) *InstanceMetadataUpsert {
u.Set(instancemetadata.FieldUpdatedAt, v)
return u
}
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
func (u *InstanceMetadataUpsert) UpdateUpdatedAt() *InstanceMetadataUpsert {
u.SetExcluded(instancemetadata.FieldUpdatedAt)
return u
}
// SetName sets the "name" field.
func (u *InstanceMetadataUpsert) SetName(v string) *InstanceMetadataUpsert {
u.Set(instancemetadata.FieldName, v)
return u
}
// UpdateName sets the "name" field to the value that was provided on create.
func (u *InstanceMetadataUpsert) UpdateName() *InstanceMetadataUpsert {
u.SetExcluded(instancemetadata.FieldName)
return u
}
// SetDescription sets the "description" field.
func (u *InstanceMetadataUpsert) SetDescription(v string) *InstanceMetadataUpsert {
u.Set(instancemetadata.FieldDescription, v)
return u
}
// UpdateDescription sets the "description" field to the value that was provided on create.
func (u *InstanceMetadataUpsert) UpdateDescription() *InstanceMetadataUpsert {
u.SetExcluded(instancemetadata.FieldDescription)
return u
}
// ClearDescription clears the value of the "description" field.
func (u *InstanceMetadataUpsert) ClearDescription() *InstanceMetadataUpsert {
u.SetNull(instancemetadata.FieldDescription)
return u
}
// SetHost sets the "host" field.
func (u *InstanceMetadataUpsert) SetHost(v string) *InstanceMetadataUpsert {
u.Set(instancemetadata.FieldHost, v)
return u
}
// UpdateHost sets the "host" field to the value that was provided on create.
func (u *InstanceMetadataUpsert) UpdateHost() *InstanceMetadataUpsert {
u.SetExcluded(instancemetadata.FieldHost)
return u
}
// SetPublicKey sets the "publicKey" field.
func (u *InstanceMetadataUpsert) SetPublicKey(v []byte) *InstanceMetadataUpsert {
u.Set(instancemetadata.FieldPublicKey, v)
return u
}
// UpdatePublicKey sets the "publicKey" field to the value that was provided on create.
func (u *InstanceMetadataUpsert) UpdatePublicKey() *InstanceMetadataUpsert {
u.SetExcluded(instancemetadata.FieldPublicKey)
return u
}
// SetPublicKeyAlgorithm sets the "publicKeyAlgorithm" field.
func (u *InstanceMetadataUpsert) SetPublicKeyAlgorithm(v string) *InstanceMetadataUpsert {
u.Set(instancemetadata.FieldPublicKeyAlgorithm, v)
return u
}
// UpdatePublicKeyAlgorithm sets the "publicKeyAlgorithm" field to the value that was provided on create.
func (u *InstanceMetadataUpsert) UpdatePublicKeyAlgorithm() *InstanceMetadataUpsert {
u.SetExcluded(instancemetadata.FieldPublicKeyAlgorithm)
return u
}
// SetPrivateKey sets the "privateKey" field.
func (u *InstanceMetadataUpsert) SetPrivateKey(v []byte) *InstanceMetadataUpsert {
u.Set(instancemetadata.FieldPrivateKey, v)
return u
}
// UpdatePrivateKey sets the "privateKey" field to the value that was provided on create.
func (u *InstanceMetadataUpsert) UpdatePrivateKey() *InstanceMetadataUpsert {
u.SetExcluded(instancemetadata.FieldPrivateKey)
return u
}
// ClearPrivateKey clears the value of the "privateKey" field.
func (u *InstanceMetadataUpsert) ClearPrivateKey() *InstanceMetadataUpsert {
u.SetNull(instancemetadata.FieldPrivateKey)
return u
}
// SetSoftwareName sets the "softwareName" field.
func (u *InstanceMetadataUpsert) SetSoftwareName(v string) *InstanceMetadataUpsert {
u.Set(instancemetadata.FieldSoftwareName, v)
return u
}
// UpdateSoftwareName sets the "softwareName" field to the value that was provided on create.
func (u *InstanceMetadataUpsert) UpdateSoftwareName() *InstanceMetadataUpsert {
u.SetExcluded(instancemetadata.FieldSoftwareName)
return u
}
// SetSoftwareVersion sets the "softwareVersion" field.
func (u *InstanceMetadataUpsert) SetSoftwareVersion(v string) *InstanceMetadataUpsert {
u.Set(instancemetadata.FieldSoftwareVersion, v)
return u
}
// UpdateSoftwareVersion sets the "softwareVersion" field to the value that was provided on create.
func (u *InstanceMetadataUpsert) UpdateSoftwareVersion() *InstanceMetadataUpsert {
u.SetExcluded(instancemetadata.FieldSoftwareVersion)
return u
}
// SetSharedInboxURI sets the "sharedInboxURI" field.
func (u *InstanceMetadataUpsert) SetSharedInboxURI(v string) *InstanceMetadataUpsert {
u.Set(instancemetadata.FieldSharedInboxURI, v)
return u
}
// UpdateSharedInboxURI sets the "sharedInboxURI" field to the value that was provided on create.
func (u *InstanceMetadataUpsert) UpdateSharedInboxURI() *InstanceMetadataUpsert {
u.SetExcluded(instancemetadata.FieldSharedInboxURI)
return u
}
// ClearSharedInboxURI clears the value of the "sharedInboxURI" field.
func (u *InstanceMetadataUpsert) ClearSharedInboxURI() *InstanceMetadataUpsert {
u.SetNull(instancemetadata.FieldSharedInboxURI)
return u
}
// SetModeratorsURI sets the "moderatorsURI" field.
func (u *InstanceMetadataUpsert) SetModeratorsURI(v string) *InstanceMetadataUpsert {
u.Set(instancemetadata.FieldModeratorsURI, v)
return u
}
// UpdateModeratorsURI sets the "moderatorsURI" field to the value that was provided on create.
func (u *InstanceMetadataUpsert) UpdateModeratorsURI() *InstanceMetadataUpsert {
u.SetExcluded(instancemetadata.FieldModeratorsURI)
return u
}
// ClearModeratorsURI clears the value of the "moderatorsURI" field.
func (u *InstanceMetadataUpsert) ClearModeratorsURI() *InstanceMetadataUpsert {
u.SetNull(instancemetadata.FieldModeratorsURI)
return u
}
// SetAdminsURI sets the "adminsURI" field.
func (u *InstanceMetadataUpsert) SetAdminsURI(v string) *InstanceMetadataUpsert {
u.Set(instancemetadata.FieldAdminsURI, v)
return u
}
// UpdateAdminsURI sets the "adminsURI" field to the value that was provided on create.
func (u *InstanceMetadataUpsert) UpdateAdminsURI() *InstanceMetadataUpsert {
u.SetExcluded(instancemetadata.FieldAdminsURI)
return u
}
// ClearAdminsURI clears the value of the "adminsURI" field.
func (u *InstanceMetadataUpsert) ClearAdminsURI() *InstanceMetadataUpsert {
u.SetNull(instancemetadata.FieldAdminsURI)
return u
}
// SetLogoEndpoint sets the "logoEndpoint" field.
func (u *InstanceMetadataUpsert) SetLogoEndpoint(v string) *InstanceMetadataUpsert {
u.Set(instancemetadata.FieldLogoEndpoint, v)
return u
}
// UpdateLogoEndpoint sets the "logoEndpoint" field to the value that was provided on create.
func (u *InstanceMetadataUpsert) UpdateLogoEndpoint() *InstanceMetadataUpsert {
u.SetExcluded(instancemetadata.FieldLogoEndpoint)
return u
}
// ClearLogoEndpoint clears the value of the "logoEndpoint" field.
func (u *InstanceMetadataUpsert) ClearLogoEndpoint() *InstanceMetadataUpsert {
u.SetNull(instancemetadata.FieldLogoEndpoint)
return u
}
// SetLogoMimeType sets the "logoMimeType" field.
func (u *InstanceMetadataUpsert) SetLogoMimeType(v string) *InstanceMetadataUpsert {
u.Set(instancemetadata.FieldLogoMimeType, v)
return u
}
// UpdateLogoMimeType sets the "logoMimeType" field to the value that was provided on create.
func (u *InstanceMetadataUpsert) UpdateLogoMimeType() *InstanceMetadataUpsert {
u.SetExcluded(instancemetadata.FieldLogoMimeType)
return u
}
// ClearLogoMimeType clears the value of the "logoMimeType" field.
func (u *InstanceMetadataUpsert) ClearLogoMimeType() *InstanceMetadataUpsert {
u.SetNull(instancemetadata.FieldLogoMimeType)
return u
}
// SetBannerEndpoint sets the "bannerEndpoint" field.
func (u *InstanceMetadataUpsert) SetBannerEndpoint(v string) *InstanceMetadataUpsert {
u.Set(instancemetadata.FieldBannerEndpoint, v)
return u
}
// UpdateBannerEndpoint sets the "bannerEndpoint" field to the value that was provided on create.
func (u *InstanceMetadataUpsert) UpdateBannerEndpoint() *InstanceMetadataUpsert {
u.SetExcluded(instancemetadata.FieldBannerEndpoint)
return u
}
// ClearBannerEndpoint clears the value of the "bannerEndpoint" field.
func (u *InstanceMetadataUpsert) ClearBannerEndpoint() *InstanceMetadataUpsert {
u.SetNull(instancemetadata.FieldBannerEndpoint)
return u
}
// SetBannerMimeType sets the "bannerMimeType" field.
func (u *InstanceMetadataUpsert) SetBannerMimeType(v string) *InstanceMetadataUpsert {
u.Set(instancemetadata.FieldBannerMimeType, v)
return u
}
// UpdateBannerMimeType sets the "bannerMimeType" field to the value that was provided on create.
func (u *InstanceMetadataUpsert) UpdateBannerMimeType() *InstanceMetadataUpsert {
u.SetExcluded(instancemetadata.FieldBannerMimeType)
return u
}
// ClearBannerMimeType clears the value of the "bannerMimeType" field.
func (u *InstanceMetadataUpsert) ClearBannerMimeType() *InstanceMetadataUpsert {
u.SetNull(instancemetadata.FieldBannerMimeType)
return u
}
// SetSupportedVersions sets the "supportedVersions" field.
func (u *InstanceMetadataUpsert) SetSupportedVersions(v []string) *InstanceMetadataUpsert {
u.Set(instancemetadata.FieldSupportedVersions, v)
return u
}
// UpdateSupportedVersions sets the "supportedVersions" field to the value that was provided on create.
func (u *InstanceMetadataUpsert) UpdateSupportedVersions() *InstanceMetadataUpsert {
u.SetExcluded(instancemetadata.FieldSupportedVersions)
return u
}
// SetSupportedExtensions sets the "supportedExtensions" field.
func (u *InstanceMetadataUpsert) SetSupportedExtensions(v []string) *InstanceMetadataUpsert {
u.Set(instancemetadata.FieldSupportedExtensions, v)
return u
}
// UpdateSupportedExtensions sets the "supportedExtensions" field to the value that was provided on create.
func (u *InstanceMetadataUpsert) UpdateSupportedExtensions() *InstanceMetadataUpsert {
u.SetExcluded(instancemetadata.FieldSupportedExtensions)
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.InstanceMetadata.Create().
// OnConflict(
// sql.ResolveWithNewValues(),
// sql.ResolveWith(func(u *sql.UpdateSet) {
// u.SetIgnore(instancemetadata.FieldID)
// }),
// ).
// Exec(ctx)
func (u *InstanceMetadataUpsertOne) UpdateNewValues() *InstanceMetadataUpsertOne {
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(instancemetadata.FieldID)
}
if _, exists := u.create.mutation.CreatedAt(); exists {
s.SetIgnore(instancemetadata.FieldCreatedAt)
}
}))
return u
}
// Ignore sets each column to itself in case of conflict.
// Using this option is equivalent to using:
//
// client.InstanceMetadata.Create().
// OnConflict(sql.ResolveWithIgnore()).
// Exec(ctx)
func (u *InstanceMetadataUpsertOne) Ignore() *InstanceMetadataUpsertOne {
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 *InstanceMetadataUpsertOne) DoNothing() *InstanceMetadataUpsertOne {
u.create.conflict = append(u.create.conflict, sql.DoNothing())
return u
}
// Update allows overriding fields `UPDATE` values. See the InstanceMetadataCreate.OnConflict
// documentation for more info.
func (u *InstanceMetadataUpsertOne) Update(set func(*InstanceMetadataUpsert)) *InstanceMetadataUpsertOne {
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
set(&InstanceMetadataUpsert{UpdateSet: update})
}))
return u
}
// SetIsRemote sets the "isRemote" field.
func (u *InstanceMetadataUpsertOne) SetIsRemote(v bool) *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetIsRemote(v)
})
}
// UpdateIsRemote sets the "isRemote" field to the value that was provided on create.
func (u *InstanceMetadataUpsertOne) UpdateIsRemote() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateIsRemote()
})
}
// SetURI sets the "uri" field.
func (u *InstanceMetadataUpsertOne) SetURI(v string) *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetURI(v)
})
}
// UpdateURI sets the "uri" field to the value that was provided on create.
func (u *InstanceMetadataUpsertOne) UpdateURI() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateURI()
})
}
// SetExtensions sets the "extensions" field.
func (u *InstanceMetadataUpsertOne) SetExtensions(v versia.Extensions) *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetExtensions(v)
})
}
// UpdateExtensions sets the "extensions" field to the value that was provided on create.
func (u *InstanceMetadataUpsertOne) UpdateExtensions() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateExtensions()
})
}
// SetUpdatedAt sets the "updated_at" field.
func (u *InstanceMetadataUpsertOne) SetUpdatedAt(v time.Time) *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetUpdatedAt(v)
})
}
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
func (u *InstanceMetadataUpsertOne) UpdateUpdatedAt() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateUpdatedAt()
})
}
// SetName sets the "name" field.
func (u *InstanceMetadataUpsertOne) SetName(v string) *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetName(v)
})
}
// UpdateName sets the "name" field to the value that was provided on create.
func (u *InstanceMetadataUpsertOne) UpdateName() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateName()
})
}
// SetDescription sets the "description" field.
func (u *InstanceMetadataUpsertOne) SetDescription(v string) *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetDescription(v)
})
}
// UpdateDescription sets the "description" field to the value that was provided on create.
func (u *InstanceMetadataUpsertOne) UpdateDescription() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateDescription()
})
}
// ClearDescription clears the value of the "description" field.
func (u *InstanceMetadataUpsertOne) ClearDescription() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.ClearDescription()
})
}
// SetHost sets the "host" field.
func (u *InstanceMetadataUpsertOne) SetHost(v string) *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetHost(v)
})
}
// UpdateHost sets the "host" field to the value that was provided on create.
func (u *InstanceMetadataUpsertOne) UpdateHost() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateHost()
})
}
// SetPublicKey sets the "publicKey" field.
func (u *InstanceMetadataUpsertOne) SetPublicKey(v []byte) *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetPublicKey(v)
})
}
// UpdatePublicKey sets the "publicKey" field to the value that was provided on create.
func (u *InstanceMetadataUpsertOne) UpdatePublicKey() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdatePublicKey()
})
}
// SetPublicKeyAlgorithm sets the "publicKeyAlgorithm" field.
func (u *InstanceMetadataUpsertOne) SetPublicKeyAlgorithm(v string) *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetPublicKeyAlgorithm(v)
})
}
// UpdatePublicKeyAlgorithm sets the "publicKeyAlgorithm" field to the value that was provided on create.
func (u *InstanceMetadataUpsertOne) UpdatePublicKeyAlgorithm() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdatePublicKeyAlgorithm()
})
}
// SetPrivateKey sets the "privateKey" field.
func (u *InstanceMetadataUpsertOne) SetPrivateKey(v []byte) *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetPrivateKey(v)
})
}
// UpdatePrivateKey sets the "privateKey" field to the value that was provided on create.
func (u *InstanceMetadataUpsertOne) UpdatePrivateKey() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdatePrivateKey()
})
}
// ClearPrivateKey clears the value of the "privateKey" field.
func (u *InstanceMetadataUpsertOne) ClearPrivateKey() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.ClearPrivateKey()
})
}
// SetSoftwareName sets the "softwareName" field.
func (u *InstanceMetadataUpsertOne) SetSoftwareName(v string) *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetSoftwareName(v)
})
}
// UpdateSoftwareName sets the "softwareName" field to the value that was provided on create.
func (u *InstanceMetadataUpsertOne) UpdateSoftwareName() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateSoftwareName()
})
}
// SetSoftwareVersion sets the "softwareVersion" field.
func (u *InstanceMetadataUpsertOne) SetSoftwareVersion(v string) *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetSoftwareVersion(v)
})
}
// UpdateSoftwareVersion sets the "softwareVersion" field to the value that was provided on create.
func (u *InstanceMetadataUpsertOne) UpdateSoftwareVersion() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateSoftwareVersion()
})
}
// SetSharedInboxURI sets the "sharedInboxURI" field.
func (u *InstanceMetadataUpsertOne) SetSharedInboxURI(v string) *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetSharedInboxURI(v)
})
}
// UpdateSharedInboxURI sets the "sharedInboxURI" field to the value that was provided on create.
func (u *InstanceMetadataUpsertOne) UpdateSharedInboxURI() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateSharedInboxURI()
})
}
// ClearSharedInboxURI clears the value of the "sharedInboxURI" field.
func (u *InstanceMetadataUpsertOne) ClearSharedInboxURI() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.ClearSharedInboxURI()
})
}
// SetModeratorsURI sets the "moderatorsURI" field.
func (u *InstanceMetadataUpsertOne) SetModeratorsURI(v string) *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetModeratorsURI(v)
})
}
// UpdateModeratorsURI sets the "moderatorsURI" field to the value that was provided on create.
func (u *InstanceMetadataUpsertOne) UpdateModeratorsURI() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateModeratorsURI()
})
}
// ClearModeratorsURI clears the value of the "moderatorsURI" field.
func (u *InstanceMetadataUpsertOne) ClearModeratorsURI() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.ClearModeratorsURI()
})
}
// SetAdminsURI sets the "adminsURI" field.
func (u *InstanceMetadataUpsertOne) SetAdminsURI(v string) *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetAdminsURI(v)
})
}
// UpdateAdminsURI sets the "adminsURI" field to the value that was provided on create.
func (u *InstanceMetadataUpsertOne) UpdateAdminsURI() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateAdminsURI()
})
}
// ClearAdminsURI clears the value of the "adminsURI" field.
func (u *InstanceMetadataUpsertOne) ClearAdminsURI() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.ClearAdminsURI()
})
}
// SetLogoEndpoint sets the "logoEndpoint" field.
func (u *InstanceMetadataUpsertOne) SetLogoEndpoint(v string) *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetLogoEndpoint(v)
})
}
// UpdateLogoEndpoint sets the "logoEndpoint" field to the value that was provided on create.
func (u *InstanceMetadataUpsertOne) UpdateLogoEndpoint() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateLogoEndpoint()
})
}
// ClearLogoEndpoint clears the value of the "logoEndpoint" field.
func (u *InstanceMetadataUpsertOne) ClearLogoEndpoint() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.ClearLogoEndpoint()
})
}
// SetLogoMimeType sets the "logoMimeType" field.
func (u *InstanceMetadataUpsertOne) SetLogoMimeType(v string) *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetLogoMimeType(v)
})
}
// UpdateLogoMimeType sets the "logoMimeType" field to the value that was provided on create.
func (u *InstanceMetadataUpsertOne) UpdateLogoMimeType() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateLogoMimeType()
})
}
// ClearLogoMimeType clears the value of the "logoMimeType" field.
func (u *InstanceMetadataUpsertOne) ClearLogoMimeType() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.ClearLogoMimeType()
})
}
// SetBannerEndpoint sets the "bannerEndpoint" field.
func (u *InstanceMetadataUpsertOne) SetBannerEndpoint(v string) *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetBannerEndpoint(v)
})
}
// UpdateBannerEndpoint sets the "bannerEndpoint" field to the value that was provided on create.
func (u *InstanceMetadataUpsertOne) UpdateBannerEndpoint() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateBannerEndpoint()
})
}
// ClearBannerEndpoint clears the value of the "bannerEndpoint" field.
func (u *InstanceMetadataUpsertOne) ClearBannerEndpoint() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.ClearBannerEndpoint()
})
}
// SetBannerMimeType sets the "bannerMimeType" field.
func (u *InstanceMetadataUpsertOne) SetBannerMimeType(v string) *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetBannerMimeType(v)
})
}
// UpdateBannerMimeType sets the "bannerMimeType" field to the value that was provided on create.
func (u *InstanceMetadataUpsertOne) UpdateBannerMimeType() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateBannerMimeType()
})
}
// ClearBannerMimeType clears the value of the "bannerMimeType" field.
func (u *InstanceMetadataUpsertOne) ClearBannerMimeType() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.ClearBannerMimeType()
})
}
// SetSupportedVersions sets the "supportedVersions" field.
func (u *InstanceMetadataUpsertOne) SetSupportedVersions(v []string) *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetSupportedVersions(v)
})
}
// UpdateSupportedVersions sets the "supportedVersions" field to the value that was provided on create.
func (u *InstanceMetadataUpsertOne) UpdateSupportedVersions() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateSupportedVersions()
})
}
// SetSupportedExtensions sets the "supportedExtensions" field.
func (u *InstanceMetadataUpsertOne) SetSupportedExtensions(v []string) *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetSupportedExtensions(v)
})
}
// UpdateSupportedExtensions sets the "supportedExtensions" field to the value that was provided on create.
func (u *InstanceMetadataUpsertOne) UpdateSupportedExtensions() *InstanceMetadataUpsertOne {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateSupportedExtensions()
})
}
// Exec executes the query.
func (u *InstanceMetadataUpsertOne) Exec(ctx context.Context) error {
if len(u.create.conflict) == 0 {
return errors.New("ent: missing options for InstanceMetadataCreate.OnConflict")
}
return u.create.Exec(ctx)
}
// ExecX is like Exec, but panics if an error occurs.
func (u *InstanceMetadataUpsertOne) 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 *InstanceMetadataUpsertOne) ID(ctx context.Context) (id uuid.UUID, 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: InstanceMetadataUpsertOne.ID is not supported by MySQL driver. Use InstanceMetadataUpsertOne.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 *InstanceMetadataUpsertOne) IDX(ctx context.Context) uuid.UUID {
id, err := u.ID(ctx)
if err != nil {
panic(err)
}
return id
}
// InstanceMetadataCreateBulk is the builder for creating many InstanceMetadata entities in bulk.
type InstanceMetadataCreateBulk struct {
config
err error
builders []*InstanceMetadataCreate
conflict []sql.ConflictOption
}
// Save creates the InstanceMetadata entities in the database.
func (imcb *InstanceMetadataCreateBulk) Save(ctx context.Context) ([]*InstanceMetadata, error) {
if imcb.err != nil {
return nil, imcb.err
}
specs := make([]*sqlgraph.CreateSpec, len(imcb.builders))
nodes := make([]*InstanceMetadata, len(imcb.builders))
mutators := make([]Mutator, len(imcb.builders))
for i := range imcb.builders {
func(i int, root context.Context) {
builder := imcb.builders[i]
builder.defaults()
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
mutation, ok := m.(*InstanceMetadataMutation)
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, imcb.builders[i+1].mutation)
} else {
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
spec.OnConflict = imcb.conflict
// Invoke the actual operation on the latest mutation in the chain.
if err = sqlgraph.BatchCreate(ctx, imcb.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, imcb.builders[0].mutation); err != nil {
return nil, err
}
}
return nodes, nil
}
// SaveX is like Save, but panics if an error occurs.
func (imcb *InstanceMetadataCreateBulk) SaveX(ctx context.Context) []*InstanceMetadata {
v, err := imcb.Save(ctx)
if err != nil {
panic(err)
}
return v
}
// Exec executes the query.
func (imcb *InstanceMetadataCreateBulk) Exec(ctx context.Context) error {
_, err := imcb.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (imcb *InstanceMetadataCreateBulk) ExecX(ctx context.Context) {
if err := imcb.Exec(ctx); err != nil {
panic(err)
}
}
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
// of the `INSERT` statement. For example:
//
// client.InstanceMetadata.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.InstanceMetadataUpsert) {
// SetIsRemote(v+v).
// }).
// Exec(ctx)
func (imcb *InstanceMetadataCreateBulk) OnConflict(opts ...sql.ConflictOption) *InstanceMetadataUpsertBulk {
imcb.conflict = opts
return &InstanceMetadataUpsertBulk{
create: imcb,
}
}
// OnConflictColumns calls `OnConflict` and configures the columns
// as conflict target. Using this option is equivalent to using:
//
// client.InstanceMetadata.Create().
// OnConflict(sql.ConflictColumns(columns...)).
// Exec(ctx)
func (imcb *InstanceMetadataCreateBulk) OnConflictColumns(columns ...string) *InstanceMetadataUpsertBulk {
imcb.conflict = append(imcb.conflict, sql.ConflictColumns(columns...))
return &InstanceMetadataUpsertBulk{
create: imcb,
}
}
// InstanceMetadataUpsertBulk is the builder for "upsert"-ing
// a bulk of InstanceMetadata nodes.
type InstanceMetadataUpsertBulk struct {
create *InstanceMetadataCreateBulk
}
// UpdateNewValues updates the mutable fields using the new values that
// were set on create. Using this option is equivalent to using:
//
// client.InstanceMetadata.Create().
// OnConflict(
// sql.ResolveWithNewValues(),
// sql.ResolveWith(func(u *sql.UpdateSet) {
// u.SetIgnore(instancemetadata.FieldID)
// }),
// ).
// Exec(ctx)
func (u *InstanceMetadataUpsertBulk) UpdateNewValues() *InstanceMetadataUpsertBulk {
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(instancemetadata.FieldID)
}
if _, exists := b.mutation.CreatedAt(); exists {
s.SetIgnore(instancemetadata.FieldCreatedAt)
}
}
}))
return u
}
// Ignore sets each column to itself in case of conflict.
// Using this option is equivalent to using:
//
// client.InstanceMetadata.Create().
// OnConflict(sql.ResolveWithIgnore()).
// Exec(ctx)
func (u *InstanceMetadataUpsertBulk) Ignore() *InstanceMetadataUpsertBulk {
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 *InstanceMetadataUpsertBulk) DoNothing() *InstanceMetadataUpsertBulk {
u.create.conflict = append(u.create.conflict, sql.DoNothing())
return u
}
// Update allows overriding fields `UPDATE` values. See the InstanceMetadataCreateBulk.OnConflict
// documentation for more info.
func (u *InstanceMetadataUpsertBulk) Update(set func(*InstanceMetadataUpsert)) *InstanceMetadataUpsertBulk {
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
set(&InstanceMetadataUpsert{UpdateSet: update})
}))
return u
}
// SetIsRemote sets the "isRemote" field.
func (u *InstanceMetadataUpsertBulk) SetIsRemote(v bool) *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetIsRemote(v)
})
}
// UpdateIsRemote sets the "isRemote" field to the value that was provided on create.
func (u *InstanceMetadataUpsertBulk) UpdateIsRemote() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateIsRemote()
})
}
// SetURI sets the "uri" field.
func (u *InstanceMetadataUpsertBulk) SetURI(v string) *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetURI(v)
})
}
// UpdateURI sets the "uri" field to the value that was provided on create.
func (u *InstanceMetadataUpsertBulk) UpdateURI() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateURI()
})
}
// SetExtensions sets the "extensions" field.
func (u *InstanceMetadataUpsertBulk) SetExtensions(v versia.Extensions) *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetExtensions(v)
})
}
// UpdateExtensions sets the "extensions" field to the value that was provided on create.
func (u *InstanceMetadataUpsertBulk) UpdateExtensions() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateExtensions()
})
}
// SetUpdatedAt sets the "updated_at" field.
func (u *InstanceMetadataUpsertBulk) SetUpdatedAt(v time.Time) *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetUpdatedAt(v)
})
}
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
func (u *InstanceMetadataUpsertBulk) UpdateUpdatedAt() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateUpdatedAt()
})
}
// SetName sets the "name" field.
func (u *InstanceMetadataUpsertBulk) SetName(v string) *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetName(v)
})
}
// UpdateName sets the "name" field to the value that was provided on create.
func (u *InstanceMetadataUpsertBulk) UpdateName() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateName()
})
}
// SetDescription sets the "description" field.
func (u *InstanceMetadataUpsertBulk) SetDescription(v string) *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetDescription(v)
})
}
// UpdateDescription sets the "description" field to the value that was provided on create.
func (u *InstanceMetadataUpsertBulk) UpdateDescription() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateDescription()
})
}
// ClearDescription clears the value of the "description" field.
func (u *InstanceMetadataUpsertBulk) ClearDescription() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.ClearDescription()
})
}
// SetHost sets the "host" field.
func (u *InstanceMetadataUpsertBulk) SetHost(v string) *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetHost(v)
})
}
// UpdateHost sets the "host" field to the value that was provided on create.
func (u *InstanceMetadataUpsertBulk) UpdateHost() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateHost()
})
}
// SetPublicKey sets the "publicKey" field.
func (u *InstanceMetadataUpsertBulk) SetPublicKey(v []byte) *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetPublicKey(v)
})
}
// UpdatePublicKey sets the "publicKey" field to the value that was provided on create.
func (u *InstanceMetadataUpsertBulk) UpdatePublicKey() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdatePublicKey()
})
}
// SetPublicKeyAlgorithm sets the "publicKeyAlgorithm" field.
func (u *InstanceMetadataUpsertBulk) SetPublicKeyAlgorithm(v string) *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetPublicKeyAlgorithm(v)
})
}
// UpdatePublicKeyAlgorithm sets the "publicKeyAlgorithm" field to the value that was provided on create.
func (u *InstanceMetadataUpsertBulk) UpdatePublicKeyAlgorithm() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdatePublicKeyAlgorithm()
})
}
// SetPrivateKey sets the "privateKey" field.
func (u *InstanceMetadataUpsertBulk) SetPrivateKey(v []byte) *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetPrivateKey(v)
})
}
// UpdatePrivateKey sets the "privateKey" field to the value that was provided on create.
func (u *InstanceMetadataUpsertBulk) UpdatePrivateKey() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdatePrivateKey()
})
}
// ClearPrivateKey clears the value of the "privateKey" field.
func (u *InstanceMetadataUpsertBulk) ClearPrivateKey() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.ClearPrivateKey()
})
}
// SetSoftwareName sets the "softwareName" field.
func (u *InstanceMetadataUpsertBulk) SetSoftwareName(v string) *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetSoftwareName(v)
})
}
// UpdateSoftwareName sets the "softwareName" field to the value that was provided on create.
func (u *InstanceMetadataUpsertBulk) UpdateSoftwareName() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateSoftwareName()
})
}
// SetSoftwareVersion sets the "softwareVersion" field.
func (u *InstanceMetadataUpsertBulk) SetSoftwareVersion(v string) *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetSoftwareVersion(v)
})
}
// UpdateSoftwareVersion sets the "softwareVersion" field to the value that was provided on create.
func (u *InstanceMetadataUpsertBulk) UpdateSoftwareVersion() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateSoftwareVersion()
})
}
// SetSharedInboxURI sets the "sharedInboxURI" field.
func (u *InstanceMetadataUpsertBulk) SetSharedInboxURI(v string) *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetSharedInboxURI(v)
})
}
// UpdateSharedInboxURI sets the "sharedInboxURI" field to the value that was provided on create.
func (u *InstanceMetadataUpsertBulk) UpdateSharedInboxURI() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateSharedInboxURI()
})
}
// ClearSharedInboxURI clears the value of the "sharedInboxURI" field.
func (u *InstanceMetadataUpsertBulk) ClearSharedInboxURI() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.ClearSharedInboxURI()
})
}
// SetModeratorsURI sets the "moderatorsURI" field.
func (u *InstanceMetadataUpsertBulk) SetModeratorsURI(v string) *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetModeratorsURI(v)
})
}
// UpdateModeratorsURI sets the "moderatorsURI" field to the value that was provided on create.
func (u *InstanceMetadataUpsertBulk) UpdateModeratorsURI() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateModeratorsURI()
})
}
// ClearModeratorsURI clears the value of the "moderatorsURI" field.
func (u *InstanceMetadataUpsertBulk) ClearModeratorsURI() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.ClearModeratorsURI()
})
}
// SetAdminsURI sets the "adminsURI" field.
func (u *InstanceMetadataUpsertBulk) SetAdminsURI(v string) *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetAdminsURI(v)
})
}
// UpdateAdminsURI sets the "adminsURI" field to the value that was provided on create.
func (u *InstanceMetadataUpsertBulk) UpdateAdminsURI() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateAdminsURI()
})
}
// ClearAdminsURI clears the value of the "adminsURI" field.
func (u *InstanceMetadataUpsertBulk) ClearAdminsURI() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.ClearAdminsURI()
})
}
// SetLogoEndpoint sets the "logoEndpoint" field.
func (u *InstanceMetadataUpsertBulk) SetLogoEndpoint(v string) *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetLogoEndpoint(v)
})
}
// UpdateLogoEndpoint sets the "logoEndpoint" field to the value that was provided on create.
func (u *InstanceMetadataUpsertBulk) UpdateLogoEndpoint() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateLogoEndpoint()
})
}
// ClearLogoEndpoint clears the value of the "logoEndpoint" field.
func (u *InstanceMetadataUpsertBulk) ClearLogoEndpoint() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.ClearLogoEndpoint()
})
}
// SetLogoMimeType sets the "logoMimeType" field.
func (u *InstanceMetadataUpsertBulk) SetLogoMimeType(v string) *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetLogoMimeType(v)
})
}
// UpdateLogoMimeType sets the "logoMimeType" field to the value that was provided on create.
func (u *InstanceMetadataUpsertBulk) UpdateLogoMimeType() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateLogoMimeType()
})
}
// ClearLogoMimeType clears the value of the "logoMimeType" field.
func (u *InstanceMetadataUpsertBulk) ClearLogoMimeType() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.ClearLogoMimeType()
})
}
// SetBannerEndpoint sets the "bannerEndpoint" field.
func (u *InstanceMetadataUpsertBulk) SetBannerEndpoint(v string) *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetBannerEndpoint(v)
})
}
// UpdateBannerEndpoint sets the "bannerEndpoint" field to the value that was provided on create.
func (u *InstanceMetadataUpsertBulk) UpdateBannerEndpoint() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateBannerEndpoint()
})
}
// ClearBannerEndpoint clears the value of the "bannerEndpoint" field.
func (u *InstanceMetadataUpsertBulk) ClearBannerEndpoint() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.ClearBannerEndpoint()
})
}
// SetBannerMimeType sets the "bannerMimeType" field.
func (u *InstanceMetadataUpsertBulk) SetBannerMimeType(v string) *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetBannerMimeType(v)
})
}
// UpdateBannerMimeType sets the "bannerMimeType" field to the value that was provided on create.
func (u *InstanceMetadataUpsertBulk) UpdateBannerMimeType() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateBannerMimeType()
})
}
// ClearBannerMimeType clears the value of the "bannerMimeType" field.
func (u *InstanceMetadataUpsertBulk) ClearBannerMimeType() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.ClearBannerMimeType()
})
}
// SetSupportedVersions sets the "supportedVersions" field.
func (u *InstanceMetadataUpsertBulk) SetSupportedVersions(v []string) *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetSupportedVersions(v)
})
}
// UpdateSupportedVersions sets the "supportedVersions" field to the value that was provided on create.
func (u *InstanceMetadataUpsertBulk) UpdateSupportedVersions() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateSupportedVersions()
})
}
// SetSupportedExtensions sets the "supportedExtensions" field.
func (u *InstanceMetadataUpsertBulk) SetSupportedExtensions(v []string) *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.SetSupportedExtensions(v)
})
}
// UpdateSupportedExtensions sets the "supportedExtensions" field to the value that was provided on create.
func (u *InstanceMetadataUpsertBulk) UpdateSupportedExtensions() *InstanceMetadataUpsertBulk {
return u.Update(func(s *InstanceMetadataUpsert) {
s.UpdateSupportedExtensions()
})
}
// Exec executes the query.
func (u *InstanceMetadataUpsertBulk) 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 InstanceMetadataCreateBulk instead", i)
}
}
if len(u.create.conflict) == 0 {
return errors.New("ent: missing options for InstanceMetadataCreateBulk.OnConflict")
}
return u.create.Exec(ctx)
}
// ExecX is like Exec, but panics if an error occurs.
func (u *InstanceMetadataUpsertBulk) ExecX(ctx context.Context) {
if err := u.create.Exec(ctx); err != nil {
panic(err)
}
}