Files
MonkeyCode/backend/db/agentplugin_create.go

1356 lines
41 KiB
Go

// Code generated by ent, DO NOT EDIT.
package db
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/chaitin/MonkeyCode/backend/db/agentplugin"
"github.com/chaitin/MonkeyCode/backend/db/agentpluginrepo"
"github.com/chaitin/MonkeyCode/backend/db/agentpluginversion"
"github.com/google/uuid"
)
// AgentPluginCreate is the builder for creating a AgentPlugin entity.
type AgentPluginCreate struct {
config
mutation *AgentPluginMutation
hooks []Hook
conflict []sql.ConflictOption
}
// SetRepoID sets the "repo_id" field.
func (_c *AgentPluginCreate) SetRepoID(v uuid.UUID) *AgentPluginCreate {
_c.mutation.SetRepoID(v)
return _c
}
// SetName sets the "name" field.
func (_c *AgentPluginCreate) SetName(v string) *AgentPluginCreate {
_c.mutation.SetName(v)
return _c
}
// SetDescription sets the "description" field.
func (_c *AgentPluginCreate) SetDescription(v string) *AgentPluginCreate {
_c.mutation.SetDescription(v)
return _c
}
// SetNillableDescription sets the "description" field if the given value is not nil.
func (_c *AgentPluginCreate) SetNillableDescription(v *string) *AgentPluginCreate {
if v != nil {
_c.SetDescription(*v)
}
return _c
}
// SetScopeType sets the "scope_type" field.
func (_c *AgentPluginCreate) SetScopeType(v agentplugin.ScopeType) *AgentPluginCreate {
_c.mutation.SetScopeType(v)
return _c
}
// SetNillableScopeType sets the "scope_type" field if the given value is not nil.
func (_c *AgentPluginCreate) SetNillableScopeType(v *agentplugin.ScopeType) *AgentPluginCreate {
if v != nil {
_c.SetScopeType(*v)
}
return _c
}
// SetScopeID sets the "scope_id" field.
func (_c *AgentPluginCreate) SetScopeID(v string) *AgentPluginCreate {
_c.mutation.SetScopeID(v)
return _c
}
// SetNillableScopeID sets the "scope_id" field if the given value is not nil.
func (_c *AgentPluginCreate) SetNillableScopeID(v *string) *AgentPluginCreate {
if v != nil {
_c.SetScopeID(*v)
}
return _c
}
// SetCreatedBy sets the "created_by" field.
func (_c *AgentPluginCreate) SetCreatedBy(v uuid.UUID) *AgentPluginCreate {
_c.mutation.SetCreatedBy(v)
return _c
}
// SetActiveVersionID sets the "active_version_id" field.
func (_c *AgentPluginCreate) SetActiveVersionID(v uuid.UUID) *AgentPluginCreate {
_c.mutation.SetActiveVersionID(v)
return _c
}
// SetNillableActiveVersionID sets the "active_version_id" field if the given value is not nil.
func (_c *AgentPluginCreate) SetNillableActiveVersionID(v *uuid.UUID) *AgentPluginCreate {
if v != nil {
_c.SetActiveVersionID(*v)
}
return _c
}
// SetIsForceDelivery sets the "is_force_delivery" field.
func (_c *AgentPluginCreate) SetIsForceDelivery(v bool) *AgentPluginCreate {
_c.mutation.SetIsForceDelivery(v)
return _c
}
// SetNillableIsForceDelivery sets the "is_force_delivery" field if the given value is not nil.
func (_c *AgentPluginCreate) SetNillableIsForceDelivery(v *bool) *AgentPluginCreate {
if v != nil {
_c.SetIsForceDelivery(*v)
}
return _c
}
// SetIsOrphan sets the "is_orphan" field.
func (_c *AgentPluginCreate) SetIsOrphan(v bool) *AgentPluginCreate {
_c.mutation.SetIsOrphan(v)
return _c
}
// SetNillableIsOrphan sets the "is_orphan" field if the given value is not nil.
func (_c *AgentPluginCreate) SetNillableIsOrphan(v *bool) *AgentPluginCreate {
if v != nil {
_c.SetIsOrphan(*v)
}
return _c
}
// SetIsDeleted sets the "is_deleted" field.
func (_c *AgentPluginCreate) SetIsDeleted(v bool) *AgentPluginCreate {
_c.mutation.SetIsDeleted(v)
return _c
}
// SetNillableIsDeleted sets the "is_deleted" field if the given value is not nil.
func (_c *AgentPluginCreate) SetNillableIsDeleted(v *bool) *AgentPluginCreate {
if v != nil {
_c.SetIsDeleted(*v)
}
return _c
}
// SetEnabled sets the "enabled" field.
func (_c *AgentPluginCreate) SetEnabled(v bool) *AgentPluginCreate {
_c.mutation.SetEnabled(v)
return _c
}
// SetNillableEnabled sets the "enabled" field if the given value is not nil.
func (_c *AgentPluginCreate) SetNillableEnabled(v *bool) *AgentPluginCreate {
if v != nil {
_c.SetEnabled(*v)
}
return _c
}
// SetCreatedAt sets the "created_at" field.
func (_c *AgentPluginCreate) SetCreatedAt(v time.Time) *AgentPluginCreate {
_c.mutation.SetCreatedAt(v)
return _c
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (_c *AgentPluginCreate) SetNillableCreatedAt(v *time.Time) *AgentPluginCreate {
if v != nil {
_c.SetCreatedAt(*v)
}
return _c
}
// SetUpdatedAt sets the "updated_at" field.
func (_c *AgentPluginCreate) SetUpdatedAt(v time.Time) *AgentPluginCreate {
_c.mutation.SetUpdatedAt(v)
return _c
}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (_c *AgentPluginCreate) SetNillableUpdatedAt(v *time.Time) *AgentPluginCreate {
if v != nil {
_c.SetUpdatedAt(*v)
}
return _c
}
// SetID sets the "id" field.
func (_c *AgentPluginCreate) SetID(v uuid.UUID) *AgentPluginCreate {
_c.mutation.SetID(v)
return _c
}
// SetNillableID sets the "id" field if the given value is not nil.
func (_c *AgentPluginCreate) SetNillableID(v *uuid.UUID) *AgentPluginCreate {
if v != nil {
_c.SetID(*v)
}
return _c
}
// SetRepo sets the "repo" edge to the AgentPluginRepo entity.
func (_c *AgentPluginCreate) SetRepo(v *AgentPluginRepo) *AgentPluginCreate {
return _c.SetRepoID(v.ID)
}
// AddVersionIDs adds the "versions" edge to the AgentPluginVersion entity by IDs.
func (_c *AgentPluginCreate) AddVersionIDs(ids ...uuid.UUID) *AgentPluginCreate {
_c.mutation.AddVersionIDs(ids...)
return _c
}
// AddVersions adds the "versions" edges to the AgentPluginVersion entity.
func (_c *AgentPluginCreate) AddVersions(v ...*AgentPluginVersion) *AgentPluginCreate {
ids := make([]uuid.UUID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _c.AddVersionIDs(ids...)
}
// Mutation returns the AgentPluginMutation object of the builder.
func (_c *AgentPluginCreate) Mutation() *AgentPluginMutation {
return _c.mutation
}
// Save creates the AgentPlugin in the database.
func (_c *AgentPluginCreate) Save(ctx context.Context) (*AgentPlugin, error) {
_c.defaults()
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
}
// SaveX calls Save and panics if Save returns an error.
func (_c *AgentPluginCreate) SaveX(ctx context.Context) *AgentPlugin {
v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
return v
}
// Exec executes the query.
func (_c *AgentPluginCreate) Exec(ctx context.Context) error {
_, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_c *AgentPluginCreate) 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 *AgentPluginCreate) defaults() {
if _, ok := _c.mutation.ScopeType(); !ok {
v := agentplugin.DefaultScopeType
_c.mutation.SetScopeType(v)
}
if _, ok := _c.mutation.ScopeID(); !ok {
v := agentplugin.DefaultScopeID
_c.mutation.SetScopeID(v)
}
if _, ok := _c.mutation.IsForceDelivery(); !ok {
v := agentplugin.DefaultIsForceDelivery
_c.mutation.SetIsForceDelivery(v)
}
if _, ok := _c.mutation.IsOrphan(); !ok {
v := agentplugin.DefaultIsOrphan
_c.mutation.SetIsOrphan(v)
}
if _, ok := _c.mutation.IsDeleted(); !ok {
v := agentplugin.DefaultIsDeleted
_c.mutation.SetIsDeleted(v)
}
if _, ok := _c.mutation.Enabled(); !ok {
v := agentplugin.DefaultEnabled
_c.mutation.SetEnabled(v)
}
if _, ok := _c.mutation.CreatedAt(); !ok {
v := agentplugin.DefaultCreatedAt()
_c.mutation.SetCreatedAt(v)
}
if _, ok := _c.mutation.UpdatedAt(); !ok {
v := agentplugin.DefaultUpdatedAt()
_c.mutation.SetUpdatedAt(v)
}
if _, ok := _c.mutation.ID(); !ok {
v := agentplugin.DefaultID()
_c.mutation.SetID(v)
}
}
// check runs all checks and user-defined validators on the builder.
func (_c *AgentPluginCreate) check() error {
if _, ok := _c.mutation.RepoID(); !ok {
return &ValidationError{Name: "repo_id", err: errors.New(`db: missing required field "AgentPlugin.repo_id"`)}
}
if _, ok := _c.mutation.Name(); !ok {
return &ValidationError{Name: "name", err: errors.New(`db: missing required field "AgentPlugin.name"`)}
}
if v, ok := _c.mutation.Name(); ok {
if err := agentplugin.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`db: validator failed for field "AgentPlugin.name": %w`, err)}
}
}
if _, ok := _c.mutation.ScopeType(); !ok {
return &ValidationError{Name: "scope_type", err: errors.New(`db: missing required field "AgentPlugin.scope_type"`)}
}
if v, ok := _c.mutation.ScopeType(); ok {
if err := agentplugin.ScopeTypeValidator(v); err != nil {
return &ValidationError{Name: "scope_type", err: fmt.Errorf(`db: validator failed for field "AgentPlugin.scope_type": %w`, err)}
}
}
if _, ok := _c.mutation.ScopeID(); !ok {
return &ValidationError{Name: "scope_id", err: errors.New(`db: missing required field "AgentPlugin.scope_id"`)}
}
if _, ok := _c.mutation.CreatedBy(); !ok {
return &ValidationError{Name: "created_by", err: errors.New(`db: missing required field "AgentPlugin.created_by"`)}
}
if _, ok := _c.mutation.IsForceDelivery(); !ok {
return &ValidationError{Name: "is_force_delivery", err: errors.New(`db: missing required field "AgentPlugin.is_force_delivery"`)}
}
if _, ok := _c.mutation.IsOrphan(); !ok {
return &ValidationError{Name: "is_orphan", err: errors.New(`db: missing required field "AgentPlugin.is_orphan"`)}
}
if _, ok := _c.mutation.IsDeleted(); !ok {
return &ValidationError{Name: "is_deleted", err: errors.New(`db: missing required field "AgentPlugin.is_deleted"`)}
}
if _, ok := _c.mutation.Enabled(); !ok {
return &ValidationError{Name: "enabled", err: errors.New(`db: missing required field "AgentPlugin.enabled"`)}
}
if _, ok := _c.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`db: missing required field "AgentPlugin.created_at"`)}
}
if _, ok := _c.mutation.UpdatedAt(); !ok {
return &ValidationError{Name: "updated_at", err: errors.New(`db: missing required field "AgentPlugin.updated_at"`)}
}
if len(_c.mutation.RepoIDs()) == 0 {
return &ValidationError{Name: "repo", err: errors.New(`db: missing required edge "AgentPlugin.repo"`)}
}
return nil
}
func (_c *AgentPluginCreate) sqlSave(ctx context.Context) (*AgentPlugin, 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.(*uuid.UUID); 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 *AgentPluginCreate) createSpec() (*AgentPlugin, *sqlgraph.CreateSpec) {
var (
_node = &AgentPlugin{config: _c.config}
_spec = sqlgraph.NewCreateSpec(agentplugin.Table, sqlgraph.NewFieldSpec(agentplugin.FieldID, field.TypeUUID))
)
_spec.OnConflict = _c.conflict
if id, ok := _c.mutation.ID(); ok {
_node.ID = id
_spec.ID.Value = &id
}
if value, ok := _c.mutation.Name(); ok {
_spec.SetField(agentplugin.FieldName, field.TypeString, value)
_node.Name = value
}
if value, ok := _c.mutation.Description(); ok {
_spec.SetField(agentplugin.FieldDescription, field.TypeString, value)
_node.Description = value
}
if value, ok := _c.mutation.ScopeType(); ok {
_spec.SetField(agentplugin.FieldScopeType, field.TypeEnum, value)
_node.ScopeType = value
}
if value, ok := _c.mutation.ScopeID(); ok {
_spec.SetField(agentplugin.FieldScopeID, field.TypeString, value)
_node.ScopeID = value
}
if value, ok := _c.mutation.CreatedBy(); ok {
_spec.SetField(agentplugin.FieldCreatedBy, field.TypeUUID, value)
_node.CreatedBy = value
}
if value, ok := _c.mutation.ActiveVersionID(); ok {
_spec.SetField(agentplugin.FieldActiveVersionID, field.TypeUUID, value)
_node.ActiveVersionID = &value
}
if value, ok := _c.mutation.IsForceDelivery(); ok {
_spec.SetField(agentplugin.FieldIsForceDelivery, field.TypeBool, value)
_node.IsForceDelivery = value
}
if value, ok := _c.mutation.IsOrphan(); ok {
_spec.SetField(agentplugin.FieldIsOrphan, field.TypeBool, value)
_node.IsOrphan = value
}
if value, ok := _c.mutation.IsDeleted(); ok {
_spec.SetField(agentplugin.FieldIsDeleted, field.TypeBool, value)
_node.IsDeleted = value
}
if value, ok := _c.mutation.Enabled(); ok {
_spec.SetField(agentplugin.FieldEnabled, field.TypeBool, value)
_node.Enabled = value
}
if value, ok := _c.mutation.CreatedAt(); ok {
_spec.SetField(agentplugin.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
if value, ok := _c.mutation.UpdatedAt(); ok {
_spec.SetField(agentplugin.FieldUpdatedAt, field.TypeTime, value)
_node.UpdatedAt = value
}
if nodes := _c.mutation.RepoIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
Table: agentplugin.RepoTable,
Columns: []string{agentplugin.RepoColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(agentpluginrepo.FieldID, field.TypeUUID),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_node.RepoID = nodes[0]
_spec.Edges = append(_spec.Edges, edge)
}
if nodes := _c.mutation.VersionsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: agentplugin.VersionsTable,
Columns: []string{agentplugin.VersionsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(agentpluginversion.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.AgentPlugin.Create().
// SetRepoID(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.AgentPluginUpsert) {
// SetRepoID(v+v).
// }).
// Exec(ctx)
func (_c *AgentPluginCreate) OnConflict(opts ...sql.ConflictOption) *AgentPluginUpsertOne {
_c.conflict = opts
return &AgentPluginUpsertOne{
create: _c,
}
}
// OnConflictColumns calls `OnConflict` and configures the columns
// as conflict target. Using this option is equivalent to using:
//
// client.AgentPlugin.Create().
// OnConflict(sql.ConflictColumns(columns...)).
// Exec(ctx)
func (_c *AgentPluginCreate) OnConflictColumns(columns ...string) *AgentPluginUpsertOne {
_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
return &AgentPluginUpsertOne{
create: _c,
}
}
type (
// AgentPluginUpsertOne is the builder for "upsert"-ing
// one AgentPlugin node.
AgentPluginUpsertOne struct {
create *AgentPluginCreate
}
// AgentPluginUpsert is the "OnConflict" setter.
AgentPluginUpsert struct {
*sql.UpdateSet
}
)
// SetRepoID sets the "repo_id" field.
func (u *AgentPluginUpsert) SetRepoID(v uuid.UUID) *AgentPluginUpsert {
u.Set(agentplugin.FieldRepoID, v)
return u
}
// UpdateRepoID sets the "repo_id" field to the value that was provided on create.
func (u *AgentPluginUpsert) UpdateRepoID() *AgentPluginUpsert {
u.SetExcluded(agentplugin.FieldRepoID)
return u
}
// SetName sets the "name" field.
func (u *AgentPluginUpsert) SetName(v string) *AgentPluginUpsert {
u.Set(agentplugin.FieldName, v)
return u
}
// UpdateName sets the "name" field to the value that was provided on create.
func (u *AgentPluginUpsert) UpdateName() *AgentPluginUpsert {
u.SetExcluded(agentplugin.FieldName)
return u
}
// SetDescription sets the "description" field.
func (u *AgentPluginUpsert) SetDescription(v string) *AgentPluginUpsert {
u.Set(agentplugin.FieldDescription, v)
return u
}
// UpdateDescription sets the "description" field to the value that was provided on create.
func (u *AgentPluginUpsert) UpdateDescription() *AgentPluginUpsert {
u.SetExcluded(agentplugin.FieldDescription)
return u
}
// ClearDescription clears the value of the "description" field.
func (u *AgentPluginUpsert) ClearDescription() *AgentPluginUpsert {
u.SetNull(agentplugin.FieldDescription)
return u
}
// SetScopeType sets the "scope_type" field.
func (u *AgentPluginUpsert) SetScopeType(v agentplugin.ScopeType) *AgentPluginUpsert {
u.Set(agentplugin.FieldScopeType, v)
return u
}
// UpdateScopeType sets the "scope_type" field to the value that was provided on create.
func (u *AgentPluginUpsert) UpdateScopeType() *AgentPluginUpsert {
u.SetExcluded(agentplugin.FieldScopeType)
return u
}
// SetScopeID sets the "scope_id" field.
func (u *AgentPluginUpsert) SetScopeID(v string) *AgentPluginUpsert {
u.Set(agentplugin.FieldScopeID, v)
return u
}
// UpdateScopeID sets the "scope_id" field to the value that was provided on create.
func (u *AgentPluginUpsert) UpdateScopeID() *AgentPluginUpsert {
u.SetExcluded(agentplugin.FieldScopeID)
return u
}
// SetCreatedBy sets the "created_by" field.
func (u *AgentPluginUpsert) SetCreatedBy(v uuid.UUID) *AgentPluginUpsert {
u.Set(agentplugin.FieldCreatedBy, v)
return u
}
// UpdateCreatedBy sets the "created_by" field to the value that was provided on create.
func (u *AgentPluginUpsert) UpdateCreatedBy() *AgentPluginUpsert {
u.SetExcluded(agentplugin.FieldCreatedBy)
return u
}
// SetActiveVersionID sets the "active_version_id" field.
func (u *AgentPluginUpsert) SetActiveVersionID(v uuid.UUID) *AgentPluginUpsert {
u.Set(agentplugin.FieldActiveVersionID, v)
return u
}
// UpdateActiveVersionID sets the "active_version_id" field to the value that was provided on create.
func (u *AgentPluginUpsert) UpdateActiveVersionID() *AgentPluginUpsert {
u.SetExcluded(agentplugin.FieldActiveVersionID)
return u
}
// ClearActiveVersionID clears the value of the "active_version_id" field.
func (u *AgentPluginUpsert) ClearActiveVersionID() *AgentPluginUpsert {
u.SetNull(agentplugin.FieldActiveVersionID)
return u
}
// SetIsForceDelivery sets the "is_force_delivery" field.
func (u *AgentPluginUpsert) SetIsForceDelivery(v bool) *AgentPluginUpsert {
u.Set(agentplugin.FieldIsForceDelivery, v)
return u
}
// UpdateIsForceDelivery sets the "is_force_delivery" field to the value that was provided on create.
func (u *AgentPluginUpsert) UpdateIsForceDelivery() *AgentPluginUpsert {
u.SetExcluded(agentplugin.FieldIsForceDelivery)
return u
}
// SetIsOrphan sets the "is_orphan" field.
func (u *AgentPluginUpsert) SetIsOrphan(v bool) *AgentPluginUpsert {
u.Set(agentplugin.FieldIsOrphan, v)
return u
}
// UpdateIsOrphan sets the "is_orphan" field to the value that was provided on create.
func (u *AgentPluginUpsert) UpdateIsOrphan() *AgentPluginUpsert {
u.SetExcluded(agentplugin.FieldIsOrphan)
return u
}
// SetIsDeleted sets the "is_deleted" field.
func (u *AgentPluginUpsert) SetIsDeleted(v bool) *AgentPluginUpsert {
u.Set(agentplugin.FieldIsDeleted, v)
return u
}
// UpdateIsDeleted sets the "is_deleted" field to the value that was provided on create.
func (u *AgentPluginUpsert) UpdateIsDeleted() *AgentPluginUpsert {
u.SetExcluded(agentplugin.FieldIsDeleted)
return u
}
// SetEnabled sets the "enabled" field.
func (u *AgentPluginUpsert) SetEnabled(v bool) *AgentPluginUpsert {
u.Set(agentplugin.FieldEnabled, v)
return u
}
// UpdateEnabled sets the "enabled" field to the value that was provided on create.
func (u *AgentPluginUpsert) UpdateEnabled() *AgentPluginUpsert {
u.SetExcluded(agentplugin.FieldEnabled)
return u
}
// SetCreatedAt sets the "created_at" field.
func (u *AgentPluginUpsert) SetCreatedAt(v time.Time) *AgentPluginUpsert {
u.Set(agentplugin.FieldCreatedAt, v)
return u
}
// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
func (u *AgentPluginUpsert) UpdateCreatedAt() *AgentPluginUpsert {
u.SetExcluded(agentplugin.FieldCreatedAt)
return u
}
// SetUpdatedAt sets the "updated_at" field.
func (u *AgentPluginUpsert) SetUpdatedAt(v time.Time) *AgentPluginUpsert {
u.Set(agentplugin.FieldUpdatedAt, v)
return u
}
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
func (u *AgentPluginUpsert) UpdateUpdatedAt() *AgentPluginUpsert {
u.SetExcluded(agentplugin.FieldUpdatedAt)
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.AgentPlugin.Create().
// OnConflict(
// sql.ResolveWithNewValues(),
// sql.ResolveWith(func(u *sql.UpdateSet) {
// u.SetIgnore(agentplugin.FieldID)
// }),
// ).
// Exec(ctx)
func (u *AgentPluginUpsertOne) UpdateNewValues() *AgentPluginUpsertOne {
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(agentplugin.FieldID)
}
}))
return u
}
// Ignore sets each column to itself in case of conflict.
// Using this option is equivalent to using:
//
// client.AgentPlugin.Create().
// OnConflict(sql.ResolveWithIgnore()).
// Exec(ctx)
func (u *AgentPluginUpsertOne) Ignore() *AgentPluginUpsertOne {
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 *AgentPluginUpsertOne) DoNothing() *AgentPluginUpsertOne {
u.create.conflict = append(u.create.conflict, sql.DoNothing())
return u
}
// Update allows overriding fields `UPDATE` values. See the AgentPluginCreate.OnConflict
// documentation for more info.
func (u *AgentPluginUpsertOne) Update(set func(*AgentPluginUpsert)) *AgentPluginUpsertOne {
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
set(&AgentPluginUpsert{UpdateSet: update})
}))
return u
}
// SetRepoID sets the "repo_id" field.
func (u *AgentPluginUpsertOne) SetRepoID(v uuid.UUID) *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.SetRepoID(v)
})
}
// UpdateRepoID sets the "repo_id" field to the value that was provided on create.
func (u *AgentPluginUpsertOne) UpdateRepoID() *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateRepoID()
})
}
// SetName sets the "name" field.
func (u *AgentPluginUpsertOne) SetName(v string) *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.SetName(v)
})
}
// UpdateName sets the "name" field to the value that was provided on create.
func (u *AgentPluginUpsertOne) UpdateName() *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateName()
})
}
// SetDescription sets the "description" field.
func (u *AgentPluginUpsertOne) SetDescription(v string) *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.SetDescription(v)
})
}
// UpdateDescription sets the "description" field to the value that was provided on create.
func (u *AgentPluginUpsertOne) UpdateDescription() *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateDescription()
})
}
// ClearDescription clears the value of the "description" field.
func (u *AgentPluginUpsertOne) ClearDescription() *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.ClearDescription()
})
}
// SetScopeType sets the "scope_type" field.
func (u *AgentPluginUpsertOne) SetScopeType(v agentplugin.ScopeType) *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.SetScopeType(v)
})
}
// UpdateScopeType sets the "scope_type" field to the value that was provided on create.
func (u *AgentPluginUpsertOne) UpdateScopeType() *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateScopeType()
})
}
// SetScopeID sets the "scope_id" field.
func (u *AgentPluginUpsertOne) SetScopeID(v string) *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.SetScopeID(v)
})
}
// UpdateScopeID sets the "scope_id" field to the value that was provided on create.
func (u *AgentPluginUpsertOne) UpdateScopeID() *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateScopeID()
})
}
// SetCreatedBy sets the "created_by" field.
func (u *AgentPluginUpsertOne) SetCreatedBy(v uuid.UUID) *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.SetCreatedBy(v)
})
}
// UpdateCreatedBy sets the "created_by" field to the value that was provided on create.
func (u *AgentPluginUpsertOne) UpdateCreatedBy() *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateCreatedBy()
})
}
// SetActiveVersionID sets the "active_version_id" field.
func (u *AgentPluginUpsertOne) SetActiveVersionID(v uuid.UUID) *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.SetActiveVersionID(v)
})
}
// UpdateActiveVersionID sets the "active_version_id" field to the value that was provided on create.
func (u *AgentPluginUpsertOne) UpdateActiveVersionID() *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateActiveVersionID()
})
}
// ClearActiveVersionID clears the value of the "active_version_id" field.
func (u *AgentPluginUpsertOne) ClearActiveVersionID() *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.ClearActiveVersionID()
})
}
// SetIsForceDelivery sets the "is_force_delivery" field.
func (u *AgentPluginUpsertOne) SetIsForceDelivery(v bool) *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.SetIsForceDelivery(v)
})
}
// UpdateIsForceDelivery sets the "is_force_delivery" field to the value that was provided on create.
func (u *AgentPluginUpsertOne) UpdateIsForceDelivery() *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateIsForceDelivery()
})
}
// SetIsOrphan sets the "is_orphan" field.
func (u *AgentPluginUpsertOne) SetIsOrphan(v bool) *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.SetIsOrphan(v)
})
}
// UpdateIsOrphan sets the "is_orphan" field to the value that was provided on create.
func (u *AgentPluginUpsertOne) UpdateIsOrphan() *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateIsOrphan()
})
}
// SetIsDeleted sets the "is_deleted" field.
func (u *AgentPluginUpsertOne) SetIsDeleted(v bool) *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.SetIsDeleted(v)
})
}
// UpdateIsDeleted sets the "is_deleted" field to the value that was provided on create.
func (u *AgentPluginUpsertOne) UpdateIsDeleted() *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateIsDeleted()
})
}
// SetEnabled sets the "enabled" field.
func (u *AgentPluginUpsertOne) SetEnabled(v bool) *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.SetEnabled(v)
})
}
// UpdateEnabled sets the "enabled" field to the value that was provided on create.
func (u *AgentPluginUpsertOne) UpdateEnabled() *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateEnabled()
})
}
// SetCreatedAt sets the "created_at" field.
func (u *AgentPluginUpsertOne) SetCreatedAt(v time.Time) *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.SetCreatedAt(v)
})
}
// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
func (u *AgentPluginUpsertOne) UpdateCreatedAt() *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateCreatedAt()
})
}
// SetUpdatedAt sets the "updated_at" field.
func (u *AgentPluginUpsertOne) SetUpdatedAt(v time.Time) *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.SetUpdatedAt(v)
})
}
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
func (u *AgentPluginUpsertOne) UpdateUpdatedAt() *AgentPluginUpsertOne {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateUpdatedAt()
})
}
// Exec executes the query.
func (u *AgentPluginUpsertOne) Exec(ctx context.Context) error {
if len(u.create.conflict) == 0 {
return errors.New("db: missing options for AgentPluginCreate.OnConflict")
}
return u.create.Exec(ctx)
}
// ExecX is like Exec, but panics if an error occurs.
func (u *AgentPluginUpsertOne) 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 *AgentPluginUpsertOne) 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("db: AgentPluginUpsertOne.ID is not supported by MySQL driver. Use AgentPluginUpsertOne.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 *AgentPluginUpsertOne) IDX(ctx context.Context) uuid.UUID {
id, err := u.ID(ctx)
if err != nil {
panic(err)
}
return id
}
// AgentPluginCreateBulk is the builder for creating many AgentPlugin entities in bulk.
type AgentPluginCreateBulk struct {
config
err error
builders []*AgentPluginCreate
conflict []sql.ConflictOption
}
// Save creates the AgentPlugin entities in the database.
func (_c *AgentPluginCreateBulk) Save(ctx context.Context) ([]*AgentPlugin, error) {
if _c.err != nil {
return nil, _c.err
}
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
nodes := make([]*AgentPlugin, 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.(*AgentPluginMutation)
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 *AgentPluginCreateBulk) SaveX(ctx context.Context) []*AgentPlugin {
v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
return v
}
// Exec executes the query.
func (_c *AgentPluginCreateBulk) Exec(ctx context.Context) error {
_, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_c *AgentPluginCreateBulk) 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.AgentPlugin.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.AgentPluginUpsert) {
// SetRepoID(v+v).
// }).
// Exec(ctx)
func (_c *AgentPluginCreateBulk) OnConflict(opts ...sql.ConflictOption) *AgentPluginUpsertBulk {
_c.conflict = opts
return &AgentPluginUpsertBulk{
create: _c,
}
}
// OnConflictColumns calls `OnConflict` and configures the columns
// as conflict target. Using this option is equivalent to using:
//
// client.AgentPlugin.Create().
// OnConflict(sql.ConflictColumns(columns...)).
// Exec(ctx)
func (_c *AgentPluginCreateBulk) OnConflictColumns(columns ...string) *AgentPluginUpsertBulk {
_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
return &AgentPluginUpsertBulk{
create: _c,
}
}
// AgentPluginUpsertBulk is the builder for "upsert"-ing
// a bulk of AgentPlugin nodes.
type AgentPluginUpsertBulk struct {
create *AgentPluginCreateBulk
}
// UpdateNewValues updates the mutable fields using the new values that
// were set on create. Using this option is equivalent to using:
//
// client.AgentPlugin.Create().
// OnConflict(
// sql.ResolveWithNewValues(),
// sql.ResolveWith(func(u *sql.UpdateSet) {
// u.SetIgnore(agentplugin.FieldID)
// }),
// ).
// Exec(ctx)
func (u *AgentPluginUpsertBulk) UpdateNewValues() *AgentPluginUpsertBulk {
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(agentplugin.FieldID)
}
}
}))
return u
}
// Ignore sets each column to itself in case of conflict.
// Using this option is equivalent to using:
//
// client.AgentPlugin.Create().
// OnConflict(sql.ResolveWithIgnore()).
// Exec(ctx)
func (u *AgentPluginUpsertBulk) Ignore() *AgentPluginUpsertBulk {
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 *AgentPluginUpsertBulk) DoNothing() *AgentPluginUpsertBulk {
u.create.conflict = append(u.create.conflict, sql.DoNothing())
return u
}
// Update allows overriding fields `UPDATE` values. See the AgentPluginCreateBulk.OnConflict
// documentation for more info.
func (u *AgentPluginUpsertBulk) Update(set func(*AgentPluginUpsert)) *AgentPluginUpsertBulk {
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
set(&AgentPluginUpsert{UpdateSet: update})
}))
return u
}
// SetRepoID sets the "repo_id" field.
func (u *AgentPluginUpsertBulk) SetRepoID(v uuid.UUID) *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.SetRepoID(v)
})
}
// UpdateRepoID sets the "repo_id" field to the value that was provided on create.
func (u *AgentPluginUpsertBulk) UpdateRepoID() *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateRepoID()
})
}
// SetName sets the "name" field.
func (u *AgentPluginUpsertBulk) SetName(v string) *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.SetName(v)
})
}
// UpdateName sets the "name" field to the value that was provided on create.
func (u *AgentPluginUpsertBulk) UpdateName() *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateName()
})
}
// SetDescription sets the "description" field.
func (u *AgentPluginUpsertBulk) SetDescription(v string) *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.SetDescription(v)
})
}
// UpdateDescription sets the "description" field to the value that was provided on create.
func (u *AgentPluginUpsertBulk) UpdateDescription() *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateDescription()
})
}
// ClearDescription clears the value of the "description" field.
func (u *AgentPluginUpsertBulk) ClearDescription() *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.ClearDescription()
})
}
// SetScopeType sets the "scope_type" field.
func (u *AgentPluginUpsertBulk) SetScopeType(v agentplugin.ScopeType) *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.SetScopeType(v)
})
}
// UpdateScopeType sets the "scope_type" field to the value that was provided on create.
func (u *AgentPluginUpsertBulk) UpdateScopeType() *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateScopeType()
})
}
// SetScopeID sets the "scope_id" field.
func (u *AgentPluginUpsertBulk) SetScopeID(v string) *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.SetScopeID(v)
})
}
// UpdateScopeID sets the "scope_id" field to the value that was provided on create.
func (u *AgentPluginUpsertBulk) UpdateScopeID() *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateScopeID()
})
}
// SetCreatedBy sets the "created_by" field.
func (u *AgentPluginUpsertBulk) SetCreatedBy(v uuid.UUID) *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.SetCreatedBy(v)
})
}
// UpdateCreatedBy sets the "created_by" field to the value that was provided on create.
func (u *AgentPluginUpsertBulk) UpdateCreatedBy() *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateCreatedBy()
})
}
// SetActiveVersionID sets the "active_version_id" field.
func (u *AgentPluginUpsertBulk) SetActiveVersionID(v uuid.UUID) *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.SetActiveVersionID(v)
})
}
// UpdateActiveVersionID sets the "active_version_id" field to the value that was provided on create.
func (u *AgentPluginUpsertBulk) UpdateActiveVersionID() *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateActiveVersionID()
})
}
// ClearActiveVersionID clears the value of the "active_version_id" field.
func (u *AgentPluginUpsertBulk) ClearActiveVersionID() *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.ClearActiveVersionID()
})
}
// SetIsForceDelivery sets the "is_force_delivery" field.
func (u *AgentPluginUpsertBulk) SetIsForceDelivery(v bool) *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.SetIsForceDelivery(v)
})
}
// UpdateIsForceDelivery sets the "is_force_delivery" field to the value that was provided on create.
func (u *AgentPluginUpsertBulk) UpdateIsForceDelivery() *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateIsForceDelivery()
})
}
// SetIsOrphan sets the "is_orphan" field.
func (u *AgentPluginUpsertBulk) SetIsOrphan(v bool) *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.SetIsOrphan(v)
})
}
// UpdateIsOrphan sets the "is_orphan" field to the value that was provided on create.
func (u *AgentPluginUpsertBulk) UpdateIsOrphan() *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateIsOrphan()
})
}
// SetIsDeleted sets the "is_deleted" field.
func (u *AgentPluginUpsertBulk) SetIsDeleted(v bool) *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.SetIsDeleted(v)
})
}
// UpdateIsDeleted sets the "is_deleted" field to the value that was provided on create.
func (u *AgentPluginUpsertBulk) UpdateIsDeleted() *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateIsDeleted()
})
}
// SetEnabled sets the "enabled" field.
func (u *AgentPluginUpsertBulk) SetEnabled(v bool) *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.SetEnabled(v)
})
}
// UpdateEnabled sets the "enabled" field to the value that was provided on create.
func (u *AgentPluginUpsertBulk) UpdateEnabled() *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateEnabled()
})
}
// SetCreatedAt sets the "created_at" field.
func (u *AgentPluginUpsertBulk) SetCreatedAt(v time.Time) *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.SetCreatedAt(v)
})
}
// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
func (u *AgentPluginUpsertBulk) UpdateCreatedAt() *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateCreatedAt()
})
}
// SetUpdatedAt sets the "updated_at" field.
func (u *AgentPluginUpsertBulk) SetUpdatedAt(v time.Time) *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.SetUpdatedAt(v)
})
}
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
func (u *AgentPluginUpsertBulk) UpdateUpdatedAt() *AgentPluginUpsertBulk {
return u.Update(func(s *AgentPluginUpsert) {
s.UpdateUpdatedAt()
})
}
// Exec executes the query.
func (u *AgentPluginUpsertBulk) 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("db: OnConflict was set for builder %d. Set it on the AgentPluginCreateBulk instead", i)
}
}
if len(u.create.conflict) == 0 {
return errors.New("db: missing options for AgentPluginCreateBulk.OnConflict")
}
return u.create.Exec(ctx)
}
// ExecX is like Exec, but panics if an error occurs.
func (u *AgentPluginUpsertBulk) ExecX(ctx context.Context) {
if err := u.create.Exec(ctx); err != nil {
panic(err)
}
}