mirror of
https://github.com/chaitin/MonkeyCode.git
synced 2026-11-22 19:39:31 +08:00
2101 lines
64 KiB
Go
2101 lines
64 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package db
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
"time"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"entgo.io/ent/schema/field"
|
|
"github.com/chaitin/MonkeyCode/backend/db/gitidentity"
|
|
"github.com/chaitin/MonkeyCode/backend/db/host"
|
|
"github.com/chaitin/MonkeyCode/backend/db/model"
|
|
"github.com/chaitin/MonkeyCode/backend/db/predicate"
|
|
"github.com/chaitin/MonkeyCode/backend/db/task"
|
|
"github.com/chaitin/MonkeyCode/backend/db/taskvirtualmachine"
|
|
"github.com/chaitin/MonkeyCode/backend/db/user"
|
|
"github.com/chaitin/MonkeyCode/backend/db/virtualmachine"
|
|
"github.com/chaitin/MonkeyCode/backend/ent/types"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// VirtualMachineUpdate is the builder for updating VirtualMachine entities.
|
|
type VirtualMachineUpdate struct {
|
|
config
|
|
hooks []Hook
|
|
mutation *VirtualMachineMutation
|
|
modifiers []func(*sql.UpdateBuilder)
|
|
}
|
|
|
|
// Where appends a list predicates to the VirtualMachineUpdate builder.
|
|
func (_u *VirtualMachineUpdate) Where(ps ...predicate.VirtualMachine) *VirtualMachineUpdate {
|
|
_u.mutation.Where(ps...)
|
|
return _u
|
|
}
|
|
|
|
// SetDeletedAt sets the "deleted_at" field.
|
|
func (_u *VirtualMachineUpdate) SetDeletedAt(v time.Time) *VirtualMachineUpdate {
|
|
_u.mutation.SetDeletedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdate) SetNillableDeletedAt(v *time.Time) *VirtualMachineUpdate {
|
|
if v != nil {
|
|
_u.SetDeletedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearDeletedAt clears the value of the "deleted_at" field.
|
|
func (_u *VirtualMachineUpdate) ClearDeletedAt() *VirtualMachineUpdate {
|
|
_u.mutation.ClearDeletedAt()
|
|
return _u
|
|
}
|
|
|
|
// SetAccessToken sets the "access_token" field.
|
|
func (_u *VirtualMachineUpdate) SetAccessToken(v string) *VirtualMachineUpdate {
|
|
_u.mutation.SetAccessToken(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableAccessToken sets the "access_token" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdate) SetNillableAccessToken(v *string) *VirtualMachineUpdate {
|
|
if v != nil {
|
|
_u.SetAccessToken(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearAccessToken clears the value of the "access_token" field.
|
|
func (_u *VirtualMachineUpdate) ClearAccessToken() *VirtualMachineUpdate {
|
|
_u.mutation.ClearAccessToken()
|
|
return _u
|
|
}
|
|
|
|
// SetHostID sets the "host_id" field.
|
|
func (_u *VirtualMachineUpdate) SetHostID(v string) *VirtualMachineUpdate {
|
|
_u.mutation.SetHostID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableHostID sets the "host_id" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdate) SetNillableHostID(v *string) *VirtualMachineUpdate {
|
|
if v != nil {
|
|
_u.SetHostID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetUserID sets the "user_id" field.
|
|
func (_u *VirtualMachineUpdate) SetUserID(v uuid.UUID) *VirtualMachineUpdate {
|
|
_u.mutation.SetUserID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableUserID sets the "user_id" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdate) SetNillableUserID(v *uuid.UUID) *VirtualMachineUpdate {
|
|
if v != nil {
|
|
_u.SetUserID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearUserID clears the value of the "user_id" field.
|
|
func (_u *VirtualMachineUpdate) ClearUserID() *VirtualMachineUpdate {
|
|
_u.mutation.ClearUserID()
|
|
return _u
|
|
}
|
|
|
|
// SetModelID sets the "model_id" field.
|
|
func (_u *VirtualMachineUpdate) SetModelID(v uuid.UUID) *VirtualMachineUpdate {
|
|
_u.mutation.SetModelID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableModelID sets the "model_id" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdate) SetNillableModelID(v *uuid.UUID) *VirtualMachineUpdate {
|
|
if v != nil {
|
|
_u.SetModelID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearModelID clears the value of the "model_id" field.
|
|
func (_u *VirtualMachineUpdate) ClearModelID() *VirtualMachineUpdate {
|
|
_u.mutation.ClearModelID()
|
|
return _u
|
|
}
|
|
|
|
// SetEnvironmentID sets the "environment_id" field.
|
|
func (_u *VirtualMachineUpdate) SetEnvironmentID(v string) *VirtualMachineUpdate {
|
|
_u.mutation.SetEnvironmentID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableEnvironmentID sets the "environment_id" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdate) SetNillableEnvironmentID(v *string) *VirtualMachineUpdate {
|
|
if v != nil {
|
|
_u.SetEnvironmentID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearEnvironmentID clears the value of the "environment_id" field.
|
|
func (_u *VirtualMachineUpdate) ClearEnvironmentID() *VirtualMachineUpdate {
|
|
_u.mutation.ClearEnvironmentID()
|
|
return _u
|
|
}
|
|
|
|
// SetName sets the "name" field.
|
|
func (_u *VirtualMachineUpdate) SetName(v string) *VirtualMachineUpdate {
|
|
_u.mutation.SetName(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableName sets the "name" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdate) SetNillableName(v *string) *VirtualMachineUpdate {
|
|
if v != nil {
|
|
_u.SetName(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetHostname sets the "hostname" field.
|
|
func (_u *VirtualMachineUpdate) SetHostname(v string) *VirtualMachineUpdate {
|
|
_u.mutation.SetHostname(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableHostname sets the "hostname" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdate) SetNillableHostname(v *string) *VirtualMachineUpdate {
|
|
if v != nil {
|
|
_u.SetHostname(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearHostname clears the value of the "hostname" field.
|
|
func (_u *VirtualMachineUpdate) ClearHostname() *VirtualMachineUpdate {
|
|
_u.mutation.ClearHostname()
|
|
return _u
|
|
}
|
|
|
|
// SetArch sets the "arch" field.
|
|
func (_u *VirtualMachineUpdate) SetArch(v string) *VirtualMachineUpdate {
|
|
_u.mutation.SetArch(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableArch sets the "arch" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdate) SetNillableArch(v *string) *VirtualMachineUpdate {
|
|
if v != nil {
|
|
_u.SetArch(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearArch clears the value of the "arch" field.
|
|
func (_u *VirtualMachineUpdate) ClearArch() *VirtualMachineUpdate {
|
|
_u.mutation.ClearArch()
|
|
return _u
|
|
}
|
|
|
|
// SetCores sets the "cores" field.
|
|
func (_u *VirtualMachineUpdate) SetCores(v int) *VirtualMachineUpdate {
|
|
_u.mutation.ResetCores()
|
|
_u.mutation.SetCores(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableCores sets the "cores" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdate) SetNillableCores(v *int) *VirtualMachineUpdate {
|
|
if v != nil {
|
|
_u.SetCores(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddCores adds value to the "cores" field.
|
|
func (_u *VirtualMachineUpdate) AddCores(v int) *VirtualMachineUpdate {
|
|
_u.mutation.AddCores(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearCores clears the value of the "cores" field.
|
|
func (_u *VirtualMachineUpdate) ClearCores() *VirtualMachineUpdate {
|
|
_u.mutation.ClearCores()
|
|
return _u
|
|
}
|
|
|
|
// SetMemory sets the "memory" field.
|
|
func (_u *VirtualMachineUpdate) SetMemory(v int64) *VirtualMachineUpdate {
|
|
_u.mutation.ResetMemory()
|
|
_u.mutation.SetMemory(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableMemory sets the "memory" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdate) SetNillableMemory(v *int64) *VirtualMachineUpdate {
|
|
if v != nil {
|
|
_u.SetMemory(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddMemory adds value to the "memory" field.
|
|
func (_u *VirtualMachineUpdate) AddMemory(v int64) *VirtualMachineUpdate {
|
|
_u.mutation.AddMemory(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearMemory clears the value of the "memory" field.
|
|
func (_u *VirtualMachineUpdate) ClearMemory() *VirtualMachineUpdate {
|
|
_u.mutation.ClearMemory()
|
|
return _u
|
|
}
|
|
|
|
// SetOs sets the "os" field.
|
|
func (_u *VirtualMachineUpdate) SetOs(v string) *VirtualMachineUpdate {
|
|
_u.mutation.SetOs(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableOs sets the "os" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdate) SetNillableOs(v *string) *VirtualMachineUpdate {
|
|
if v != nil {
|
|
_u.SetOs(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearOs clears the value of the "os" field.
|
|
func (_u *VirtualMachineUpdate) ClearOs() *VirtualMachineUpdate {
|
|
_u.mutation.ClearOs()
|
|
return _u
|
|
}
|
|
|
|
// SetExternalIP sets the "external_ip" field.
|
|
func (_u *VirtualMachineUpdate) SetExternalIP(v string) *VirtualMachineUpdate {
|
|
_u.mutation.SetExternalIP(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableExternalIP sets the "external_ip" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdate) SetNillableExternalIP(v *string) *VirtualMachineUpdate {
|
|
if v != nil {
|
|
_u.SetExternalIP(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearExternalIP clears the value of the "external_ip" field.
|
|
func (_u *VirtualMachineUpdate) ClearExternalIP() *VirtualMachineUpdate {
|
|
_u.mutation.ClearExternalIP()
|
|
return _u
|
|
}
|
|
|
|
// SetInternalIP sets the "internal_ip" field.
|
|
func (_u *VirtualMachineUpdate) SetInternalIP(v string) *VirtualMachineUpdate {
|
|
_u.mutation.SetInternalIP(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableInternalIP sets the "internal_ip" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdate) SetNillableInternalIP(v *string) *VirtualMachineUpdate {
|
|
if v != nil {
|
|
_u.SetInternalIP(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearInternalIP clears the value of the "internal_ip" field.
|
|
func (_u *VirtualMachineUpdate) ClearInternalIP() *VirtualMachineUpdate {
|
|
_u.mutation.ClearInternalIP()
|
|
return _u
|
|
}
|
|
|
|
// SetVersion sets the "version" field.
|
|
func (_u *VirtualMachineUpdate) SetVersion(v string) *VirtualMachineUpdate {
|
|
_u.mutation.SetVersion(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableVersion sets the "version" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdate) SetNillableVersion(v *string) *VirtualMachineUpdate {
|
|
if v != nil {
|
|
_u.SetVersion(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearVersion clears the value of the "version" field.
|
|
func (_u *VirtualMachineUpdate) ClearVersion() *VirtualMachineUpdate {
|
|
_u.mutation.ClearVersion()
|
|
return _u
|
|
}
|
|
|
|
// SetMachineID sets the "machine_id" field.
|
|
func (_u *VirtualMachineUpdate) SetMachineID(v string) *VirtualMachineUpdate {
|
|
_u.mutation.SetMachineID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableMachineID sets the "machine_id" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdate) SetNillableMachineID(v *string) *VirtualMachineUpdate {
|
|
if v != nil {
|
|
_u.SetMachineID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearMachineID clears the value of the "machine_id" field.
|
|
func (_u *VirtualMachineUpdate) ClearMachineID() *VirtualMachineUpdate {
|
|
_u.mutation.ClearMachineID()
|
|
return _u
|
|
}
|
|
|
|
// SetRepoURL sets the "repo_url" field.
|
|
func (_u *VirtualMachineUpdate) SetRepoURL(v string) *VirtualMachineUpdate {
|
|
_u.mutation.SetRepoURL(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRepoURL sets the "repo_url" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdate) SetNillableRepoURL(v *string) *VirtualMachineUpdate {
|
|
if v != nil {
|
|
_u.SetRepoURL(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearRepoURL clears the value of the "repo_url" field.
|
|
func (_u *VirtualMachineUpdate) ClearRepoURL() *VirtualMachineUpdate {
|
|
_u.mutation.ClearRepoURL()
|
|
return _u
|
|
}
|
|
|
|
// SetRepoFilename sets the "repo_filename" field.
|
|
func (_u *VirtualMachineUpdate) SetRepoFilename(v string) *VirtualMachineUpdate {
|
|
_u.mutation.SetRepoFilename(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRepoFilename sets the "repo_filename" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdate) SetNillableRepoFilename(v *string) *VirtualMachineUpdate {
|
|
if v != nil {
|
|
_u.SetRepoFilename(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearRepoFilename clears the value of the "repo_filename" field.
|
|
func (_u *VirtualMachineUpdate) ClearRepoFilename() *VirtualMachineUpdate {
|
|
_u.mutation.ClearRepoFilename()
|
|
return _u
|
|
}
|
|
|
|
// SetBranch sets the "branch" field.
|
|
func (_u *VirtualMachineUpdate) SetBranch(v string) *VirtualMachineUpdate {
|
|
_u.mutation.SetBranch(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableBranch sets the "branch" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdate) SetNillableBranch(v *string) *VirtualMachineUpdate {
|
|
if v != nil {
|
|
_u.SetBranch(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearBranch clears the value of the "branch" field.
|
|
func (_u *VirtualMachineUpdate) ClearBranch() *VirtualMachineUpdate {
|
|
_u.mutation.ClearBranch()
|
|
return _u
|
|
}
|
|
|
|
// SetGitIdentityID sets the "git_identity_id" field.
|
|
func (_u *VirtualMachineUpdate) SetGitIdentityID(v uuid.UUID) *VirtualMachineUpdate {
|
|
_u.mutation.SetGitIdentityID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableGitIdentityID sets the "git_identity_id" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdate) SetNillableGitIdentityID(v *uuid.UUID) *VirtualMachineUpdate {
|
|
if v != nil {
|
|
_u.SetGitIdentityID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearGitIdentityID clears the value of the "git_identity_id" field.
|
|
func (_u *VirtualMachineUpdate) ClearGitIdentityID() *VirtualMachineUpdate {
|
|
_u.mutation.ClearGitIdentityID()
|
|
return _u
|
|
}
|
|
|
|
// SetIsRecycled sets the "is_recycled" field.
|
|
func (_u *VirtualMachineUpdate) SetIsRecycled(v bool) *VirtualMachineUpdate {
|
|
_u.mutation.SetIsRecycled(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableIsRecycled sets the "is_recycled" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdate) SetNillableIsRecycled(v *bool) *VirtualMachineUpdate {
|
|
if v != nil {
|
|
_u.SetIsRecycled(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearIsRecycled clears the value of the "is_recycled" field.
|
|
func (_u *VirtualMachineUpdate) ClearIsRecycled() *VirtualMachineUpdate {
|
|
_u.mutation.ClearIsRecycled()
|
|
return _u
|
|
}
|
|
|
|
// SetConditions sets the "conditions" field.
|
|
func (_u *VirtualMachineUpdate) SetConditions(v *types.VirtualMachineCondition) *VirtualMachineUpdate {
|
|
_u.mutation.SetConditions(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearConditions clears the value of the "conditions" field.
|
|
func (_u *VirtualMachineUpdate) ClearConditions() *VirtualMachineUpdate {
|
|
_u.mutation.ClearConditions()
|
|
return _u
|
|
}
|
|
|
|
// SetExpiredAt sets the "expired_at" field.
|
|
func (_u *VirtualMachineUpdate) SetExpiredAt(v time.Time) *VirtualMachineUpdate {
|
|
_u.mutation.SetExpiredAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableExpiredAt sets the "expired_at" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdate) SetNillableExpiredAt(v *time.Time) *VirtualMachineUpdate {
|
|
if v != nil {
|
|
_u.SetExpiredAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearExpiredAt clears the value of the "expired_at" field.
|
|
func (_u *VirtualMachineUpdate) ClearExpiredAt() *VirtualMachineUpdate {
|
|
_u.mutation.ClearExpiredAt()
|
|
return _u
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (_u *VirtualMachineUpdate) SetCreatedAt(v time.Time) *VirtualMachineUpdate {
|
|
_u.mutation.SetCreatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdate) SetNillableCreatedAt(v *time.Time) *VirtualMachineUpdate {
|
|
if v != nil {
|
|
_u.SetCreatedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (_u *VirtualMachineUpdate) SetUpdatedAt(v time.Time) *VirtualMachineUpdate {
|
|
_u.mutation.SetUpdatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdate) SetNillableUpdatedAt(v *time.Time) *VirtualMachineUpdate {
|
|
if v != nil {
|
|
_u.SetUpdatedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetHost sets the "host" edge to the Host entity.
|
|
func (_u *VirtualMachineUpdate) SetHost(v *Host) *VirtualMachineUpdate {
|
|
return _u.SetHostID(v.ID)
|
|
}
|
|
|
|
// SetModel sets the "model" edge to the Model entity.
|
|
func (_u *VirtualMachineUpdate) SetModel(v *Model) *VirtualMachineUpdate {
|
|
return _u.SetModelID(v.ID)
|
|
}
|
|
|
|
// SetUser sets the "user" edge to the User entity.
|
|
func (_u *VirtualMachineUpdate) SetUser(v *User) *VirtualMachineUpdate {
|
|
return _u.SetUserID(v.ID)
|
|
}
|
|
|
|
// SetGitIdentity sets the "git_identity" edge to the GitIdentity entity.
|
|
func (_u *VirtualMachineUpdate) SetGitIdentity(v *GitIdentity) *VirtualMachineUpdate {
|
|
return _u.SetGitIdentityID(v.ID)
|
|
}
|
|
|
|
// AddTaskIDs adds the "tasks" edge to the Task entity by IDs.
|
|
func (_u *VirtualMachineUpdate) AddTaskIDs(ids ...uuid.UUID) *VirtualMachineUpdate {
|
|
_u.mutation.AddTaskIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// AddTasks adds the "tasks" edges to the Task entity.
|
|
func (_u *VirtualMachineUpdate) AddTasks(v ...*Task) *VirtualMachineUpdate {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.AddTaskIDs(ids...)
|
|
}
|
|
|
|
// AddTaskVMIDs adds the "task_vms" edge to the TaskVirtualMachine entity by IDs.
|
|
func (_u *VirtualMachineUpdate) AddTaskVMIDs(ids ...uuid.UUID) *VirtualMachineUpdate {
|
|
_u.mutation.AddTaskVMIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// AddTaskVms adds the "task_vms" edges to the TaskVirtualMachine entity.
|
|
func (_u *VirtualMachineUpdate) AddTaskVms(v ...*TaskVirtualMachine) *VirtualMachineUpdate {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.AddTaskVMIDs(ids...)
|
|
}
|
|
|
|
// Mutation returns the VirtualMachineMutation object of the builder.
|
|
func (_u *VirtualMachineUpdate) Mutation() *VirtualMachineMutation {
|
|
return _u.mutation
|
|
}
|
|
|
|
// ClearHost clears the "host" edge to the Host entity.
|
|
func (_u *VirtualMachineUpdate) ClearHost() *VirtualMachineUpdate {
|
|
_u.mutation.ClearHost()
|
|
return _u
|
|
}
|
|
|
|
// ClearModel clears the "model" edge to the Model entity.
|
|
func (_u *VirtualMachineUpdate) ClearModel() *VirtualMachineUpdate {
|
|
_u.mutation.ClearModel()
|
|
return _u
|
|
}
|
|
|
|
// ClearUser clears the "user" edge to the User entity.
|
|
func (_u *VirtualMachineUpdate) ClearUser() *VirtualMachineUpdate {
|
|
_u.mutation.ClearUser()
|
|
return _u
|
|
}
|
|
|
|
// ClearGitIdentity clears the "git_identity" edge to the GitIdentity entity.
|
|
func (_u *VirtualMachineUpdate) ClearGitIdentity() *VirtualMachineUpdate {
|
|
_u.mutation.ClearGitIdentity()
|
|
return _u
|
|
}
|
|
|
|
// ClearTasks clears all "tasks" edges to the Task entity.
|
|
func (_u *VirtualMachineUpdate) ClearTasks() *VirtualMachineUpdate {
|
|
_u.mutation.ClearTasks()
|
|
return _u
|
|
}
|
|
|
|
// RemoveTaskIDs removes the "tasks" edge to Task entities by IDs.
|
|
func (_u *VirtualMachineUpdate) RemoveTaskIDs(ids ...uuid.UUID) *VirtualMachineUpdate {
|
|
_u.mutation.RemoveTaskIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// RemoveTasks removes "tasks" edges to Task entities.
|
|
func (_u *VirtualMachineUpdate) RemoveTasks(v ...*Task) *VirtualMachineUpdate {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.RemoveTaskIDs(ids...)
|
|
}
|
|
|
|
// ClearTaskVms clears all "task_vms" edges to the TaskVirtualMachine entity.
|
|
func (_u *VirtualMachineUpdate) ClearTaskVms() *VirtualMachineUpdate {
|
|
_u.mutation.ClearTaskVms()
|
|
return _u
|
|
}
|
|
|
|
// RemoveTaskVMIDs removes the "task_vms" edge to TaskVirtualMachine entities by IDs.
|
|
func (_u *VirtualMachineUpdate) RemoveTaskVMIDs(ids ...uuid.UUID) *VirtualMachineUpdate {
|
|
_u.mutation.RemoveTaskVMIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// RemoveTaskVms removes "task_vms" edges to TaskVirtualMachine entities.
|
|
func (_u *VirtualMachineUpdate) RemoveTaskVms(v ...*TaskVirtualMachine) *VirtualMachineUpdate {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.RemoveTaskVMIDs(ids...)
|
|
}
|
|
|
|
// Save executes the query and returns the number of nodes affected by the update operation.
|
|
func (_u *VirtualMachineUpdate) Save(ctx context.Context) (int, error) {
|
|
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (_u *VirtualMachineUpdate) SaveX(ctx context.Context) int {
|
|
affected, err := _u.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return affected
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_u *VirtualMachineUpdate) Exec(ctx context.Context) error {
|
|
_, err := _u.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_u *VirtualMachineUpdate) ExecX(ctx context.Context) {
|
|
if err := _u.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
func (_u *VirtualMachineUpdate) check() error {
|
|
if _u.mutation.HostCleared() && len(_u.mutation.HostIDs()) > 0 {
|
|
return errors.New(`db: clearing a required unique edge "VirtualMachine.host"`)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
|
|
func (_u *VirtualMachineUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *VirtualMachineUpdate {
|
|
_u.modifiers = append(_u.modifiers, modifiers...)
|
|
return _u
|
|
}
|
|
|
|
func (_u *VirtualMachineUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
|
if err := _u.check(); err != nil {
|
|
return _node, err
|
|
}
|
|
_spec := sqlgraph.NewUpdateSpec(virtualmachine.Table, virtualmachine.Columns, sqlgraph.NewFieldSpec(virtualmachine.FieldID, field.TypeString))
|
|
if ps := _u.mutation.predicates; len(ps) > 0 {
|
|
_spec.Predicate = func(selector *sql.Selector) {
|
|
for i := range ps {
|
|
ps[i](selector)
|
|
}
|
|
}
|
|
}
|
|
if value, ok := _u.mutation.DeletedAt(); ok {
|
|
_spec.SetField(virtualmachine.FieldDeletedAt, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.DeletedAtCleared() {
|
|
_spec.ClearField(virtualmachine.FieldDeletedAt, field.TypeTime)
|
|
}
|
|
if value, ok := _u.mutation.AccessToken(); ok {
|
|
_spec.SetField(virtualmachine.FieldAccessToken, field.TypeString, value)
|
|
}
|
|
if _u.mutation.AccessTokenCleared() {
|
|
_spec.ClearField(virtualmachine.FieldAccessToken, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.EnvironmentID(); ok {
|
|
_spec.SetField(virtualmachine.FieldEnvironmentID, field.TypeString, value)
|
|
}
|
|
if _u.mutation.EnvironmentIDCleared() {
|
|
_spec.ClearField(virtualmachine.FieldEnvironmentID, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Name(); ok {
|
|
_spec.SetField(virtualmachine.FieldName, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.Hostname(); ok {
|
|
_spec.SetField(virtualmachine.FieldHostname, field.TypeString, value)
|
|
}
|
|
if _u.mutation.HostnameCleared() {
|
|
_spec.ClearField(virtualmachine.FieldHostname, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Arch(); ok {
|
|
_spec.SetField(virtualmachine.FieldArch, field.TypeString, value)
|
|
}
|
|
if _u.mutation.ArchCleared() {
|
|
_spec.ClearField(virtualmachine.FieldArch, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Cores(); ok {
|
|
_spec.SetField(virtualmachine.FieldCores, field.TypeInt, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedCores(); ok {
|
|
_spec.AddField(virtualmachine.FieldCores, field.TypeInt, value)
|
|
}
|
|
if _u.mutation.CoresCleared() {
|
|
_spec.ClearField(virtualmachine.FieldCores, field.TypeInt)
|
|
}
|
|
if value, ok := _u.mutation.Memory(); ok {
|
|
_spec.SetField(virtualmachine.FieldMemory, field.TypeInt64, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedMemory(); ok {
|
|
_spec.AddField(virtualmachine.FieldMemory, field.TypeInt64, value)
|
|
}
|
|
if _u.mutation.MemoryCleared() {
|
|
_spec.ClearField(virtualmachine.FieldMemory, field.TypeInt64)
|
|
}
|
|
if value, ok := _u.mutation.Os(); ok {
|
|
_spec.SetField(virtualmachine.FieldOs, field.TypeString, value)
|
|
}
|
|
if _u.mutation.OsCleared() {
|
|
_spec.ClearField(virtualmachine.FieldOs, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.ExternalIP(); ok {
|
|
_spec.SetField(virtualmachine.FieldExternalIP, field.TypeString, value)
|
|
}
|
|
if _u.mutation.ExternalIPCleared() {
|
|
_spec.ClearField(virtualmachine.FieldExternalIP, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.InternalIP(); ok {
|
|
_spec.SetField(virtualmachine.FieldInternalIP, field.TypeString, value)
|
|
}
|
|
if _u.mutation.InternalIPCleared() {
|
|
_spec.ClearField(virtualmachine.FieldInternalIP, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Version(); ok {
|
|
_spec.SetField(virtualmachine.FieldVersion, field.TypeString, value)
|
|
}
|
|
if _u.mutation.VersionCleared() {
|
|
_spec.ClearField(virtualmachine.FieldVersion, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.MachineID(); ok {
|
|
_spec.SetField(virtualmachine.FieldMachineID, field.TypeString, value)
|
|
}
|
|
if _u.mutation.MachineIDCleared() {
|
|
_spec.ClearField(virtualmachine.FieldMachineID, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.RepoURL(); ok {
|
|
_spec.SetField(virtualmachine.FieldRepoURL, field.TypeString, value)
|
|
}
|
|
if _u.mutation.RepoURLCleared() {
|
|
_spec.ClearField(virtualmachine.FieldRepoURL, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.RepoFilename(); ok {
|
|
_spec.SetField(virtualmachine.FieldRepoFilename, field.TypeString, value)
|
|
}
|
|
if _u.mutation.RepoFilenameCleared() {
|
|
_spec.ClearField(virtualmachine.FieldRepoFilename, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Branch(); ok {
|
|
_spec.SetField(virtualmachine.FieldBranch, field.TypeString, value)
|
|
}
|
|
if _u.mutation.BranchCleared() {
|
|
_spec.ClearField(virtualmachine.FieldBranch, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.IsRecycled(); ok {
|
|
_spec.SetField(virtualmachine.FieldIsRecycled, field.TypeBool, value)
|
|
}
|
|
if _u.mutation.IsRecycledCleared() {
|
|
_spec.ClearField(virtualmachine.FieldIsRecycled, field.TypeBool)
|
|
}
|
|
if value, ok := _u.mutation.Conditions(); ok {
|
|
_spec.SetField(virtualmachine.FieldConditions, field.TypeJSON, value)
|
|
}
|
|
if _u.mutation.ConditionsCleared() {
|
|
_spec.ClearField(virtualmachine.FieldConditions, field.TypeJSON)
|
|
}
|
|
if value, ok := _u.mutation.ExpiredAt(); ok {
|
|
_spec.SetField(virtualmachine.FieldExpiredAt, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.ExpiredAtCleared() {
|
|
_spec.ClearField(virtualmachine.FieldExpiredAt, field.TypeTime)
|
|
}
|
|
if value, ok := _u.mutation.CreatedAt(); ok {
|
|
_spec.SetField(virtualmachine.FieldCreatedAt, field.TypeTime, value)
|
|
}
|
|
if value, ok := _u.mutation.UpdatedAt(); ok {
|
|
_spec.SetField(virtualmachine.FieldUpdatedAt, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.HostCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: virtualmachine.HostTable,
|
|
Columns: []string{virtualmachine.HostColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(host.FieldID, field.TypeString),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.HostIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: virtualmachine.HostTable,
|
|
Columns: []string{virtualmachine.HostColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(host.FieldID, field.TypeString),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
}
|
|
if _u.mutation.ModelCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: virtualmachine.ModelTable,
|
|
Columns: []string{virtualmachine.ModelColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(model.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.ModelIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: virtualmachine.ModelTable,
|
|
Columns: []string{virtualmachine.ModelColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(model.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
}
|
|
if _u.mutation.UserCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: virtualmachine.UserTable,
|
|
Columns: []string{virtualmachine.UserColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.UserIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: virtualmachine.UserTable,
|
|
Columns: []string{virtualmachine.UserColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
}
|
|
if _u.mutation.GitIdentityCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: virtualmachine.GitIdentityTable,
|
|
Columns: []string{virtualmachine.GitIdentityColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(gitidentity.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.GitIdentityIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: virtualmachine.GitIdentityTable,
|
|
Columns: []string{virtualmachine.GitIdentityColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(gitidentity.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
}
|
|
if _u.mutation.TasksCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2M,
|
|
Inverse: false,
|
|
Table: virtualmachine.TasksTable,
|
|
Columns: virtualmachine.TasksPrimaryKey,
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(task.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
createE := &TaskVirtualMachineCreate{config: _u.config, mutation: newTaskVirtualMachineMutation(_u.config, OpCreate)}
|
|
createE.defaults()
|
|
_, specE := createE.createSpec()
|
|
edge.Target.Fields = specE.Fields
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.RemovedTasksIDs(); len(nodes) > 0 && !_u.mutation.TasksCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2M,
|
|
Inverse: false,
|
|
Table: virtualmachine.TasksTable,
|
|
Columns: virtualmachine.TasksPrimaryKey,
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(task.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
createE := &TaskVirtualMachineCreate{config: _u.config, mutation: newTaskVirtualMachineMutation(_u.config, OpCreate)}
|
|
createE.defaults()
|
|
_, specE := createE.createSpec()
|
|
edge.Target.Fields = specE.Fields
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.TasksIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2M,
|
|
Inverse: false,
|
|
Table: virtualmachine.TasksTable,
|
|
Columns: virtualmachine.TasksPrimaryKey,
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(task.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
createE := &TaskVirtualMachineCreate{config: _u.config, mutation: newTaskVirtualMachineMutation(_u.config, OpCreate)}
|
|
createE.defaults()
|
|
_, specE := createE.createSpec()
|
|
edge.Target.Fields = specE.Fields
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
}
|
|
if _u.mutation.TaskVmsCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: true,
|
|
Table: virtualmachine.TaskVmsTable,
|
|
Columns: []string{virtualmachine.TaskVmsColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(taskvirtualmachine.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.RemovedTaskVmsIDs(); len(nodes) > 0 && !_u.mutation.TaskVmsCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: true,
|
|
Table: virtualmachine.TaskVmsTable,
|
|
Columns: []string{virtualmachine.TaskVmsColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(taskvirtualmachine.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.TaskVmsIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: true,
|
|
Table: virtualmachine.TaskVmsTable,
|
|
Columns: []string{virtualmachine.TaskVmsColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(taskvirtualmachine.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
}
|
|
_spec.AddModifiers(_u.modifiers...)
|
|
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
|
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
|
err = &NotFoundError{virtualmachine.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return 0, err
|
|
}
|
|
_u.mutation.done = true
|
|
return _node, nil
|
|
}
|
|
|
|
// VirtualMachineUpdateOne is the builder for updating a single VirtualMachine entity.
|
|
type VirtualMachineUpdateOne struct {
|
|
config
|
|
fields []string
|
|
hooks []Hook
|
|
mutation *VirtualMachineMutation
|
|
modifiers []func(*sql.UpdateBuilder)
|
|
}
|
|
|
|
// SetDeletedAt sets the "deleted_at" field.
|
|
func (_u *VirtualMachineUpdateOne) SetDeletedAt(v time.Time) *VirtualMachineUpdateOne {
|
|
_u.mutation.SetDeletedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdateOne) SetNillableDeletedAt(v *time.Time) *VirtualMachineUpdateOne {
|
|
if v != nil {
|
|
_u.SetDeletedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearDeletedAt clears the value of the "deleted_at" field.
|
|
func (_u *VirtualMachineUpdateOne) ClearDeletedAt() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearDeletedAt()
|
|
return _u
|
|
}
|
|
|
|
// SetAccessToken sets the "access_token" field.
|
|
func (_u *VirtualMachineUpdateOne) SetAccessToken(v string) *VirtualMachineUpdateOne {
|
|
_u.mutation.SetAccessToken(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableAccessToken sets the "access_token" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdateOne) SetNillableAccessToken(v *string) *VirtualMachineUpdateOne {
|
|
if v != nil {
|
|
_u.SetAccessToken(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearAccessToken clears the value of the "access_token" field.
|
|
func (_u *VirtualMachineUpdateOne) ClearAccessToken() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearAccessToken()
|
|
return _u
|
|
}
|
|
|
|
// SetHostID sets the "host_id" field.
|
|
func (_u *VirtualMachineUpdateOne) SetHostID(v string) *VirtualMachineUpdateOne {
|
|
_u.mutation.SetHostID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableHostID sets the "host_id" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdateOne) SetNillableHostID(v *string) *VirtualMachineUpdateOne {
|
|
if v != nil {
|
|
_u.SetHostID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetUserID sets the "user_id" field.
|
|
func (_u *VirtualMachineUpdateOne) SetUserID(v uuid.UUID) *VirtualMachineUpdateOne {
|
|
_u.mutation.SetUserID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableUserID sets the "user_id" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdateOne) SetNillableUserID(v *uuid.UUID) *VirtualMachineUpdateOne {
|
|
if v != nil {
|
|
_u.SetUserID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearUserID clears the value of the "user_id" field.
|
|
func (_u *VirtualMachineUpdateOne) ClearUserID() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearUserID()
|
|
return _u
|
|
}
|
|
|
|
// SetModelID sets the "model_id" field.
|
|
func (_u *VirtualMachineUpdateOne) SetModelID(v uuid.UUID) *VirtualMachineUpdateOne {
|
|
_u.mutation.SetModelID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableModelID sets the "model_id" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdateOne) SetNillableModelID(v *uuid.UUID) *VirtualMachineUpdateOne {
|
|
if v != nil {
|
|
_u.SetModelID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearModelID clears the value of the "model_id" field.
|
|
func (_u *VirtualMachineUpdateOne) ClearModelID() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearModelID()
|
|
return _u
|
|
}
|
|
|
|
// SetEnvironmentID sets the "environment_id" field.
|
|
func (_u *VirtualMachineUpdateOne) SetEnvironmentID(v string) *VirtualMachineUpdateOne {
|
|
_u.mutation.SetEnvironmentID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableEnvironmentID sets the "environment_id" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdateOne) SetNillableEnvironmentID(v *string) *VirtualMachineUpdateOne {
|
|
if v != nil {
|
|
_u.SetEnvironmentID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearEnvironmentID clears the value of the "environment_id" field.
|
|
func (_u *VirtualMachineUpdateOne) ClearEnvironmentID() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearEnvironmentID()
|
|
return _u
|
|
}
|
|
|
|
// SetName sets the "name" field.
|
|
func (_u *VirtualMachineUpdateOne) SetName(v string) *VirtualMachineUpdateOne {
|
|
_u.mutation.SetName(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableName sets the "name" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdateOne) SetNillableName(v *string) *VirtualMachineUpdateOne {
|
|
if v != nil {
|
|
_u.SetName(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetHostname sets the "hostname" field.
|
|
func (_u *VirtualMachineUpdateOne) SetHostname(v string) *VirtualMachineUpdateOne {
|
|
_u.mutation.SetHostname(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableHostname sets the "hostname" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdateOne) SetNillableHostname(v *string) *VirtualMachineUpdateOne {
|
|
if v != nil {
|
|
_u.SetHostname(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearHostname clears the value of the "hostname" field.
|
|
func (_u *VirtualMachineUpdateOne) ClearHostname() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearHostname()
|
|
return _u
|
|
}
|
|
|
|
// SetArch sets the "arch" field.
|
|
func (_u *VirtualMachineUpdateOne) SetArch(v string) *VirtualMachineUpdateOne {
|
|
_u.mutation.SetArch(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableArch sets the "arch" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdateOne) SetNillableArch(v *string) *VirtualMachineUpdateOne {
|
|
if v != nil {
|
|
_u.SetArch(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearArch clears the value of the "arch" field.
|
|
func (_u *VirtualMachineUpdateOne) ClearArch() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearArch()
|
|
return _u
|
|
}
|
|
|
|
// SetCores sets the "cores" field.
|
|
func (_u *VirtualMachineUpdateOne) SetCores(v int) *VirtualMachineUpdateOne {
|
|
_u.mutation.ResetCores()
|
|
_u.mutation.SetCores(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableCores sets the "cores" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdateOne) SetNillableCores(v *int) *VirtualMachineUpdateOne {
|
|
if v != nil {
|
|
_u.SetCores(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddCores adds value to the "cores" field.
|
|
func (_u *VirtualMachineUpdateOne) AddCores(v int) *VirtualMachineUpdateOne {
|
|
_u.mutation.AddCores(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearCores clears the value of the "cores" field.
|
|
func (_u *VirtualMachineUpdateOne) ClearCores() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearCores()
|
|
return _u
|
|
}
|
|
|
|
// SetMemory sets the "memory" field.
|
|
func (_u *VirtualMachineUpdateOne) SetMemory(v int64) *VirtualMachineUpdateOne {
|
|
_u.mutation.ResetMemory()
|
|
_u.mutation.SetMemory(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableMemory sets the "memory" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdateOne) SetNillableMemory(v *int64) *VirtualMachineUpdateOne {
|
|
if v != nil {
|
|
_u.SetMemory(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddMemory adds value to the "memory" field.
|
|
func (_u *VirtualMachineUpdateOne) AddMemory(v int64) *VirtualMachineUpdateOne {
|
|
_u.mutation.AddMemory(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearMemory clears the value of the "memory" field.
|
|
func (_u *VirtualMachineUpdateOne) ClearMemory() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearMemory()
|
|
return _u
|
|
}
|
|
|
|
// SetOs sets the "os" field.
|
|
func (_u *VirtualMachineUpdateOne) SetOs(v string) *VirtualMachineUpdateOne {
|
|
_u.mutation.SetOs(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableOs sets the "os" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdateOne) SetNillableOs(v *string) *VirtualMachineUpdateOne {
|
|
if v != nil {
|
|
_u.SetOs(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearOs clears the value of the "os" field.
|
|
func (_u *VirtualMachineUpdateOne) ClearOs() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearOs()
|
|
return _u
|
|
}
|
|
|
|
// SetExternalIP sets the "external_ip" field.
|
|
func (_u *VirtualMachineUpdateOne) SetExternalIP(v string) *VirtualMachineUpdateOne {
|
|
_u.mutation.SetExternalIP(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableExternalIP sets the "external_ip" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdateOne) SetNillableExternalIP(v *string) *VirtualMachineUpdateOne {
|
|
if v != nil {
|
|
_u.SetExternalIP(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearExternalIP clears the value of the "external_ip" field.
|
|
func (_u *VirtualMachineUpdateOne) ClearExternalIP() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearExternalIP()
|
|
return _u
|
|
}
|
|
|
|
// SetInternalIP sets the "internal_ip" field.
|
|
func (_u *VirtualMachineUpdateOne) SetInternalIP(v string) *VirtualMachineUpdateOne {
|
|
_u.mutation.SetInternalIP(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableInternalIP sets the "internal_ip" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdateOne) SetNillableInternalIP(v *string) *VirtualMachineUpdateOne {
|
|
if v != nil {
|
|
_u.SetInternalIP(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearInternalIP clears the value of the "internal_ip" field.
|
|
func (_u *VirtualMachineUpdateOne) ClearInternalIP() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearInternalIP()
|
|
return _u
|
|
}
|
|
|
|
// SetVersion sets the "version" field.
|
|
func (_u *VirtualMachineUpdateOne) SetVersion(v string) *VirtualMachineUpdateOne {
|
|
_u.mutation.SetVersion(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableVersion sets the "version" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdateOne) SetNillableVersion(v *string) *VirtualMachineUpdateOne {
|
|
if v != nil {
|
|
_u.SetVersion(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearVersion clears the value of the "version" field.
|
|
func (_u *VirtualMachineUpdateOne) ClearVersion() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearVersion()
|
|
return _u
|
|
}
|
|
|
|
// SetMachineID sets the "machine_id" field.
|
|
func (_u *VirtualMachineUpdateOne) SetMachineID(v string) *VirtualMachineUpdateOne {
|
|
_u.mutation.SetMachineID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableMachineID sets the "machine_id" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdateOne) SetNillableMachineID(v *string) *VirtualMachineUpdateOne {
|
|
if v != nil {
|
|
_u.SetMachineID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearMachineID clears the value of the "machine_id" field.
|
|
func (_u *VirtualMachineUpdateOne) ClearMachineID() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearMachineID()
|
|
return _u
|
|
}
|
|
|
|
// SetRepoURL sets the "repo_url" field.
|
|
func (_u *VirtualMachineUpdateOne) SetRepoURL(v string) *VirtualMachineUpdateOne {
|
|
_u.mutation.SetRepoURL(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRepoURL sets the "repo_url" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdateOne) SetNillableRepoURL(v *string) *VirtualMachineUpdateOne {
|
|
if v != nil {
|
|
_u.SetRepoURL(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearRepoURL clears the value of the "repo_url" field.
|
|
func (_u *VirtualMachineUpdateOne) ClearRepoURL() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearRepoURL()
|
|
return _u
|
|
}
|
|
|
|
// SetRepoFilename sets the "repo_filename" field.
|
|
func (_u *VirtualMachineUpdateOne) SetRepoFilename(v string) *VirtualMachineUpdateOne {
|
|
_u.mutation.SetRepoFilename(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRepoFilename sets the "repo_filename" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdateOne) SetNillableRepoFilename(v *string) *VirtualMachineUpdateOne {
|
|
if v != nil {
|
|
_u.SetRepoFilename(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearRepoFilename clears the value of the "repo_filename" field.
|
|
func (_u *VirtualMachineUpdateOne) ClearRepoFilename() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearRepoFilename()
|
|
return _u
|
|
}
|
|
|
|
// SetBranch sets the "branch" field.
|
|
func (_u *VirtualMachineUpdateOne) SetBranch(v string) *VirtualMachineUpdateOne {
|
|
_u.mutation.SetBranch(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableBranch sets the "branch" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdateOne) SetNillableBranch(v *string) *VirtualMachineUpdateOne {
|
|
if v != nil {
|
|
_u.SetBranch(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearBranch clears the value of the "branch" field.
|
|
func (_u *VirtualMachineUpdateOne) ClearBranch() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearBranch()
|
|
return _u
|
|
}
|
|
|
|
// SetGitIdentityID sets the "git_identity_id" field.
|
|
func (_u *VirtualMachineUpdateOne) SetGitIdentityID(v uuid.UUID) *VirtualMachineUpdateOne {
|
|
_u.mutation.SetGitIdentityID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableGitIdentityID sets the "git_identity_id" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdateOne) SetNillableGitIdentityID(v *uuid.UUID) *VirtualMachineUpdateOne {
|
|
if v != nil {
|
|
_u.SetGitIdentityID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearGitIdentityID clears the value of the "git_identity_id" field.
|
|
func (_u *VirtualMachineUpdateOne) ClearGitIdentityID() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearGitIdentityID()
|
|
return _u
|
|
}
|
|
|
|
// SetIsRecycled sets the "is_recycled" field.
|
|
func (_u *VirtualMachineUpdateOne) SetIsRecycled(v bool) *VirtualMachineUpdateOne {
|
|
_u.mutation.SetIsRecycled(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableIsRecycled sets the "is_recycled" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdateOne) SetNillableIsRecycled(v *bool) *VirtualMachineUpdateOne {
|
|
if v != nil {
|
|
_u.SetIsRecycled(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearIsRecycled clears the value of the "is_recycled" field.
|
|
func (_u *VirtualMachineUpdateOne) ClearIsRecycled() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearIsRecycled()
|
|
return _u
|
|
}
|
|
|
|
// SetConditions sets the "conditions" field.
|
|
func (_u *VirtualMachineUpdateOne) SetConditions(v *types.VirtualMachineCondition) *VirtualMachineUpdateOne {
|
|
_u.mutation.SetConditions(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearConditions clears the value of the "conditions" field.
|
|
func (_u *VirtualMachineUpdateOne) ClearConditions() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearConditions()
|
|
return _u
|
|
}
|
|
|
|
// SetExpiredAt sets the "expired_at" field.
|
|
func (_u *VirtualMachineUpdateOne) SetExpiredAt(v time.Time) *VirtualMachineUpdateOne {
|
|
_u.mutation.SetExpiredAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableExpiredAt sets the "expired_at" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdateOne) SetNillableExpiredAt(v *time.Time) *VirtualMachineUpdateOne {
|
|
if v != nil {
|
|
_u.SetExpiredAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearExpiredAt clears the value of the "expired_at" field.
|
|
func (_u *VirtualMachineUpdateOne) ClearExpiredAt() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearExpiredAt()
|
|
return _u
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (_u *VirtualMachineUpdateOne) SetCreatedAt(v time.Time) *VirtualMachineUpdateOne {
|
|
_u.mutation.SetCreatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdateOne) SetNillableCreatedAt(v *time.Time) *VirtualMachineUpdateOne {
|
|
if v != nil {
|
|
_u.SetCreatedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (_u *VirtualMachineUpdateOne) SetUpdatedAt(v time.Time) *VirtualMachineUpdateOne {
|
|
_u.mutation.SetUpdatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
|
|
func (_u *VirtualMachineUpdateOne) SetNillableUpdatedAt(v *time.Time) *VirtualMachineUpdateOne {
|
|
if v != nil {
|
|
_u.SetUpdatedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetHost sets the "host" edge to the Host entity.
|
|
func (_u *VirtualMachineUpdateOne) SetHost(v *Host) *VirtualMachineUpdateOne {
|
|
return _u.SetHostID(v.ID)
|
|
}
|
|
|
|
// SetModel sets the "model" edge to the Model entity.
|
|
func (_u *VirtualMachineUpdateOne) SetModel(v *Model) *VirtualMachineUpdateOne {
|
|
return _u.SetModelID(v.ID)
|
|
}
|
|
|
|
// SetUser sets the "user" edge to the User entity.
|
|
func (_u *VirtualMachineUpdateOne) SetUser(v *User) *VirtualMachineUpdateOne {
|
|
return _u.SetUserID(v.ID)
|
|
}
|
|
|
|
// SetGitIdentity sets the "git_identity" edge to the GitIdentity entity.
|
|
func (_u *VirtualMachineUpdateOne) SetGitIdentity(v *GitIdentity) *VirtualMachineUpdateOne {
|
|
return _u.SetGitIdentityID(v.ID)
|
|
}
|
|
|
|
// AddTaskIDs adds the "tasks" edge to the Task entity by IDs.
|
|
func (_u *VirtualMachineUpdateOne) AddTaskIDs(ids ...uuid.UUID) *VirtualMachineUpdateOne {
|
|
_u.mutation.AddTaskIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// AddTasks adds the "tasks" edges to the Task entity.
|
|
func (_u *VirtualMachineUpdateOne) AddTasks(v ...*Task) *VirtualMachineUpdateOne {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.AddTaskIDs(ids...)
|
|
}
|
|
|
|
// AddTaskVMIDs adds the "task_vms" edge to the TaskVirtualMachine entity by IDs.
|
|
func (_u *VirtualMachineUpdateOne) AddTaskVMIDs(ids ...uuid.UUID) *VirtualMachineUpdateOne {
|
|
_u.mutation.AddTaskVMIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// AddTaskVms adds the "task_vms" edges to the TaskVirtualMachine entity.
|
|
func (_u *VirtualMachineUpdateOne) AddTaskVms(v ...*TaskVirtualMachine) *VirtualMachineUpdateOne {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.AddTaskVMIDs(ids...)
|
|
}
|
|
|
|
// Mutation returns the VirtualMachineMutation object of the builder.
|
|
func (_u *VirtualMachineUpdateOne) Mutation() *VirtualMachineMutation {
|
|
return _u.mutation
|
|
}
|
|
|
|
// ClearHost clears the "host" edge to the Host entity.
|
|
func (_u *VirtualMachineUpdateOne) ClearHost() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearHost()
|
|
return _u
|
|
}
|
|
|
|
// ClearModel clears the "model" edge to the Model entity.
|
|
func (_u *VirtualMachineUpdateOne) ClearModel() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearModel()
|
|
return _u
|
|
}
|
|
|
|
// ClearUser clears the "user" edge to the User entity.
|
|
func (_u *VirtualMachineUpdateOne) ClearUser() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearUser()
|
|
return _u
|
|
}
|
|
|
|
// ClearGitIdentity clears the "git_identity" edge to the GitIdentity entity.
|
|
func (_u *VirtualMachineUpdateOne) ClearGitIdentity() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearGitIdentity()
|
|
return _u
|
|
}
|
|
|
|
// ClearTasks clears all "tasks" edges to the Task entity.
|
|
func (_u *VirtualMachineUpdateOne) ClearTasks() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearTasks()
|
|
return _u
|
|
}
|
|
|
|
// RemoveTaskIDs removes the "tasks" edge to Task entities by IDs.
|
|
func (_u *VirtualMachineUpdateOne) RemoveTaskIDs(ids ...uuid.UUID) *VirtualMachineUpdateOne {
|
|
_u.mutation.RemoveTaskIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// RemoveTasks removes "tasks" edges to Task entities.
|
|
func (_u *VirtualMachineUpdateOne) RemoveTasks(v ...*Task) *VirtualMachineUpdateOne {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.RemoveTaskIDs(ids...)
|
|
}
|
|
|
|
// ClearTaskVms clears all "task_vms" edges to the TaskVirtualMachine entity.
|
|
func (_u *VirtualMachineUpdateOne) ClearTaskVms() *VirtualMachineUpdateOne {
|
|
_u.mutation.ClearTaskVms()
|
|
return _u
|
|
}
|
|
|
|
// RemoveTaskVMIDs removes the "task_vms" edge to TaskVirtualMachine entities by IDs.
|
|
func (_u *VirtualMachineUpdateOne) RemoveTaskVMIDs(ids ...uuid.UUID) *VirtualMachineUpdateOne {
|
|
_u.mutation.RemoveTaskVMIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// RemoveTaskVms removes "task_vms" edges to TaskVirtualMachine entities.
|
|
func (_u *VirtualMachineUpdateOne) RemoveTaskVms(v ...*TaskVirtualMachine) *VirtualMachineUpdateOne {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.RemoveTaskVMIDs(ids...)
|
|
}
|
|
|
|
// Where appends a list predicates to the VirtualMachineUpdate builder.
|
|
func (_u *VirtualMachineUpdateOne) Where(ps ...predicate.VirtualMachine) *VirtualMachineUpdateOne {
|
|
_u.mutation.Where(ps...)
|
|
return _u
|
|
}
|
|
|
|
// Select allows selecting one or more fields (columns) of the returned entity.
|
|
// The default is selecting all fields defined in the entity schema.
|
|
func (_u *VirtualMachineUpdateOne) Select(field string, fields ...string) *VirtualMachineUpdateOne {
|
|
_u.fields = append([]string{field}, fields...)
|
|
return _u
|
|
}
|
|
|
|
// Save executes the query and returns the updated VirtualMachine entity.
|
|
func (_u *VirtualMachineUpdateOne) Save(ctx context.Context) (*VirtualMachine, error) {
|
|
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (_u *VirtualMachineUpdateOne) SaveX(ctx context.Context) *VirtualMachine {
|
|
node, err := _u.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return node
|
|
}
|
|
|
|
// Exec executes the query on the entity.
|
|
func (_u *VirtualMachineUpdateOne) Exec(ctx context.Context) error {
|
|
_, err := _u.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_u *VirtualMachineUpdateOne) ExecX(ctx context.Context) {
|
|
if err := _u.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
func (_u *VirtualMachineUpdateOne) check() error {
|
|
if _u.mutation.HostCleared() && len(_u.mutation.HostIDs()) > 0 {
|
|
return errors.New(`db: clearing a required unique edge "VirtualMachine.host"`)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
|
|
func (_u *VirtualMachineUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *VirtualMachineUpdateOne {
|
|
_u.modifiers = append(_u.modifiers, modifiers...)
|
|
return _u
|
|
}
|
|
|
|
func (_u *VirtualMachineUpdateOne) sqlSave(ctx context.Context) (_node *VirtualMachine, err error) {
|
|
if err := _u.check(); err != nil {
|
|
return _node, err
|
|
}
|
|
_spec := sqlgraph.NewUpdateSpec(virtualmachine.Table, virtualmachine.Columns, sqlgraph.NewFieldSpec(virtualmachine.FieldID, field.TypeString))
|
|
id, ok := _u.mutation.ID()
|
|
if !ok {
|
|
return nil, &ValidationError{Name: "id", err: errors.New(`db: missing "VirtualMachine.id" for update`)}
|
|
}
|
|
_spec.Node.ID.Value = id
|
|
if fields := _u.fields; len(fields) > 0 {
|
|
_spec.Node.Columns = make([]string, 0, len(fields))
|
|
_spec.Node.Columns = append(_spec.Node.Columns, virtualmachine.FieldID)
|
|
for _, f := range fields {
|
|
if !virtualmachine.ValidColumn(f) {
|
|
return nil, &ValidationError{Name: f, err: fmt.Errorf("db: invalid field %q for query", f)}
|
|
}
|
|
if f != virtualmachine.FieldID {
|
|
_spec.Node.Columns = append(_spec.Node.Columns, f)
|
|
}
|
|
}
|
|
}
|
|
if ps := _u.mutation.predicates; len(ps) > 0 {
|
|
_spec.Predicate = func(selector *sql.Selector) {
|
|
for i := range ps {
|
|
ps[i](selector)
|
|
}
|
|
}
|
|
}
|
|
if value, ok := _u.mutation.DeletedAt(); ok {
|
|
_spec.SetField(virtualmachine.FieldDeletedAt, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.DeletedAtCleared() {
|
|
_spec.ClearField(virtualmachine.FieldDeletedAt, field.TypeTime)
|
|
}
|
|
if value, ok := _u.mutation.AccessToken(); ok {
|
|
_spec.SetField(virtualmachine.FieldAccessToken, field.TypeString, value)
|
|
}
|
|
if _u.mutation.AccessTokenCleared() {
|
|
_spec.ClearField(virtualmachine.FieldAccessToken, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.EnvironmentID(); ok {
|
|
_spec.SetField(virtualmachine.FieldEnvironmentID, field.TypeString, value)
|
|
}
|
|
if _u.mutation.EnvironmentIDCleared() {
|
|
_spec.ClearField(virtualmachine.FieldEnvironmentID, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Name(); ok {
|
|
_spec.SetField(virtualmachine.FieldName, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.Hostname(); ok {
|
|
_spec.SetField(virtualmachine.FieldHostname, field.TypeString, value)
|
|
}
|
|
if _u.mutation.HostnameCleared() {
|
|
_spec.ClearField(virtualmachine.FieldHostname, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Arch(); ok {
|
|
_spec.SetField(virtualmachine.FieldArch, field.TypeString, value)
|
|
}
|
|
if _u.mutation.ArchCleared() {
|
|
_spec.ClearField(virtualmachine.FieldArch, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Cores(); ok {
|
|
_spec.SetField(virtualmachine.FieldCores, field.TypeInt, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedCores(); ok {
|
|
_spec.AddField(virtualmachine.FieldCores, field.TypeInt, value)
|
|
}
|
|
if _u.mutation.CoresCleared() {
|
|
_spec.ClearField(virtualmachine.FieldCores, field.TypeInt)
|
|
}
|
|
if value, ok := _u.mutation.Memory(); ok {
|
|
_spec.SetField(virtualmachine.FieldMemory, field.TypeInt64, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedMemory(); ok {
|
|
_spec.AddField(virtualmachine.FieldMemory, field.TypeInt64, value)
|
|
}
|
|
if _u.mutation.MemoryCleared() {
|
|
_spec.ClearField(virtualmachine.FieldMemory, field.TypeInt64)
|
|
}
|
|
if value, ok := _u.mutation.Os(); ok {
|
|
_spec.SetField(virtualmachine.FieldOs, field.TypeString, value)
|
|
}
|
|
if _u.mutation.OsCleared() {
|
|
_spec.ClearField(virtualmachine.FieldOs, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.ExternalIP(); ok {
|
|
_spec.SetField(virtualmachine.FieldExternalIP, field.TypeString, value)
|
|
}
|
|
if _u.mutation.ExternalIPCleared() {
|
|
_spec.ClearField(virtualmachine.FieldExternalIP, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.InternalIP(); ok {
|
|
_spec.SetField(virtualmachine.FieldInternalIP, field.TypeString, value)
|
|
}
|
|
if _u.mutation.InternalIPCleared() {
|
|
_spec.ClearField(virtualmachine.FieldInternalIP, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Version(); ok {
|
|
_spec.SetField(virtualmachine.FieldVersion, field.TypeString, value)
|
|
}
|
|
if _u.mutation.VersionCleared() {
|
|
_spec.ClearField(virtualmachine.FieldVersion, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.MachineID(); ok {
|
|
_spec.SetField(virtualmachine.FieldMachineID, field.TypeString, value)
|
|
}
|
|
if _u.mutation.MachineIDCleared() {
|
|
_spec.ClearField(virtualmachine.FieldMachineID, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.RepoURL(); ok {
|
|
_spec.SetField(virtualmachine.FieldRepoURL, field.TypeString, value)
|
|
}
|
|
if _u.mutation.RepoURLCleared() {
|
|
_spec.ClearField(virtualmachine.FieldRepoURL, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.RepoFilename(); ok {
|
|
_spec.SetField(virtualmachine.FieldRepoFilename, field.TypeString, value)
|
|
}
|
|
if _u.mutation.RepoFilenameCleared() {
|
|
_spec.ClearField(virtualmachine.FieldRepoFilename, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Branch(); ok {
|
|
_spec.SetField(virtualmachine.FieldBranch, field.TypeString, value)
|
|
}
|
|
if _u.mutation.BranchCleared() {
|
|
_spec.ClearField(virtualmachine.FieldBranch, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.IsRecycled(); ok {
|
|
_spec.SetField(virtualmachine.FieldIsRecycled, field.TypeBool, value)
|
|
}
|
|
if _u.mutation.IsRecycledCleared() {
|
|
_spec.ClearField(virtualmachine.FieldIsRecycled, field.TypeBool)
|
|
}
|
|
if value, ok := _u.mutation.Conditions(); ok {
|
|
_spec.SetField(virtualmachine.FieldConditions, field.TypeJSON, value)
|
|
}
|
|
if _u.mutation.ConditionsCleared() {
|
|
_spec.ClearField(virtualmachine.FieldConditions, field.TypeJSON)
|
|
}
|
|
if value, ok := _u.mutation.ExpiredAt(); ok {
|
|
_spec.SetField(virtualmachine.FieldExpiredAt, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.ExpiredAtCleared() {
|
|
_spec.ClearField(virtualmachine.FieldExpiredAt, field.TypeTime)
|
|
}
|
|
if value, ok := _u.mutation.CreatedAt(); ok {
|
|
_spec.SetField(virtualmachine.FieldCreatedAt, field.TypeTime, value)
|
|
}
|
|
if value, ok := _u.mutation.UpdatedAt(); ok {
|
|
_spec.SetField(virtualmachine.FieldUpdatedAt, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.HostCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: virtualmachine.HostTable,
|
|
Columns: []string{virtualmachine.HostColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(host.FieldID, field.TypeString),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.HostIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: virtualmachine.HostTable,
|
|
Columns: []string{virtualmachine.HostColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(host.FieldID, field.TypeString),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
}
|
|
if _u.mutation.ModelCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: virtualmachine.ModelTable,
|
|
Columns: []string{virtualmachine.ModelColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(model.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.ModelIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: virtualmachine.ModelTable,
|
|
Columns: []string{virtualmachine.ModelColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(model.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
}
|
|
if _u.mutation.UserCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: virtualmachine.UserTable,
|
|
Columns: []string{virtualmachine.UserColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.UserIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: virtualmachine.UserTable,
|
|
Columns: []string{virtualmachine.UserColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
}
|
|
if _u.mutation.GitIdentityCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: virtualmachine.GitIdentityTable,
|
|
Columns: []string{virtualmachine.GitIdentityColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(gitidentity.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.GitIdentityIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: virtualmachine.GitIdentityTable,
|
|
Columns: []string{virtualmachine.GitIdentityColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(gitidentity.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
}
|
|
if _u.mutation.TasksCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2M,
|
|
Inverse: false,
|
|
Table: virtualmachine.TasksTable,
|
|
Columns: virtualmachine.TasksPrimaryKey,
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(task.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
createE := &TaskVirtualMachineCreate{config: _u.config, mutation: newTaskVirtualMachineMutation(_u.config, OpCreate)}
|
|
createE.defaults()
|
|
_, specE := createE.createSpec()
|
|
edge.Target.Fields = specE.Fields
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.RemovedTasksIDs(); len(nodes) > 0 && !_u.mutation.TasksCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2M,
|
|
Inverse: false,
|
|
Table: virtualmachine.TasksTable,
|
|
Columns: virtualmachine.TasksPrimaryKey,
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(task.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
createE := &TaskVirtualMachineCreate{config: _u.config, mutation: newTaskVirtualMachineMutation(_u.config, OpCreate)}
|
|
createE.defaults()
|
|
_, specE := createE.createSpec()
|
|
edge.Target.Fields = specE.Fields
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.TasksIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2M,
|
|
Inverse: false,
|
|
Table: virtualmachine.TasksTable,
|
|
Columns: virtualmachine.TasksPrimaryKey,
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(task.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
createE := &TaskVirtualMachineCreate{config: _u.config, mutation: newTaskVirtualMachineMutation(_u.config, OpCreate)}
|
|
createE.defaults()
|
|
_, specE := createE.createSpec()
|
|
edge.Target.Fields = specE.Fields
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
}
|
|
if _u.mutation.TaskVmsCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: true,
|
|
Table: virtualmachine.TaskVmsTable,
|
|
Columns: []string{virtualmachine.TaskVmsColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(taskvirtualmachine.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.RemovedTaskVmsIDs(); len(nodes) > 0 && !_u.mutation.TaskVmsCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: true,
|
|
Table: virtualmachine.TaskVmsTable,
|
|
Columns: []string{virtualmachine.TaskVmsColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(taskvirtualmachine.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.TaskVmsIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: true,
|
|
Table: virtualmachine.TaskVmsTable,
|
|
Columns: []string{virtualmachine.TaskVmsColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(taskvirtualmachine.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
}
|
|
_spec.AddModifiers(_u.modifiers...)
|
|
_node = &VirtualMachine{config: _u.config}
|
|
_spec.Assign = _node.assignValues
|
|
_spec.ScanValues = _node.scanValues
|
|
if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
|
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
|
err = &NotFoundError{virtualmachine.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return nil, err
|
|
}
|
|
_u.mutation.done = true
|
|
return _node, nil
|
|
}
|