mirror of
https://github.com/chaitin/MonkeyCode.git
synced 2026-11-29 16:18:40 +08:00
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1753 lines
58 KiB
Go
1753 lines
58 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/ent/types"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// AgentPluginRepoCreate is the builder for creating a AgentPluginRepo entity.
|
|
type AgentPluginRepoCreate struct {
|
|
config
|
|
mutation *AgentPluginRepoMutation
|
|
hooks []Hook
|
|
conflict []sql.ConflictOption
|
|
}
|
|
|
|
// SetName sets the "name" field.
|
|
func (_c *AgentPluginRepoCreate) SetName(v string) *AgentPluginRepoCreate {
|
|
_c.mutation.SetName(v)
|
|
return _c
|
|
}
|
|
|
|
// SetScopeType sets the "scope_type" field.
|
|
func (_c *AgentPluginRepoCreate) SetScopeType(v agentpluginrepo.ScopeType) *AgentPluginRepoCreate {
|
|
_c.mutation.SetScopeType(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableScopeType sets the "scope_type" field if the given value is not nil.
|
|
func (_c *AgentPluginRepoCreate) SetNillableScopeType(v *agentpluginrepo.ScopeType) *AgentPluginRepoCreate {
|
|
if v != nil {
|
|
_c.SetScopeType(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetScopeID sets the "scope_id" field.
|
|
func (_c *AgentPluginRepoCreate) SetScopeID(v string) *AgentPluginRepoCreate {
|
|
_c.mutation.SetScopeID(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableScopeID sets the "scope_id" field if the given value is not nil.
|
|
func (_c *AgentPluginRepoCreate) SetNillableScopeID(v *string) *AgentPluginRepoCreate {
|
|
if v != nil {
|
|
_c.SetScopeID(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetCreatedBy sets the "created_by" field.
|
|
func (_c *AgentPluginRepoCreate) SetCreatedBy(v uuid.UUID) *AgentPluginRepoCreate {
|
|
_c.mutation.SetCreatedBy(v)
|
|
return _c
|
|
}
|
|
|
|
// SetSourceType sets the "source_type" field.
|
|
func (_c *AgentPluginRepoCreate) SetSourceType(v agentpluginrepo.SourceType) *AgentPluginRepoCreate {
|
|
_c.mutation.SetSourceType(v)
|
|
return _c
|
|
}
|
|
|
|
// SetGithubURL sets the "github_url" field.
|
|
func (_c *AgentPluginRepoCreate) SetGithubURL(v string) *AgentPluginRepoCreate {
|
|
_c.mutation.SetGithubURL(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableGithubURL sets the "github_url" field if the given value is not nil.
|
|
func (_c *AgentPluginRepoCreate) SetNillableGithubURL(v *string) *AgentPluginRepoCreate {
|
|
if v != nil {
|
|
_c.SetGithubURL(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetRefType sets the "ref_type" field.
|
|
func (_c *AgentPluginRepoCreate) SetRefType(v agentpluginrepo.RefType) *AgentPluginRepoCreate {
|
|
_c.mutation.SetRefType(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableRefType sets the "ref_type" field if the given value is not nil.
|
|
func (_c *AgentPluginRepoCreate) SetNillableRefType(v *agentpluginrepo.RefType) *AgentPluginRepoCreate {
|
|
if v != nil {
|
|
_c.SetRefType(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetRefValue sets the "ref_value" field.
|
|
func (_c *AgentPluginRepoCreate) SetRefValue(v string) *AgentPluginRepoCreate {
|
|
_c.mutation.SetRefValue(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableRefValue sets the "ref_value" field if the given value is not nil.
|
|
func (_c *AgentPluginRepoCreate) SetNillableRefValue(v *string) *AgentPluginRepoCreate {
|
|
if v != nil {
|
|
_c.SetRefValue(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetLastUploadFilename sets the "last_upload_filename" field.
|
|
func (_c *AgentPluginRepoCreate) SetLastUploadFilename(v string) *AgentPluginRepoCreate {
|
|
_c.mutation.SetLastUploadFilename(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableLastUploadFilename sets the "last_upload_filename" field if the given value is not nil.
|
|
func (_c *AgentPluginRepoCreate) SetNillableLastUploadFilename(v *string) *AgentPluginRepoCreate {
|
|
if v != nil {
|
|
_c.SetLastUploadFilename(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetLastUploadAt sets the "last_upload_at" field.
|
|
func (_c *AgentPluginRepoCreate) SetLastUploadAt(v time.Time) *AgentPluginRepoCreate {
|
|
_c.mutation.SetLastUploadAt(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableLastUploadAt sets the "last_upload_at" field if the given value is not nil.
|
|
func (_c *AgentPluginRepoCreate) SetNillableLastUploadAt(v *time.Time) *AgentPluginRepoCreate {
|
|
if v != nil {
|
|
_c.SetLastUploadAt(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetPluginDiscoveryAutoPackageJSON sets the "plugin_discovery_auto_package_json" field.
|
|
func (_c *AgentPluginRepoCreate) SetPluginDiscoveryAutoPackageJSON(v bool) *AgentPluginRepoCreate {
|
|
_c.mutation.SetPluginDiscoveryAutoPackageJSON(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillablePluginDiscoveryAutoPackageJSON sets the "plugin_discovery_auto_package_json" field if the given value is not nil.
|
|
func (_c *AgentPluginRepoCreate) SetNillablePluginDiscoveryAutoPackageJSON(v *bool) *AgentPluginRepoCreate {
|
|
if v != nil {
|
|
_c.SetPluginDiscoveryAutoPackageJSON(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetPluginManualEntries sets the "plugin_manual_entries" field.
|
|
func (_c *AgentPluginRepoCreate) SetPluginManualEntries(v types.PluginManualEntries) *AgentPluginRepoCreate {
|
|
_c.mutation.SetPluginManualEntries(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNpmPackageName sets the "npm_package_name" field.
|
|
func (_c *AgentPluginRepoCreate) SetNpmPackageName(v string) *AgentPluginRepoCreate {
|
|
_c.mutation.SetNpmPackageName(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableNpmPackageName sets the "npm_package_name" field if the given value is not nil.
|
|
func (_c *AgentPluginRepoCreate) SetNillableNpmPackageName(v *string) *AgentPluginRepoCreate {
|
|
if v != nil {
|
|
_c.SetNpmPackageName(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetNpmVersionSpec sets the "npm_version_spec" field.
|
|
func (_c *AgentPluginRepoCreate) SetNpmVersionSpec(v string) *AgentPluginRepoCreate {
|
|
_c.mutation.SetNpmVersionSpec(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableNpmVersionSpec sets the "npm_version_spec" field if the given value is not nil.
|
|
func (_c *AgentPluginRepoCreate) SetNillableNpmVersionSpec(v *string) *AgentPluginRepoCreate {
|
|
if v != nil {
|
|
_c.SetNpmVersionSpec(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetNpmRegistryURL sets the "npm_registry_url" field.
|
|
func (_c *AgentPluginRepoCreate) SetNpmRegistryURL(v string) *AgentPluginRepoCreate {
|
|
_c.mutation.SetNpmRegistryURL(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableNpmRegistryURL sets the "npm_registry_url" field if the given value is not nil.
|
|
func (_c *AgentPluginRepoCreate) SetNillableNpmRegistryURL(v *string) *AgentPluginRepoCreate {
|
|
if v != nil {
|
|
_c.SetNpmRegistryURL(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetIsDeleted sets the "is_deleted" field.
|
|
func (_c *AgentPluginRepoCreate) SetIsDeleted(v bool) *AgentPluginRepoCreate {
|
|
_c.mutation.SetIsDeleted(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableIsDeleted sets the "is_deleted" field if the given value is not nil.
|
|
func (_c *AgentPluginRepoCreate) SetNillableIsDeleted(v *bool) *AgentPluginRepoCreate {
|
|
if v != nil {
|
|
_c.SetIsDeleted(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (_c *AgentPluginRepoCreate) SetCreatedAt(v time.Time) *AgentPluginRepoCreate {
|
|
_c.mutation.SetCreatedAt(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
|
func (_c *AgentPluginRepoCreate) SetNillableCreatedAt(v *time.Time) *AgentPluginRepoCreate {
|
|
if v != nil {
|
|
_c.SetCreatedAt(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (_c *AgentPluginRepoCreate) SetUpdatedAt(v time.Time) *AgentPluginRepoCreate {
|
|
_c.mutation.SetUpdatedAt(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
|
|
func (_c *AgentPluginRepoCreate) SetNillableUpdatedAt(v *time.Time) *AgentPluginRepoCreate {
|
|
if v != nil {
|
|
_c.SetUpdatedAt(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetID sets the "id" field.
|
|
func (_c *AgentPluginRepoCreate) SetID(v uuid.UUID) *AgentPluginRepoCreate {
|
|
_c.mutation.SetID(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableID sets the "id" field if the given value is not nil.
|
|
func (_c *AgentPluginRepoCreate) SetNillableID(v *uuid.UUID) *AgentPluginRepoCreate {
|
|
if v != nil {
|
|
_c.SetID(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// AddPluginIDs adds the "plugins" edge to the AgentPlugin entity by IDs.
|
|
func (_c *AgentPluginRepoCreate) AddPluginIDs(ids ...uuid.UUID) *AgentPluginRepoCreate {
|
|
_c.mutation.AddPluginIDs(ids...)
|
|
return _c
|
|
}
|
|
|
|
// AddPlugins adds the "plugins" edges to the AgentPlugin entity.
|
|
func (_c *AgentPluginRepoCreate) AddPlugins(v ...*AgentPlugin) *AgentPluginRepoCreate {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _c.AddPluginIDs(ids...)
|
|
}
|
|
|
|
// Mutation returns the AgentPluginRepoMutation object of the builder.
|
|
func (_c *AgentPluginRepoCreate) Mutation() *AgentPluginRepoMutation {
|
|
return _c.mutation
|
|
}
|
|
|
|
// Save creates the AgentPluginRepo in the database.
|
|
func (_c *AgentPluginRepoCreate) Save(ctx context.Context) (*AgentPluginRepo, error) {
|
|
_c.defaults()
|
|
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
|
}
|
|
|
|
// SaveX calls Save and panics if Save returns an error.
|
|
func (_c *AgentPluginRepoCreate) SaveX(ctx context.Context) *AgentPluginRepo {
|
|
v, err := _c.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return v
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_c *AgentPluginRepoCreate) Exec(ctx context.Context) error {
|
|
_, err := _c.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_c *AgentPluginRepoCreate) 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 *AgentPluginRepoCreate) defaults() {
|
|
if _, ok := _c.mutation.ScopeType(); !ok {
|
|
v := agentpluginrepo.DefaultScopeType
|
|
_c.mutation.SetScopeType(v)
|
|
}
|
|
if _, ok := _c.mutation.ScopeID(); !ok {
|
|
v := agentpluginrepo.DefaultScopeID
|
|
_c.mutation.SetScopeID(v)
|
|
}
|
|
if _, ok := _c.mutation.PluginDiscoveryAutoPackageJSON(); !ok {
|
|
v := agentpluginrepo.DefaultPluginDiscoveryAutoPackageJSON
|
|
_c.mutation.SetPluginDiscoveryAutoPackageJSON(v)
|
|
}
|
|
if _, ok := _c.mutation.IsDeleted(); !ok {
|
|
v := agentpluginrepo.DefaultIsDeleted
|
|
_c.mutation.SetIsDeleted(v)
|
|
}
|
|
if _, ok := _c.mutation.CreatedAt(); !ok {
|
|
v := agentpluginrepo.DefaultCreatedAt()
|
|
_c.mutation.SetCreatedAt(v)
|
|
}
|
|
if _, ok := _c.mutation.UpdatedAt(); !ok {
|
|
v := agentpluginrepo.DefaultUpdatedAt()
|
|
_c.mutation.SetUpdatedAt(v)
|
|
}
|
|
if _, ok := _c.mutation.ID(); !ok {
|
|
v := agentpluginrepo.DefaultID()
|
|
_c.mutation.SetID(v)
|
|
}
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
func (_c *AgentPluginRepoCreate) check() error {
|
|
if _, ok := _c.mutation.Name(); !ok {
|
|
return &ValidationError{Name: "name", err: errors.New(`db: missing required field "AgentPluginRepo.name"`)}
|
|
}
|
|
if v, ok := _c.mutation.Name(); ok {
|
|
if err := agentpluginrepo.NameValidator(v); err != nil {
|
|
return &ValidationError{Name: "name", err: fmt.Errorf(`db: validator failed for field "AgentPluginRepo.name": %w`, err)}
|
|
}
|
|
}
|
|
if _, ok := _c.mutation.ScopeType(); !ok {
|
|
return &ValidationError{Name: "scope_type", err: errors.New(`db: missing required field "AgentPluginRepo.scope_type"`)}
|
|
}
|
|
if v, ok := _c.mutation.ScopeType(); ok {
|
|
if err := agentpluginrepo.ScopeTypeValidator(v); err != nil {
|
|
return &ValidationError{Name: "scope_type", err: fmt.Errorf(`db: validator failed for field "AgentPluginRepo.scope_type": %w`, err)}
|
|
}
|
|
}
|
|
if _, ok := _c.mutation.ScopeID(); !ok {
|
|
return &ValidationError{Name: "scope_id", err: errors.New(`db: missing required field "AgentPluginRepo.scope_id"`)}
|
|
}
|
|
if _, ok := _c.mutation.CreatedBy(); !ok {
|
|
return &ValidationError{Name: "created_by", err: errors.New(`db: missing required field "AgentPluginRepo.created_by"`)}
|
|
}
|
|
if _, ok := _c.mutation.SourceType(); !ok {
|
|
return &ValidationError{Name: "source_type", err: errors.New(`db: missing required field "AgentPluginRepo.source_type"`)}
|
|
}
|
|
if v, ok := _c.mutation.SourceType(); ok {
|
|
if err := agentpluginrepo.SourceTypeValidator(v); err != nil {
|
|
return &ValidationError{Name: "source_type", err: fmt.Errorf(`db: validator failed for field "AgentPluginRepo.source_type": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _c.mutation.RefType(); ok {
|
|
if err := agentpluginrepo.RefTypeValidator(v); err != nil {
|
|
return &ValidationError{Name: "ref_type", err: fmt.Errorf(`db: validator failed for field "AgentPluginRepo.ref_type": %w`, err)}
|
|
}
|
|
}
|
|
if _, ok := _c.mutation.PluginDiscoveryAutoPackageJSON(); !ok {
|
|
return &ValidationError{Name: "plugin_discovery_auto_package_json", err: errors.New(`db: missing required field "AgentPluginRepo.plugin_discovery_auto_package_json"`)}
|
|
}
|
|
if _, ok := _c.mutation.IsDeleted(); !ok {
|
|
return &ValidationError{Name: "is_deleted", err: errors.New(`db: missing required field "AgentPluginRepo.is_deleted"`)}
|
|
}
|
|
if _, ok := _c.mutation.CreatedAt(); !ok {
|
|
return &ValidationError{Name: "created_at", err: errors.New(`db: missing required field "AgentPluginRepo.created_at"`)}
|
|
}
|
|
if _, ok := _c.mutation.UpdatedAt(); !ok {
|
|
return &ValidationError{Name: "updated_at", err: errors.New(`db: missing required field "AgentPluginRepo.updated_at"`)}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (_c *AgentPluginRepoCreate) sqlSave(ctx context.Context) (*AgentPluginRepo, 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 *AgentPluginRepoCreate) createSpec() (*AgentPluginRepo, *sqlgraph.CreateSpec) {
|
|
var (
|
|
_node = &AgentPluginRepo{config: _c.config}
|
|
_spec = sqlgraph.NewCreateSpec(agentpluginrepo.Table, sqlgraph.NewFieldSpec(agentpluginrepo.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(agentpluginrepo.FieldName, field.TypeString, value)
|
|
_node.Name = value
|
|
}
|
|
if value, ok := _c.mutation.ScopeType(); ok {
|
|
_spec.SetField(agentpluginrepo.FieldScopeType, field.TypeEnum, value)
|
|
_node.ScopeType = value
|
|
}
|
|
if value, ok := _c.mutation.ScopeID(); ok {
|
|
_spec.SetField(agentpluginrepo.FieldScopeID, field.TypeString, value)
|
|
_node.ScopeID = value
|
|
}
|
|
if value, ok := _c.mutation.CreatedBy(); ok {
|
|
_spec.SetField(agentpluginrepo.FieldCreatedBy, field.TypeUUID, value)
|
|
_node.CreatedBy = value
|
|
}
|
|
if value, ok := _c.mutation.SourceType(); ok {
|
|
_spec.SetField(agentpluginrepo.FieldSourceType, field.TypeEnum, value)
|
|
_node.SourceType = value
|
|
}
|
|
if value, ok := _c.mutation.GithubURL(); ok {
|
|
_spec.SetField(agentpluginrepo.FieldGithubURL, field.TypeString, value)
|
|
_node.GithubURL = &value
|
|
}
|
|
if value, ok := _c.mutation.RefType(); ok {
|
|
_spec.SetField(agentpluginrepo.FieldRefType, field.TypeEnum, value)
|
|
_node.RefType = &value
|
|
}
|
|
if value, ok := _c.mutation.RefValue(); ok {
|
|
_spec.SetField(agentpluginrepo.FieldRefValue, field.TypeString, value)
|
|
_node.RefValue = &value
|
|
}
|
|
if value, ok := _c.mutation.LastUploadFilename(); ok {
|
|
_spec.SetField(agentpluginrepo.FieldLastUploadFilename, field.TypeString, value)
|
|
_node.LastUploadFilename = &value
|
|
}
|
|
if value, ok := _c.mutation.LastUploadAt(); ok {
|
|
_spec.SetField(agentpluginrepo.FieldLastUploadAt, field.TypeTime, value)
|
|
_node.LastUploadAt = &value
|
|
}
|
|
if value, ok := _c.mutation.PluginDiscoveryAutoPackageJSON(); ok {
|
|
_spec.SetField(agentpluginrepo.FieldPluginDiscoveryAutoPackageJSON, field.TypeBool, value)
|
|
_node.PluginDiscoveryAutoPackageJSON = value
|
|
}
|
|
if value, ok := _c.mutation.PluginManualEntries(); ok {
|
|
_spec.SetField(agentpluginrepo.FieldPluginManualEntries, field.TypeJSON, value)
|
|
_node.PluginManualEntries = value
|
|
}
|
|
if value, ok := _c.mutation.NpmPackageName(); ok {
|
|
_spec.SetField(agentpluginrepo.FieldNpmPackageName, field.TypeString, value)
|
|
_node.NpmPackageName = &value
|
|
}
|
|
if value, ok := _c.mutation.NpmVersionSpec(); ok {
|
|
_spec.SetField(agentpluginrepo.FieldNpmVersionSpec, field.TypeString, value)
|
|
_node.NpmVersionSpec = &value
|
|
}
|
|
if value, ok := _c.mutation.NpmRegistryURL(); ok {
|
|
_spec.SetField(agentpluginrepo.FieldNpmRegistryURL, field.TypeString, value)
|
|
_node.NpmRegistryURL = &value
|
|
}
|
|
if value, ok := _c.mutation.IsDeleted(); ok {
|
|
_spec.SetField(agentpluginrepo.FieldIsDeleted, field.TypeBool, value)
|
|
_node.IsDeleted = value
|
|
}
|
|
if value, ok := _c.mutation.CreatedAt(); ok {
|
|
_spec.SetField(agentpluginrepo.FieldCreatedAt, field.TypeTime, value)
|
|
_node.CreatedAt = value
|
|
}
|
|
if value, ok := _c.mutation.UpdatedAt(); ok {
|
|
_spec.SetField(agentpluginrepo.FieldUpdatedAt, field.TypeTime, value)
|
|
_node.UpdatedAt = value
|
|
}
|
|
if nodes := _c.mutation.PluginsIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: false,
|
|
Table: agentpluginrepo.PluginsTable,
|
|
Columns: []string{agentpluginrepo.PluginsColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(agentplugin.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.AgentPluginRepo.Create().
|
|
// SetName(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.AgentPluginRepoUpsert) {
|
|
// SetName(v+v).
|
|
// }).
|
|
// Exec(ctx)
|
|
func (_c *AgentPluginRepoCreate) OnConflict(opts ...sql.ConflictOption) *AgentPluginRepoUpsertOne {
|
|
_c.conflict = opts
|
|
return &AgentPluginRepoUpsertOne{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
// OnConflictColumns calls `OnConflict` and configures the columns
|
|
// as conflict target. Using this option is equivalent to using:
|
|
//
|
|
// client.AgentPluginRepo.Create().
|
|
// OnConflict(sql.ConflictColumns(columns...)).
|
|
// Exec(ctx)
|
|
func (_c *AgentPluginRepoCreate) OnConflictColumns(columns ...string) *AgentPluginRepoUpsertOne {
|
|
_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
|
|
return &AgentPluginRepoUpsertOne{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
type (
|
|
// AgentPluginRepoUpsertOne is the builder for "upsert"-ing
|
|
// one AgentPluginRepo node.
|
|
AgentPluginRepoUpsertOne struct {
|
|
create *AgentPluginRepoCreate
|
|
}
|
|
|
|
// AgentPluginRepoUpsert is the "OnConflict" setter.
|
|
AgentPluginRepoUpsert struct {
|
|
*sql.UpdateSet
|
|
}
|
|
)
|
|
|
|
// SetName sets the "name" field.
|
|
func (u *AgentPluginRepoUpsert) SetName(v string) *AgentPluginRepoUpsert {
|
|
u.Set(agentpluginrepo.FieldName, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateName sets the "name" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsert) UpdateName() *AgentPluginRepoUpsert {
|
|
u.SetExcluded(agentpluginrepo.FieldName)
|
|
return u
|
|
}
|
|
|
|
// SetScopeType sets the "scope_type" field.
|
|
func (u *AgentPluginRepoUpsert) SetScopeType(v agentpluginrepo.ScopeType) *AgentPluginRepoUpsert {
|
|
u.Set(agentpluginrepo.FieldScopeType, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateScopeType sets the "scope_type" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsert) UpdateScopeType() *AgentPluginRepoUpsert {
|
|
u.SetExcluded(agentpluginrepo.FieldScopeType)
|
|
return u
|
|
}
|
|
|
|
// SetScopeID sets the "scope_id" field.
|
|
func (u *AgentPluginRepoUpsert) SetScopeID(v string) *AgentPluginRepoUpsert {
|
|
u.Set(agentpluginrepo.FieldScopeID, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateScopeID sets the "scope_id" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsert) UpdateScopeID() *AgentPluginRepoUpsert {
|
|
u.SetExcluded(agentpluginrepo.FieldScopeID)
|
|
return u
|
|
}
|
|
|
|
// SetCreatedBy sets the "created_by" field.
|
|
func (u *AgentPluginRepoUpsert) SetCreatedBy(v uuid.UUID) *AgentPluginRepoUpsert {
|
|
u.Set(agentpluginrepo.FieldCreatedBy, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateCreatedBy sets the "created_by" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsert) UpdateCreatedBy() *AgentPluginRepoUpsert {
|
|
u.SetExcluded(agentpluginrepo.FieldCreatedBy)
|
|
return u
|
|
}
|
|
|
|
// SetSourceType sets the "source_type" field.
|
|
func (u *AgentPluginRepoUpsert) SetSourceType(v agentpluginrepo.SourceType) *AgentPluginRepoUpsert {
|
|
u.Set(agentpluginrepo.FieldSourceType, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateSourceType sets the "source_type" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsert) UpdateSourceType() *AgentPluginRepoUpsert {
|
|
u.SetExcluded(agentpluginrepo.FieldSourceType)
|
|
return u
|
|
}
|
|
|
|
// SetGithubURL sets the "github_url" field.
|
|
func (u *AgentPluginRepoUpsert) SetGithubURL(v string) *AgentPluginRepoUpsert {
|
|
u.Set(agentpluginrepo.FieldGithubURL, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateGithubURL sets the "github_url" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsert) UpdateGithubURL() *AgentPluginRepoUpsert {
|
|
u.SetExcluded(agentpluginrepo.FieldGithubURL)
|
|
return u
|
|
}
|
|
|
|
// ClearGithubURL clears the value of the "github_url" field.
|
|
func (u *AgentPluginRepoUpsert) ClearGithubURL() *AgentPluginRepoUpsert {
|
|
u.SetNull(agentpluginrepo.FieldGithubURL)
|
|
return u
|
|
}
|
|
|
|
// SetRefType sets the "ref_type" field.
|
|
func (u *AgentPluginRepoUpsert) SetRefType(v agentpluginrepo.RefType) *AgentPluginRepoUpsert {
|
|
u.Set(agentpluginrepo.FieldRefType, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateRefType sets the "ref_type" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsert) UpdateRefType() *AgentPluginRepoUpsert {
|
|
u.SetExcluded(agentpluginrepo.FieldRefType)
|
|
return u
|
|
}
|
|
|
|
// ClearRefType clears the value of the "ref_type" field.
|
|
func (u *AgentPluginRepoUpsert) ClearRefType() *AgentPluginRepoUpsert {
|
|
u.SetNull(agentpluginrepo.FieldRefType)
|
|
return u
|
|
}
|
|
|
|
// SetRefValue sets the "ref_value" field.
|
|
func (u *AgentPluginRepoUpsert) SetRefValue(v string) *AgentPluginRepoUpsert {
|
|
u.Set(agentpluginrepo.FieldRefValue, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateRefValue sets the "ref_value" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsert) UpdateRefValue() *AgentPluginRepoUpsert {
|
|
u.SetExcluded(agentpluginrepo.FieldRefValue)
|
|
return u
|
|
}
|
|
|
|
// ClearRefValue clears the value of the "ref_value" field.
|
|
func (u *AgentPluginRepoUpsert) ClearRefValue() *AgentPluginRepoUpsert {
|
|
u.SetNull(agentpluginrepo.FieldRefValue)
|
|
return u
|
|
}
|
|
|
|
// SetLastUploadFilename sets the "last_upload_filename" field.
|
|
func (u *AgentPluginRepoUpsert) SetLastUploadFilename(v string) *AgentPluginRepoUpsert {
|
|
u.Set(agentpluginrepo.FieldLastUploadFilename, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateLastUploadFilename sets the "last_upload_filename" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsert) UpdateLastUploadFilename() *AgentPluginRepoUpsert {
|
|
u.SetExcluded(agentpluginrepo.FieldLastUploadFilename)
|
|
return u
|
|
}
|
|
|
|
// ClearLastUploadFilename clears the value of the "last_upload_filename" field.
|
|
func (u *AgentPluginRepoUpsert) ClearLastUploadFilename() *AgentPluginRepoUpsert {
|
|
u.SetNull(agentpluginrepo.FieldLastUploadFilename)
|
|
return u
|
|
}
|
|
|
|
// SetLastUploadAt sets the "last_upload_at" field.
|
|
func (u *AgentPluginRepoUpsert) SetLastUploadAt(v time.Time) *AgentPluginRepoUpsert {
|
|
u.Set(agentpluginrepo.FieldLastUploadAt, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateLastUploadAt sets the "last_upload_at" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsert) UpdateLastUploadAt() *AgentPluginRepoUpsert {
|
|
u.SetExcluded(agentpluginrepo.FieldLastUploadAt)
|
|
return u
|
|
}
|
|
|
|
// ClearLastUploadAt clears the value of the "last_upload_at" field.
|
|
func (u *AgentPluginRepoUpsert) ClearLastUploadAt() *AgentPluginRepoUpsert {
|
|
u.SetNull(agentpluginrepo.FieldLastUploadAt)
|
|
return u
|
|
}
|
|
|
|
// SetPluginDiscoveryAutoPackageJSON sets the "plugin_discovery_auto_package_json" field.
|
|
func (u *AgentPluginRepoUpsert) SetPluginDiscoveryAutoPackageJSON(v bool) *AgentPluginRepoUpsert {
|
|
u.Set(agentpluginrepo.FieldPluginDiscoveryAutoPackageJSON, v)
|
|
return u
|
|
}
|
|
|
|
// UpdatePluginDiscoveryAutoPackageJSON sets the "plugin_discovery_auto_package_json" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsert) UpdatePluginDiscoveryAutoPackageJSON() *AgentPluginRepoUpsert {
|
|
u.SetExcluded(agentpluginrepo.FieldPluginDiscoveryAutoPackageJSON)
|
|
return u
|
|
}
|
|
|
|
// SetPluginManualEntries sets the "plugin_manual_entries" field.
|
|
func (u *AgentPluginRepoUpsert) SetPluginManualEntries(v types.PluginManualEntries) *AgentPluginRepoUpsert {
|
|
u.Set(agentpluginrepo.FieldPluginManualEntries, v)
|
|
return u
|
|
}
|
|
|
|
// UpdatePluginManualEntries sets the "plugin_manual_entries" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsert) UpdatePluginManualEntries() *AgentPluginRepoUpsert {
|
|
u.SetExcluded(agentpluginrepo.FieldPluginManualEntries)
|
|
return u
|
|
}
|
|
|
|
// ClearPluginManualEntries clears the value of the "plugin_manual_entries" field.
|
|
func (u *AgentPluginRepoUpsert) ClearPluginManualEntries() *AgentPluginRepoUpsert {
|
|
u.SetNull(agentpluginrepo.FieldPluginManualEntries)
|
|
return u
|
|
}
|
|
|
|
// SetNpmPackageName sets the "npm_package_name" field.
|
|
func (u *AgentPluginRepoUpsert) SetNpmPackageName(v string) *AgentPluginRepoUpsert {
|
|
u.Set(agentpluginrepo.FieldNpmPackageName, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateNpmPackageName sets the "npm_package_name" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsert) UpdateNpmPackageName() *AgentPluginRepoUpsert {
|
|
u.SetExcluded(agentpluginrepo.FieldNpmPackageName)
|
|
return u
|
|
}
|
|
|
|
// ClearNpmPackageName clears the value of the "npm_package_name" field.
|
|
func (u *AgentPluginRepoUpsert) ClearNpmPackageName() *AgentPluginRepoUpsert {
|
|
u.SetNull(agentpluginrepo.FieldNpmPackageName)
|
|
return u
|
|
}
|
|
|
|
// SetNpmVersionSpec sets the "npm_version_spec" field.
|
|
func (u *AgentPluginRepoUpsert) SetNpmVersionSpec(v string) *AgentPluginRepoUpsert {
|
|
u.Set(agentpluginrepo.FieldNpmVersionSpec, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateNpmVersionSpec sets the "npm_version_spec" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsert) UpdateNpmVersionSpec() *AgentPluginRepoUpsert {
|
|
u.SetExcluded(agentpluginrepo.FieldNpmVersionSpec)
|
|
return u
|
|
}
|
|
|
|
// ClearNpmVersionSpec clears the value of the "npm_version_spec" field.
|
|
func (u *AgentPluginRepoUpsert) ClearNpmVersionSpec() *AgentPluginRepoUpsert {
|
|
u.SetNull(agentpluginrepo.FieldNpmVersionSpec)
|
|
return u
|
|
}
|
|
|
|
// SetNpmRegistryURL sets the "npm_registry_url" field.
|
|
func (u *AgentPluginRepoUpsert) SetNpmRegistryURL(v string) *AgentPluginRepoUpsert {
|
|
u.Set(agentpluginrepo.FieldNpmRegistryURL, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateNpmRegistryURL sets the "npm_registry_url" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsert) UpdateNpmRegistryURL() *AgentPluginRepoUpsert {
|
|
u.SetExcluded(agentpluginrepo.FieldNpmRegistryURL)
|
|
return u
|
|
}
|
|
|
|
// ClearNpmRegistryURL clears the value of the "npm_registry_url" field.
|
|
func (u *AgentPluginRepoUpsert) ClearNpmRegistryURL() *AgentPluginRepoUpsert {
|
|
u.SetNull(agentpluginrepo.FieldNpmRegistryURL)
|
|
return u
|
|
}
|
|
|
|
// SetIsDeleted sets the "is_deleted" field.
|
|
func (u *AgentPluginRepoUpsert) SetIsDeleted(v bool) *AgentPluginRepoUpsert {
|
|
u.Set(agentpluginrepo.FieldIsDeleted, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateIsDeleted sets the "is_deleted" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsert) UpdateIsDeleted() *AgentPluginRepoUpsert {
|
|
u.SetExcluded(agentpluginrepo.FieldIsDeleted)
|
|
return u
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (u *AgentPluginRepoUpsert) SetCreatedAt(v time.Time) *AgentPluginRepoUpsert {
|
|
u.Set(agentpluginrepo.FieldCreatedAt, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsert) UpdateCreatedAt() *AgentPluginRepoUpsert {
|
|
u.SetExcluded(agentpluginrepo.FieldCreatedAt)
|
|
return u
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (u *AgentPluginRepoUpsert) SetUpdatedAt(v time.Time) *AgentPluginRepoUpsert {
|
|
u.Set(agentpluginrepo.FieldUpdatedAt, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsert) UpdateUpdatedAt() *AgentPluginRepoUpsert {
|
|
u.SetExcluded(agentpluginrepo.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.AgentPluginRepo.Create().
|
|
// OnConflict(
|
|
// sql.ResolveWithNewValues(),
|
|
// sql.ResolveWith(func(u *sql.UpdateSet) {
|
|
// u.SetIgnore(agentpluginrepo.FieldID)
|
|
// }),
|
|
// ).
|
|
// Exec(ctx)
|
|
func (u *AgentPluginRepoUpsertOne) UpdateNewValues() *AgentPluginRepoUpsertOne {
|
|
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(agentpluginrepo.FieldID)
|
|
}
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// Ignore sets each column to itself in case of conflict.
|
|
// Using this option is equivalent to using:
|
|
//
|
|
// client.AgentPluginRepo.Create().
|
|
// OnConflict(sql.ResolveWithIgnore()).
|
|
// Exec(ctx)
|
|
func (u *AgentPluginRepoUpsertOne) Ignore() *AgentPluginRepoUpsertOne {
|
|
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 *AgentPluginRepoUpsertOne) DoNothing() *AgentPluginRepoUpsertOne {
|
|
u.create.conflict = append(u.create.conflict, sql.DoNothing())
|
|
return u
|
|
}
|
|
|
|
// Update allows overriding fields `UPDATE` values. See the AgentPluginRepoCreate.OnConflict
|
|
// documentation for more info.
|
|
func (u *AgentPluginRepoUpsertOne) Update(set func(*AgentPluginRepoUpsert)) *AgentPluginRepoUpsertOne {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
|
|
set(&AgentPluginRepoUpsert{UpdateSet: update})
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// SetName sets the "name" field.
|
|
func (u *AgentPluginRepoUpsertOne) SetName(v string) *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetName(v)
|
|
})
|
|
}
|
|
|
|
// UpdateName sets the "name" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertOne) UpdateName() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateName()
|
|
})
|
|
}
|
|
|
|
// SetScopeType sets the "scope_type" field.
|
|
func (u *AgentPluginRepoUpsertOne) SetScopeType(v agentpluginrepo.ScopeType) *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetScopeType(v)
|
|
})
|
|
}
|
|
|
|
// UpdateScopeType sets the "scope_type" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertOne) UpdateScopeType() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateScopeType()
|
|
})
|
|
}
|
|
|
|
// SetScopeID sets the "scope_id" field.
|
|
func (u *AgentPluginRepoUpsertOne) SetScopeID(v string) *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetScopeID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateScopeID sets the "scope_id" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertOne) UpdateScopeID() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateScopeID()
|
|
})
|
|
}
|
|
|
|
// SetCreatedBy sets the "created_by" field.
|
|
func (u *AgentPluginRepoUpsertOne) SetCreatedBy(v uuid.UUID) *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetCreatedBy(v)
|
|
})
|
|
}
|
|
|
|
// UpdateCreatedBy sets the "created_by" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertOne) UpdateCreatedBy() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateCreatedBy()
|
|
})
|
|
}
|
|
|
|
// SetSourceType sets the "source_type" field.
|
|
func (u *AgentPluginRepoUpsertOne) SetSourceType(v agentpluginrepo.SourceType) *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetSourceType(v)
|
|
})
|
|
}
|
|
|
|
// UpdateSourceType sets the "source_type" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertOne) UpdateSourceType() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateSourceType()
|
|
})
|
|
}
|
|
|
|
// SetGithubURL sets the "github_url" field.
|
|
func (u *AgentPluginRepoUpsertOne) SetGithubURL(v string) *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetGithubURL(v)
|
|
})
|
|
}
|
|
|
|
// UpdateGithubURL sets the "github_url" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertOne) UpdateGithubURL() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateGithubURL()
|
|
})
|
|
}
|
|
|
|
// ClearGithubURL clears the value of the "github_url" field.
|
|
func (u *AgentPluginRepoUpsertOne) ClearGithubURL() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.ClearGithubURL()
|
|
})
|
|
}
|
|
|
|
// SetRefType sets the "ref_type" field.
|
|
func (u *AgentPluginRepoUpsertOne) SetRefType(v agentpluginrepo.RefType) *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetRefType(v)
|
|
})
|
|
}
|
|
|
|
// UpdateRefType sets the "ref_type" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertOne) UpdateRefType() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateRefType()
|
|
})
|
|
}
|
|
|
|
// ClearRefType clears the value of the "ref_type" field.
|
|
func (u *AgentPluginRepoUpsertOne) ClearRefType() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.ClearRefType()
|
|
})
|
|
}
|
|
|
|
// SetRefValue sets the "ref_value" field.
|
|
func (u *AgentPluginRepoUpsertOne) SetRefValue(v string) *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetRefValue(v)
|
|
})
|
|
}
|
|
|
|
// UpdateRefValue sets the "ref_value" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertOne) UpdateRefValue() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateRefValue()
|
|
})
|
|
}
|
|
|
|
// ClearRefValue clears the value of the "ref_value" field.
|
|
func (u *AgentPluginRepoUpsertOne) ClearRefValue() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.ClearRefValue()
|
|
})
|
|
}
|
|
|
|
// SetLastUploadFilename sets the "last_upload_filename" field.
|
|
func (u *AgentPluginRepoUpsertOne) SetLastUploadFilename(v string) *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetLastUploadFilename(v)
|
|
})
|
|
}
|
|
|
|
// UpdateLastUploadFilename sets the "last_upload_filename" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertOne) UpdateLastUploadFilename() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateLastUploadFilename()
|
|
})
|
|
}
|
|
|
|
// ClearLastUploadFilename clears the value of the "last_upload_filename" field.
|
|
func (u *AgentPluginRepoUpsertOne) ClearLastUploadFilename() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.ClearLastUploadFilename()
|
|
})
|
|
}
|
|
|
|
// SetLastUploadAt sets the "last_upload_at" field.
|
|
func (u *AgentPluginRepoUpsertOne) SetLastUploadAt(v time.Time) *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetLastUploadAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateLastUploadAt sets the "last_upload_at" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertOne) UpdateLastUploadAt() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateLastUploadAt()
|
|
})
|
|
}
|
|
|
|
// ClearLastUploadAt clears the value of the "last_upload_at" field.
|
|
func (u *AgentPluginRepoUpsertOne) ClearLastUploadAt() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.ClearLastUploadAt()
|
|
})
|
|
}
|
|
|
|
// SetPluginDiscoveryAutoPackageJSON sets the "plugin_discovery_auto_package_json" field.
|
|
func (u *AgentPluginRepoUpsertOne) SetPluginDiscoveryAutoPackageJSON(v bool) *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetPluginDiscoveryAutoPackageJSON(v)
|
|
})
|
|
}
|
|
|
|
// UpdatePluginDiscoveryAutoPackageJSON sets the "plugin_discovery_auto_package_json" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertOne) UpdatePluginDiscoveryAutoPackageJSON() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdatePluginDiscoveryAutoPackageJSON()
|
|
})
|
|
}
|
|
|
|
// SetPluginManualEntries sets the "plugin_manual_entries" field.
|
|
func (u *AgentPluginRepoUpsertOne) SetPluginManualEntries(v types.PluginManualEntries) *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetPluginManualEntries(v)
|
|
})
|
|
}
|
|
|
|
// UpdatePluginManualEntries sets the "plugin_manual_entries" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertOne) UpdatePluginManualEntries() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdatePluginManualEntries()
|
|
})
|
|
}
|
|
|
|
// ClearPluginManualEntries clears the value of the "plugin_manual_entries" field.
|
|
func (u *AgentPluginRepoUpsertOne) ClearPluginManualEntries() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.ClearPluginManualEntries()
|
|
})
|
|
}
|
|
|
|
// SetNpmPackageName sets the "npm_package_name" field.
|
|
func (u *AgentPluginRepoUpsertOne) SetNpmPackageName(v string) *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetNpmPackageName(v)
|
|
})
|
|
}
|
|
|
|
// UpdateNpmPackageName sets the "npm_package_name" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertOne) UpdateNpmPackageName() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateNpmPackageName()
|
|
})
|
|
}
|
|
|
|
// ClearNpmPackageName clears the value of the "npm_package_name" field.
|
|
func (u *AgentPluginRepoUpsertOne) ClearNpmPackageName() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.ClearNpmPackageName()
|
|
})
|
|
}
|
|
|
|
// SetNpmVersionSpec sets the "npm_version_spec" field.
|
|
func (u *AgentPluginRepoUpsertOne) SetNpmVersionSpec(v string) *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetNpmVersionSpec(v)
|
|
})
|
|
}
|
|
|
|
// UpdateNpmVersionSpec sets the "npm_version_spec" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertOne) UpdateNpmVersionSpec() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateNpmVersionSpec()
|
|
})
|
|
}
|
|
|
|
// ClearNpmVersionSpec clears the value of the "npm_version_spec" field.
|
|
func (u *AgentPluginRepoUpsertOne) ClearNpmVersionSpec() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.ClearNpmVersionSpec()
|
|
})
|
|
}
|
|
|
|
// SetNpmRegistryURL sets the "npm_registry_url" field.
|
|
func (u *AgentPluginRepoUpsertOne) SetNpmRegistryURL(v string) *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetNpmRegistryURL(v)
|
|
})
|
|
}
|
|
|
|
// UpdateNpmRegistryURL sets the "npm_registry_url" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertOne) UpdateNpmRegistryURL() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateNpmRegistryURL()
|
|
})
|
|
}
|
|
|
|
// ClearNpmRegistryURL clears the value of the "npm_registry_url" field.
|
|
func (u *AgentPluginRepoUpsertOne) ClearNpmRegistryURL() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.ClearNpmRegistryURL()
|
|
})
|
|
}
|
|
|
|
// SetIsDeleted sets the "is_deleted" field.
|
|
func (u *AgentPluginRepoUpsertOne) SetIsDeleted(v bool) *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetIsDeleted(v)
|
|
})
|
|
}
|
|
|
|
// UpdateIsDeleted sets the "is_deleted" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertOne) UpdateIsDeleted() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateIsDeleted()
|
|
})
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (u *AgentPluginRepoUpsertOne) SetCreatedAt(v time.Time) *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetCreatedAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertOne) UpdateCreatedAt() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateCreatedAt()
|
|
})
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (u *AgentPluginRepoUpsertOne) SetUpdatedAt(v time.Time) *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetUpdatedAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertOne) UpdateUpdatedAt() *AgentPluginRepoUpsertOne {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateUpdatedAt()
|
|
})
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (u *AgentPluginRepoUpsertOne) Exec(ctx context.Context) error {
|
|
if len(u.create.conflict) == 0 {
|
|
return errors.New("db: missing options for AgentPluginRepoCreate.OnConflict")
|
|
}
|
|
return u.create.Exec(ctx)
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (u *AgentPluginRepoUpsertOne) 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 *AgentPluginRepoUpsertOne) 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: AgentPluginRepoUpsertOne.ID is not supported by MySQL driver. Use AgentPluginRepoUpsertOne.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 *AgentPluginRepoUpsertOne) IDX(ctx context.Context) uuid.UUID {
|
|
id, err := u.ID(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return id
|
|
}
|
|
|
|
// AgentPluginRepoCreateBulk is the builder for creating many AgentPluginRepo entities in bulk.
|
|
type AgentPluginRepoCreateBulk struct {
|
|
config
|
|
err error
|
|
builders []*AgentPluginRepoCreate
|
|
conflict []sql.ConflictOption
|
|
}
|
|
|
|
// Save creates the AgentPluginRepo entities in the database.
|
|
func (_c *AgentPluginRepoCreateBulk) Save(ctx context.Context) ([]*AgentPluginRepo, error) {
|
|
if _c.err != nil {
|
|
return nil, _c.err
|
|
}
|
|
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
|
|
nodes := make([]*AgentPluginRepo, 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.(*AgentPluginRepoMutation)
|
|
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 *AgentPluginRepoCreateBulk) SaveX(ctx context.Context) []*AgentPluginRepo {
|
|
v, err := _c.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return v
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_c *AgentPluginRepoCreateBulk) Exec(ctx context.Context) error {
|
|
_, err := _c.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_c *AgentPluginRepoCreateBulk) 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.AgentPluginRepo.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.AgentPluginRepoUpsert) {
|
|
// SetName(v+v).
|
|
// }).
|
|
// Exec(ctx)
|
|
func (_c *AgentPluginRepoCreateBulk) OnConflict(opts ...sql.ConflictOption) *AgentPluginRepoUpsertBulk {
|
|
_c.conflict = opts
|
|
return &AgentPluginRepoUpsertBulk{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
// OnConflictColumns calls `OnConflict` and configures the columns
|
|
// as conflict target. Using this option is equivalent to using:
|
|
//
|
|
// client.AgentPluginRepo.Create().
|
|
// OnConflict(sql.ConflictColumns(columns...)).
|
|
// Exec(ctx)
|
|
func (_c *AgentPluginRepoCreateBulk) OnConflictColumns(columns ...string) *AgentPluginRepoUpsertBulk {
|
|
_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
|
|
return &AgentPluginRepoUpsertBulk{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
// AgentPluginRepoUpsertBulk is the builder for "upsert"-ing
|
|
// a bulk of AgentPluginRepo nodes.
|
|
type AgentPluginRepoUpsertBulk struct {
|
|
create *AgentPluginRepoCreateBulk
|
|
}
|
|
|
|
// UpdateNewValues updates the mutable fields using the new values that
|
|
// were set on create. Using this option is equivalent to using:
|
|
//
|
|
// client.AgentPluginRepo.Create().
|
|
// OnConflict(
|
|
// sql.ResolveWithNewValues(),
|
|
// sql.ResolveWith(func(u *sql.UpdateSet) {
|
|
// u.SetIgnore(agentpluginrepo.FieldID)
|
|
// }),
|
|
// ).
|
|
// Exec(ctx)
|
|
func (u *AgentPluginRepoUpsertBulk) UpdateNewValues() *AgentPluginRepoUpsertBulk {
|
|
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(agentpluginrepo.FieldID)
|
|
}
|
|
}
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// Ignore sets each column to itself in case of conflict.
|
|
// Using this option is equivalent to using:
|
|
//
|
|
// client.AgentPluginRepo.Create().
|
|
// OnConflict(sql.ResolveWithIgnore()).
|
|
// Exec(ctx)
|
|
func (u *AgentPluginRepoUpsertBulk) Ignore() *AgentPluginRepoUpsertBulk {
|
|
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 *AgentPluginRepoUpsertBulk) DoNothing() *AgentPluginRepoUpsertBulk {
|
|
u.create.conflict = append(u.create.conflict, sql.DoNothing())
|
|
return u
|
|
}
|
|
|
|
// Update allows overriding fields `UPDATE` values. See the AgentPluginRepoCreateBulk.OnConflict
|
|
// documentation for more info.
|
|
func (u *AgentPluginRepoUpsertBulk) Update(set func(*AgentPluginRepoUpsert)) *AgentPluginRepoUpsertBulk {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
|
|
set(&AgentPluginRepoUpsert{UpdateSet: update})
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// SetName sets the "name" field.
|
|
func (u *AgentPluginRepoUpsertBulk) SetName(v string) *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetName(v)
|
|
})
|
|
}
|
|
|
|
// UpdateName sets the "name" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertBulk) UpdateName() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateName()
|
|
})
|
|
}
|
|
|
|
// SetScopeType sets the "scope_type" field.
|
|
func (u *AgentPluginRepoUpsertBulk) SetScopeType(v agentpluginrepo.ScopeType) *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetScopeType(v)
|
|
})
|
|
}
|
|
|
|
// UpdateScopeType sets the "scope_type" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertBulk) UpdateScopeType() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateScopeType()
|
|
})
|
|
}
|
|
|
|
// SetScopeID sets the "scope_id" field.
|
|
func (u *AgentPluginRepoUpsertBulk) SetScopeID(v string) *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetScopeID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateScopeID sets the "scope_id" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertBulk) UpdateScopeID() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateScopeID()
|
|
})
|
|
}
|
|
|
|
// SetCreatedBy sets the "created_by" field.
|
|
func (u *AgentPluginRepoUpsertBulk) SetCreatedBy(v uuid.UUID) *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetCreatedBy(v)
|
|
})
|
|
}
|
|
|
|
// UpdateCreatedBy sets the "created_by" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertBulk) UpdateCreatedBy() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateCreatedBy()
|
|
})
|
|
}
|
|
|
|
// SetSourceType sets the "source_type" field.
|
|
func (u *AgentPluginRepoUpsertBulk) SetSourceType(v agentpluginrepo.SourceType) *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetSourceType(v)
|
|
})
|
|
}
|
|
|
|
// UpdateSourceType sets the "source_type" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertBulk) UpdateSourceType() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateSourceType()
|
|
})
|
|
}
|
|
|
|
// SetGithubURL sets the "github_url" field.
|
|
func (u *AgentPluginRepoUpsertBulk) SetGithubURL(v string) *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetGithubURL(v)
|
|
})
|
|
}
|
|
|
|
// UpdateGithubURL sets the "github_url" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertBulk) UpdateGithubURL() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateGithubURL()
|
|
})
|
|
}
|
|
|
|
// ClearGithubURL clears the value of the "github_url" field.
|
|
func (u *AgentPluginRepoUpsertBulk) ClearGithubURL() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.ClearGithubURL()
|
|
})
|
|
}
|
|
|
|
// SetRefType sets the "ref_type" field.
|
|
func (u *AgentPluginRepoUpsertBulk) SetRefType(v agentpluginrepo.RefType) *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetRefType(v)
|
|
})
|
|
}
|
|
|
|
// UpdateRefType sets the "ref_type" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertBulk) UpdateRefType() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateRefType()
|
|
})
|
|
}
|
|
|
|
// ClearRefType clears the value of the "ref_type" field.
|
|
func (u *AgentPluginRepoUpsertBulk) ClearRefType() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.ClearRefType()
|
|
})
|
|
}
|
|
|
|
// SetRefValue sets the "ref_value" field.
|
|
func (u *AgentPluginRepoUpsertBulk) SetRefValue(v string) *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetRefValue(v)
|
|
})
|
|
}
|
|
|
|
// UpdateRefValue sets the "ref_value" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertBulk) UpdateRefValue() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateRefValue()
|
|
})
|
|
}
|
|
|
|
// ClearRefValue clears the value of the "ref_value" field.
|
|
func (u *AgentPluginRepoUpsertBulk) ClearRefValue() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.ClearRefValue()
|
|
})
|
|
}
|
|
|
|
// SetLastUploadFilename sets the "last_upload_filename" field.
|
|
func (u *AgentPluginRepoUpsertBulk) SetLastUploadFilename(v string) *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetLastUploadFilename(v)
|
|
})
|
|
}
|
|
|
|
// UpdateLastUploadFilename sets the "last_upload_filename" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertBulk) UpdateLastUploadFilename() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateLastUploadFilename()
|
|
})
|
|
}
|
|
|
|
// ClearLastUploadFilename clears the value of the "last_upload_filename" field.
|
|
func (u *AgentPluginRepoUpsertBulk) ClearLastUploadFilename() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.ClearLastUploadFilename()
|
|
})
|
|
}
|
|
|
|
// SetLastUploadAt sets the "last_upload_at" field.
|
|
func (u *AgentPluginRepoUpsertBulk) SetLastUploadAt(v time.Time) *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetLastUploadAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateLastUploadAt sets the "last_upload_at" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertBulk) UpdateLastUploadAt() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateLastUploadAt()
|
|
})
|
|
}
|
|
|
|
// ClearLastUploadAt clears the value of the "last_upload_at" field.
|
|
func (u *AgentPluginRepoUpsertBulk) ClearLastUploadAt() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.ClearLastUploadAt()
|
|
})
|
|
}
|
|
|
|
// SetPluginDiscoveryAutoPackageJSON sets the "plugin_discovery_auto_package_json" field.
|
|
func (u *AgentPluginRepoUpsertBulk) SetPluginDiscoveryAutoPackageJSON(v bool) *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetPluginDiscoveryAutoPackageJSON(v)
|
|
})
|
|
}
|
|
|
|
// UpdatePluginDiscoveryAutoPackageJSON sets the "plugin_discovery_auto_package_json" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertBulk) UpdatePluginDiscoveryAutoPackageJSON() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdatePluginDiscoveryAutoPackageJSON()
|
|
})
|
|
}
|
|
|
|
// SetPluginManualEntries sets the "plugin_manual_entries" field.
|
|
func (u *AgentPluginRepoUpsertBulk) SetPluginManualEntries(v types.PluginManualEntries) *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetPluginManualEntries(v)
|
|
})
|
|
}
|
|
|
|
// UpdatePluginManualEntries sets the "plugin_manual_entries" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertBulk) UpdatePluginManualEntries() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdatePluginManualEntries()
|
|
})
|
|
}
|
|
|
|
// ClearPluginManualEntries clears the value of the "plugin_manual_entries" field.
|
|
func (u *AgentPluginRepoUpsertBulk) ClearPluginManualEntries() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.ClearPluginManualEntries()
|
|
})
|
|
}
|
|
|
|
// SetNpmPackageName sets the "npm_package_name" field.
|
|
func (u *AgentPluginRepoUpsertBulk) SetNpmPackageName(v string) *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetNpmPackageName(v)
|
|
})
|
|
}
|
|
|
|
// UpdateNpmPackageName sets the "npm_package_name" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertBulk) UpdateNpmPackageName() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateNpmPackageName()
|
|
})
|
|
}
|
|
|
|
// ClearNpmPackageName clears the value of the "npm_package_name" field.
|
|
func (u *AgentPluginRepoUpsertBulk) ClearNpmPackageName() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.ClearNpmPackageName()
|
|
})
|
|
}
|
|
|
|
// SetNpmVersionSpec sets the "npm_version_spec" field.
|
|
func (u *AgentPluginRepoUpsertBulk) SetNpmVersionSpec(v string) *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetNpmVersionSpec(v)
|
|
})
|
|
}
|
|
|
|
// UpdateNpmVersionSpec sets the "npm_version_spec" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertBulk) UpdateNpmVersionSpec() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateNpmVersionSpec()
|
|
})
|
|
}
|
|
|
|
// ClearNpmVersionSpec clears the value of the "npm_version_spec" field.
|
|
func (u *AgentPluginRepoUpsertBulk) ClearNpmVersionSpec() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.ClearNpmVersionSpec()
|
|
})
|
|
}
|
|
|
|
// SetNpmRegistryURL sets the "npm_registry_url" field.
|
|
func (u *AgentPluginRepoUpsertBulk) SetNpmRegistryURL(v string) *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetNpmRegistryURL(v)
|
|
})
|
|
}
|
|
|
|
// UpdateNpmRegistryURL sets the "npm_registry_url" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertBulk) UpdateNpmRegistryURL() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateNpmRegistryURL()
|
|
})
|
|
}
|
|
|
|
// ClearNpmRegistryURL clears the value of the "npm_registry_url" field.
|
|
func (u *AgentPluginRepoUpsertBulk) ClearNpmRegistryURL() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.ClearNpmRegistryURL()
|
|
})
|
|
}
|
|
|
|
// SetIsDeleted sets the "is_deleted" field.
|
|
func (u *AgentPluginRepoUpsertBulk) SetIsDeleted(v bool) *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetIsDeleted(v)
|
|
})
|
|
}
|
|
|
|
// UpdateIsDeleted sets the "is_deleted" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertBulk) UpdateIsDeleted() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateIsDeleted()
|
|
})
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (u *AgentPluginRepoUpsertBulk) SetCreatedAt(v time.Time) *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetCreatedAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertBulk) UpdateCreatedAt() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateCreatedAt()
|
|
})
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (u *AgentPluginRepoUpsertBulk) SetUpdatedAt(v time.Time) *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.SetUpdatedAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
|
|
func (u *AgentPluginRepoUpsertBulk) UpdateUpdatedAt() *AgentPluginRepoUpsertBulk {
|
|
return u.Update(func(s *AgentPluginRepoUpsert) {
|
|
s.UpdateUpdatedAt()
|
|
})
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (u *AgentPluginRepoUpsertBulk) 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 AgentPluginRepoCreateBulk instead", i)
|
|
}
|
|
}
|
|
if len(u.create.conflict) == 0 {
|
|
return errors.New("db: missing options for AgentPluginRepoCreateBulk.OnConflict")
|
|
}
|
|
return u.create.Exec(ctx)
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (u *AgentPluginRepoUpsertBulk) ExecX(ctx context.Context) {
|
|
if err := u.create.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|