mirror of
https://github.com/chaitin/MonkeyCode.git
synced 2026-11-22 19:39:31 +08:00
- 新增 git_bots, git_bot_users, git_bot_tasks, project_git_bots 表 - 添加 user, host, project 到 gitbot 的关联边 - 使用 soft delete 和 created_at 游标
1847 lines
56 KiB
Go
1847 lines
56 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/consts"
|
|
"github.com/chaitin/MonkeyCode/backend/db/gitbot"
|
|
"github.com/chaitin/MonkeyCode/backend/db/gitidentity"
|
|
"github.com/chaitin/MonkeyCode/backend/db/image"
|
|
"github.com/chaitin/MonkeyCode/backend/db/predicate"
|
|
"github.com/chaitin/MonkeyCode/backend/db/project"
|
|
"github.com/chaitin/MonkeyCode/backend/db/projectcollaborator"
|
|
"github.com/chaitin/MonkeyCode/backend/db/projectgitbot"
|
|
"github.com/chaitin/MonkeyCode/backend/db/projectissue"
|
|
"github.com/chaitin/MonkeyCode/backend/db/projecttask"
|
|
"github.com/chaitin/MonkeyCode/backend/db/user"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// ProjectUpdate is the builder for updating Project entities.
|
|
type ProjectUpdate struct {
|
|
config
|
|
hooks []Hook
|
|
mutation *ProjectMutation
|
|
modifiers []func(*sql.UpdateBuilder)
|
|
}
|
|
|
|
// Where appends a list predicates to the ProjectUpdate builder.
|
|
func (_u *ProjectUpdate) Where(ps ...predicate.Project) *ProjectUpdate {
|
|
_u.mutation.Where(ps...)
|
|
return _u
|
|
}
|
|
|
|
// SetDeletedAt sets the "deleted_at" field.
|
|
func (_u *ProjectUpdate) SetDeletedAt(v time.Time) *ProjectUpdate {
|
|
_u.mutation.SetDeletedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
|
|
func (_u *ProjectUpdate) SetNillableDeletedAt(v *time.Time) *ProjectUpdate {
|
|
if v != nil {
|
|
_u.SetDeletedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearDeletedAt clears the value of the "deleted_at" field.
|
|
func (_u *ProjectUpdate) ClearDeletedAt() *ProjectUpdate {
|
|
_u.mutation.ClearDeletedAt()
|
|
return _u
|
|
}
|
|
|
|
// SetUserID sets the "user_id" field.
|
|
func (_u *ProjectUpdate) SetUserID(v uuid.UUID) *ProjectUpdate {
|
|
_u.mutation.SetUserID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableUserID sets the "user_id" field if the given value is not nil.
|
|
func (_u *ProjectUpdate) SetNillableUserID(v *uuid.UUID) *ProjectUpdate {
|
|
if v != nil {
|
|
_u.SetUserID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetName sets the "name" field.
|
|
func (_u *ProjectUpdate) SetName(v string) *ProjectUpdate {
|
|
_u.mutation.SetName(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableName sets the "name" field if the given value is not nil.
|
|
func (_u *ProjectUpdate) SetNillableName(v *string) *ProjectUpdate {
|
|
if v != nil {
|
|
_u.SetName(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetDescription sets the "description" field.
|
|
func (_u *ProjectUpdate) SetDescription(v string) *ProjectUpdate {
|
|
_u.mutation.SetDescription(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableDescription sets the "description" field if the given value is not nil.
|
|
func (_u *ProjectUpdate) SetNillableDescription(v *string) *ProjectUpdate {
|
|
if v != nil {
|
|
_u.SetDescription(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearDescription clears the value of the "description" field.
|
|
func (_u *ProjectUpdate) ClearDescription() *ProjectUpdate {
|
|
_u.mutation.ClearDescription()
|
|
return _u
|
|
}
|
|
|
|
// SetPlatform sets the "platform" field.
|
|
func (_u *ProjectUpdate) SetPlatform(v consts.GitPlatform) *ProjectUpdate {
|
|
_u.mutation.SetPlatform(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillablePlatform sets the "platform" field if the given value is not nil.
|
|
func (_u *ProjectUpdate) SetNillablePlatform(v *consts.GitPlatform) *ProjectUpdate {
|
|
if v != nil {
|
|
_u.SetPlatform(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearPlatform clears the value of the "platform" field.
|
|
func (_u *ProjectUpdate) ClearPlatform() *ProjectUpdate {
|
|
_u.mutation.ClearPlatform()
|
|
return _u
|
|
}
|
|
|
|
// SetRepoURL sets the "repo_url" field.
|
|
func (_u *ProjectUpdate) SetRepoURL(v string) *ProjectUpdate {
|
|
_u.mutation.SetRepoURL(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRepoURL sets the "repo_url" field if the given value is not nil.
|
|
func (_u *ProjectUpdate) SetNillableRepoURL(v *string) *ProjectUpdate {
|
|
if v != nil {
|
|
_u.SetRepoURL(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearRepoURL clears the value of the "repo_url" field.
|
|
func (_u *ProjectUpdate) ClearRepoURL() *ProjectUpdate {
|
|
_u.mutation.ClearRepoURL()
|
|
return _u
|
|
}
|
|
|
|
// SetBranch sets the "branch" field.
|
|
func (_u *ProjectUpdate) SetBranch(v string) *ProjectUpdate {
|
|
_u.mutation.SetBranch(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableBranch sets the "branch" field if the given value is not nil.
|
|
func (_u *ProjectUpdate) SetNillableBranch(v *string) *ProjectUpdate {
|
|
if v != nil {
|
|
_u.SetBranch(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearBranch clears the value of the "branch" field.
|
|
func (_u *ProjectUpdate) ClearBranch() *ProjectUpdate {
|
|
_u.mutation.ClearBranch()
|
|
return _u
|
|
}
|
|
|
|
// SetGitIdentityID sets the "git_identity_id" field.
|
|
func (_u *ProjectUpdate) SetGitIdentityID(v uuid.UUID) *ProjectUpdate {
|
|
_u.mutation.SetGitIdentityID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableGitIdentityID sets the "git_identity_id" field if the given value is not nil.
|
|
func (_u *ProjectUpdate) SetNillableGitIdentityID(v *uuid.UUID) *ProjectUpdate {
|
|
if v != nil {
|
|
_u.SetGitIdentityID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearGitIdentityID clears the value of the "git_identity_id" field.
|
|
func (_u *ProjectUpdate) ClearGitIdentityID() *ProjectUpdate {
|
|
_u.mutation.ClearGitIdentityID()
|
|
return _u
|
|
}
|
|
|
|
// SetImageID sets the "image_id" field.
|
|
func (_u *ProjectUpdate) SetImageID(v uuid.UUID) *ProjectUpdate {
|
|
_u.mutation.SetImageID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableImageID sets the "image_id" field if the given value is not nil.
|
|
func (_u *ProjectUpdate) SetNillableImageID(v *uuid.UUID) *ProjectUpdate {
|
|
if v != nil {
|
|
_u.SetImageID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearImageID clears the value of the "image_id" field.
|
|
func (_u *ProjectUpdate) ClearImageID() *ProjectUpdate {
|
|
_u.mutation.ClearImageID()
|
|
return _u
|
|
}
|
|
|
|
// SetEnvVariables sets the "env_variables" field.
|
|
func (_u *ProjectUpdate) SetEnvVariables(v map[string]interface{}) *ProjectUpdate {
|
|
_u.mutation.SetEnvVariables(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearEnvVariables clears the value of the "env_variables" field.
|
|
func (_u *ProjectUpdate) ClearEnvVariables() *ProjectUpdate {
|
|
_u.mutation.ClearEnvVariables()
|
|
return _u
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (_u *ProjectUpdate) SetCreatedAt(v time.Time) *ProjectUpdate {
|
|
_u.mutation.SetCreatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
|
func (_u *ProjectUpdate) SetNillableCreatedAt(v *time.Time) *ProjectUpdate {
|
|
if v != nil {
|
|
_u.SetCreatedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (_u *ProjectUpdate) SetUpdatedAt(v time.Time) *ProjectUpdate {
|
|
_u.mutation.SetUpdatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetUser sets the "user" edge to the User entity.
|
|
func (_u *ProjectUpdate) SetUser(v *User) *ProjectUpdate {
|
|
return _u.SetUserID(v.ID)
|
|
}
|
|
|
|
// SetGitIdentity sets the "git_identity" edge to the GitIdentity entity.
|
|
func (_u *ProjectUpdate) SetGitIdentity(v *GitIdentity) *ProjectUpdate {
|
|
return _u.SetGitIdentityID(v.ID)
|
|
}
|
|
|
|
// SetImage sets the "image" edge to the Image entity.
|
|
func (_u *ProjectUpdate) SetImage(v *Image) *ProjectUpdate {
|
|
return _u.SetImageID(v.ID)
|
|
}
|
|
|
|
// AddIssueIDs adds the "issues" edge to the ProjectIssue entity by IDs.
|
|
func (_u *ProjectUpdate) AddIssueIDs(ids ...uuid.UUID) *ProjectUpdate {
|
|
_u.mutation.AddIssueIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// AddIssues adds the "issues" edges to the ProjectIssue entity.
|
|
func (_u *ProjectUpdate) AddIssues(v ...*ProjectIssue) *ProjectUpdate {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.AddIssueIDs(ids...)
|
|
}
|
|
|
|
// AddCollaboratorIDs adds the "collaborators" edge to the ProjectCollaborator entity by IDs.
|
|
func (_u *ProjectUpdate) AddCollaboratorIDs(ids ...uuid.UUID) *ProjectUpdate {
|
|
_u.mutation.AddCollaboratorIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// AddCollaborators adds the "collaborators" edges to the ProjectCollaborator entity.
|
|
func (_u *ProjectUpdate) AddCollaborators(v ...*ProjectCollaborator) *ProjectUpdate {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.AddCollaboratorIDs(ids...)
|
|
}
|
|
|
|
// AddProjectTaskIDs adds the "project_tasks" edge to the ProjectTask entity by IDs.
|
|
func (_u *ProjectUpdate) AddProjectTaskIDs(ids ...uuid.UUID) *ProjectUpdate {
|
|
_u.mutation.AddProjectTaskIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// AddProjectTasks adds the "project_tasks" edges to the ProjectTask entity.
|
|
func (_u *ProjectUpdate) AddProjectTasks(v ...*ProjectTask) *ProjectUpdate {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.AddProjectTaskIDs(ids...)
|
|
}
|
|
|
|
// AddGitBotIDs adds the "git_bots" edge to the GitBot entity by IDs.
|
|
func (_u *ProjectUpdate) AddGitBotIDs(ids ...uuid.UUID) *ProjectUpdate {
|
|
_u.mutation.AddGitBotIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// AddGitBots adds the "git_bots" edges to the GitBot entity.
|
|
func (_u *ProjectUpdate) AddGitBots(v ...*GitBot) *ProjectUpdate {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.AddGitBotIDs(ids...)
|
|
}
|
|
|
|
// AddProjectGitBotIDs adds the "project_git_bots" edge to the ProjectGitBot entity by IDs.
|
|
func (_u *ProjectUpdate) AddProjectGitBotIDs(ids ...uuid.UUID) *ProjectUpdate {
|
|
_u.mutation.AddProjectGitBotIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// AddProjectGitBots adds the "project_git_bots" edges to the ProjectGitBot entity.
|
|
func (_u *ProjectUpdate) AddProjectGitBots(v ...*ProjectGitBot) *ProjectUpdate {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.AddProjectGitBotIDs(ids...)
|
|
}
|
|
|
|
// Mutation returns the ProjectMutation object of the builder.
|
|
func (_u *ProjectUpdate) Mutation() *ProjectMutation {
|
|
return _u.mutation
|
|
}
|
|
|
|
// ClearUser clears the "user" edge to the User entity.
|
|
func (_u *ProjectUpdate) ClearUser() *ProjectUpdate {
|
|
_u.mutation.ClearUser()
|
|
return _u
|
|
}
|
|
|
|
// ClearGitIdentity clears the "git_identity" edge to the GitIdentity entity.
|
|
func (_u *ProjectUpdate) ClearGitIdentity() *ProjectUpdate {
|
|
_u.mutation.ClearGitIdentity()
|
|
return _u
|
|
}
|
|
|
|
// ClearImage clears the "image" edge to the Image entity.
|
|
func (_u *ProjectUpdate) ClearImage() *ProjectUpdate {
|
|
_u.mutation.ClearImage()
|
|
return _u
|
|
}
|
|
|
|
// ClearIssues clears all "issues" edges to the ProjectIssue entity.
|
|
func (_u *ProjectUpdate) ClearIssues() *ProjectUpdate {
|
|
_u.mutation.ClearIssues()
|
|
return _u
|
|
}
|
|
|
|
// RemoveIssueIDs removes the "issues" edge to ProjectIssue entities by IDs.
|
|
func (_u *ProjectUpdate) RemoveIssueIDs(ids ...uuid.UUID) *ProjectUpdate {
|
|
_u.mutation.RemoveIssueIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// RemoveIssues removes "issues" edges to ProjectIssue entities.
|
|
func (_u *ProjectUpdate) RemoveIssues(v ...*ProjectIssue) *ProjectUpdate {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.RemoveIssueIDs(ids...)
|
|
}
|
|
|
|
// ClearCollaborators clears all "collaborators" edges to the ProjectCollaborator entity.
|
|
func (_u *ProjectUpdate) ClearCollaborators() *ProjectUpdate {
|
|
_u.mutation.ClearCollaborators()
|
|
return _u
|
|
}
|
|
|
|
// RemoveCollaboratorIDs removes the "collaborators" edge to ProjectCollaborator entities by IDs.
|
|
func (_u *ProjectUpdate) RemoveCollaboratorIDs(ids ...uuid.UUID) *ProjectUpdate {
|
|
_u.mutation.RemoveCollaboratorIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// RemoveCollaborators removes "collaborators" edges to ProjectCollaborator entities.
|
|
func (_u *ProjectUpdate) RemoveCollaborators(v ...*ProjectCollaborator) *ProjectUpdate {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.RemoveCollaboratorIDs(ids...)
|
|
}
|
|
|
|
// ClearProjectTasks clears all "project_tasks" edges to the ProjectTask entity.
|
|
func (_u *ProjectUpdate) ClearProjectTasks() *ProjectUpdate {
|
|
_u.mutation.ClearProjectTasks()
|
|
return _u
|
|
}
|
|
|
|
// RemoveProjectTaskIDs removes the "project_tasks" edge to ProjectTask entities by IDs.
|
|
func (_u *ProjectUpdate) RemoveProjectTaskIDs(ids ...uuid.UUID) *ProjectUpdate {
|
|
_u.mutation.RemoveProjectTaskIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// RemoveProjectTasks removes "project_tasks" edges to ProjectTask entities.
|
|
func (_u *ProjectUpdate) RemoveProjectTasks(v ...*ProjectTask) *ProjectUpdate {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.RemoveProjectTaskIDs(ids...)
|
|
}
|
|
|
|
// ClearGitBots clears all "git_bots" edges to the GitBot entity.
|
|
func (_u *ProjectUpdate) ClearGitBots() *ProjectUpdate {
|
|
_u.mutation.ClearGitBots()
|
|
return _u
|
|
}
|
|
|
|
// RemoveGitBotIDs removes the "git_bots" edge to GitBot entities by IDs.
|
|
func (_u *ProjectUpdate) RemoveGitBotIDs(ids ...uuid.UUID) *ProjectUpdate {
|
|
_u.mutation.RemoveGitBotIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// RemoveGitBots removes "git_bots" edges to GitBot entities.
|
|
func (_u *ProjectUpdate) RemoveGitBots(v ...*GitBot) *ProjectUpdate {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.RemoveGitBotIDs(ids...)
|
|
}
|
|
|
|
// ClearProjectGitBots clears all "project_git_bots" edges to the ProjectGitBot entity.
|
|
func (_u *ProjectUpdate) ClearProjectGitBots() *ProjectUpdate {
|
|
_u.mutation.ClearProjectGitBots()
|
|
return _u
|
|
}
|
|
|
|
// RemoveProjectGitBotIDs removes the "project_git_bots" edge to ProjectGitBot entities by IDs.
|
|
func (_u *ProjectUpdate) RemoveProjectGitBotIDs(ids ...uuid.UUID) *ProjectUpdate {
|
|
_u.mutation.RemoveProjectGitBotIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// RemoveProjectGitBots removes "project_git_bots" edges to ProjectGitBot entities.
|
|
func (_u *ProjectUpdate) RemoveProjectGitBots(v ...*ProjectGitBot) *ProjectUpdate {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.RemoveProjectGitBotIDs(ids...)
|
|
}
|
|
|
|
// Save executes the query and returns the number of nodes affected by the update operation.
|
|
func (_u *ProjectUpdate) Save(ctx context.Context) (int, error) {
|
|
if err := _u.defaults(); err != nil {
|
|
return 0, err
|
|
}
|
|
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (_u *ProjectUpdate) SaveX(ctx context.Context) int {
|
|
affected, err := _u.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return affected
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_u *ProjectUpdate) Exec(ctx context.Context) error {
|
|
_, err := _u.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_u *ProjectUpdate) ExecX(ctx context.Context) {
|
|
if err := _u.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// defaults sets the default values of the builder before save.
|
|
func (_u *ProjectUpdate) defaults() error {
|
|
if _, ok := _u.mutation.UpdatedAt(); !ok {
|
|
if project.UpdateDefaultUpdatedAt == nil {
|
|
return fmt.Errorf("db: uninitialized project.UpdateDefaultUpdatedAt (forgotten import db/runtime?)")
|
|
}
|
|
v := project.UpdateDefaultUpdatedAt()
|
|
_u.mutation.SetUpdatedAt(v)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
func (_u *ProjectUpdate) check() error {
|
|
if v, ok := _u.mutation.Name(); ok {
|
|
if err := project.NameValidator(v); err != nil {
|
|
return &ValidationError{Name: "name", err: fmt.Errorf(`db: validator failed for field "Project.name": %w`, err)}
|
|
}
|
|
}
|
|
if _u.mutation.UserCleared() && len(_u.mutation.UserIDs()) > 0 {
|
|
return errors.New(`db: clearing a required unique edge "Project.user"`)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
|
|
func (_u *ProjectUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *ProjectUpdate {
|
|
_u.modifiers = append(_u.modifiers, modifiers...)
|
|
return _u
|
|
}
|
|
|
|
func (_u *ProjectUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
|
if err := _u.check(); err != nil {
|
|
return _node, err
|
|
}
|
|
_spec := sqlgraph.NewUpdateSpec(project.Table, project.Columns, sqlgraph.NewFieldSpec(project.FieldID, field.TypeUUID))
|
|
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(project.FieldDeletedAt, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.DeletedAtCleared() {
|
|
_spec.ClearField(project.FieldDeletedAt, field.TypeTime)
|
|
}
|
|
if value, ok := _u.mutation.Name(); ok {
|
|
_spec.SetField(project.FieldName, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.Description(); ok {
|
|
_spec.SetField(project.FieldDescription, field.TypeString, value)
|
|
}
|
|
if _u.mutation.DescriptionCleared() {
|
|
_spec.ClearField(project.FieldDescription, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Platform(); ok {
|
|
_spec.SetField(project.FieldPlatform, field.TypeString, value)
|
|
}
|
|
if _u.mutation.PlatformCleared() {
|
|
_spec.ClearField(project.FieldPlatform, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.RepoURL(); ok {
|
|
_spec.SetField(project.FieldRepoURL, field.TypeString, value)
|
|
}
|
|
if _u.mutation.RepoURLCleared() {
|
|
_spec.ClearField(project.FieldRepoURL, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Branch(); ok {
|
|
_spec.SetField(project.FieldBranch, field.TypeString, value)
|
|
}
|
|
if _u.mutation.BranchCleared() {
|
|
_spec.ClearField(project.FieldBranch, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.EnvVariables(); ok {
|
|
_spec.SetField(project.FieldEnvVariables, field.TypeJSON, value)
|
|
}
|
|
if _u.mutation.EnvVariablesCleared() {
|
|
_spec.ClearField(project.FieldEnvVariables, field.TypeJSON)
|
|
}
|
|
if value, ok := _u.mutation.CreatedAt(); ok {
|
|
_spec.SetField(project.FieldCreatedAt, field.TypeTime, value)
|
|
}
|
|
if value, ok := _u.mutation.UpdatedAt(); ok {
|
|
_spec.SetField(project.FieldUpdatedAt, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.UserCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: project.UserTable,
|
|
Columns: []string{project.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: project.UserTable,
|
|
Columns: []string{project.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: project.GitIdentityTable,
|
|
Columns: []string{project.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: project.GitIdentityTable,
|
|
Columns: []string{project.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.ImageCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: project.ImageTable,
|
|
Columns: []string{project.ImageColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(image.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.ImageIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: project.ImageTable,
|
|
Columns: []string{project.ImageColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(image.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.IssuesCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: false,
|
|
Table: project.IssuesTable,
|
|
Columns: []string{project.IssuesColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projectissue.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.RemovedIssuesIDs(); len(nodes) > 0 && !_u.mutation.IssuesCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: false,
|
|
Table: project.IssuesTable,
|
|
Columns: []string{project.IssuesColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projectissue.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.IssuesIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: false,
|
|
Table: project.IssuesTable,
|
|
Columns: []string{project.IssuesColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projectissue.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.CollaboratorsCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: false,
|
|
Table: project.CollaboratorsTable,
|
|
Columns: []string{project.CollaboratorsColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projectcollaborator.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.RemovedCollaboratorsIDs(); len(nodes) > 0 && !_u.mutation.CollaboratorsCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: false,
|
|
Table: project.CollaboratorsTable,
|
|
Columns: []string{project.CollaboratorsColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projectcollaborator.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.CollaboratorsIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: false,
|
|
Table: project.CollaboratorsTable,
|
|
Columns: []string{project.CollaboratorsColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projectcollaborator.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.ProjectTasksCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: false,
|
|
Table: project.ProjectTasksTable,
|
|
Columns: []string{project.ProjectTasksColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projecttask.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.RemovedProjectTasksIDs(); len(nodes) > 0 && !_u.mutation.ProjectTasksCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: false,
|
|
Table: project.ProjectTasksTable,
|
|
Columns: []string{project.ProjectTasksColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projecttask.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.ProjectTasksIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: false,
|
|
Table: project.ProjectTasksTable,
|
|
Columns: []string{project.ProjectTasksColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projecttask.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.GitBotsCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2M,
|
|
Inverse: false,
|
|
Table: project.GitBotsTable,
|
|
Columns: project.GitBotsPrimaryKey,
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(gitbot.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
createE := &ProjectGitBotCreate{config: _u.config, mutation: newProjectGitBotMutation(_u.config, OpCreate)}
|
|
createE.defaults()
|
|
_, specE := createE.createSpec()
|
|
edge.Target.Fields = specE.Fields
|
|
if specE.ID.Value != nil {
|
|
edge.Target.Fields = append(edge.Target.Fields, specE.ID)
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.RemovedGitBotsIDs(); len(nodes) > 0 && !_u.mutation.GitBotsCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2M,
|
|
Inverse: false,
|
|
Table: project.GitBotsTable,
|
|
Columns: project.GitBotsPrimaryKey,
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(gitbot.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
createE := &ProjectGitBotCreate{config: _u.config, mutation: newProjectGitBotMutation(_u.config, OpCreate)}
|
|
createE.defaults()
|
|
_, specE := createE.createSpec()
|
|
edge.Target.Fields = specE.Fields
|
|
if specE.ID.Value != nil {
|
|
edge.Target.Fields = append(edge.Target.Fields, specE.ID)
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.GitBotsIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2M,
|
|
Inverse: false,
|
|
Table: project.GitBotsTable,
|
|
Columns: project.GitBotsPrimaryKey,
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(gitbot.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
createE := &ProjectGitBotCreate{config: _u.config, mutation: newProjectGitBotMutation(_u.config, OpCreate)}
|
|
createE.defaults()
|
|
_, specE := createE.createSpec()
|
|
edge.Target.Fields = specE.Fields
|
|
if specE.ID.Value != nil {
|
|
edge.Target.Fields = append(edge.Target.Fields, specE.ID)
|
|
}
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
}
|
|
if _u.mutation.ProjectGitBotsCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: true,
|
|
Table: project.ProjectGitBotsTable,
|
|
Columns: []string{project.ProjectGitBotsColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projectgitbot.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.RemovedProjectGitBotsIDs(); len(nodes) > 0 && !_u.mutation.ProjectGitBotsCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: true,
|
|
Table: project.ProjectGitBotsTable,
|
|
Columns: []string{project.ProjectGitBotsColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projectgitbot.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.ProjectGitBotsIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: true,
|
|
Table: project.ProjectGitBotsTable,
|
|
Columns: []string{project.ProjectGitBotsColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projectgitbot.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{project.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return 0, err
|
|
}
|
|
_u.mutation.done = true
|
|
return _node, nil
|
|
}
|
|
|
|
// ProjectUpdateOne is the builder for updating a single Project entity.
|
|
type ProjectUpdateOne struct {
|
|
config
|
|
fields []string
|
|
hooks []Hook
|
|
mutation *ProjectMutation
|
|
modifiers []func(*sql.UpdateBuilder)
|
|
}
|
|
|
|
// SetDeletedAt sets the "deleted_at" field.
|
|
func (_u *ProjectUpdateOne) SetDeletedAt(v time.Time) *ProjectUpdateOne {
|
|
_u.mutation.SetDeletedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
|
|
func (_u *ProjectUpdateOne) SetNillableDeletedAt(v *time.Time) *ProjectUpdateOne {
|
|
if v != nil {
|
|
_u.SetDeletedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearDeletedAt clears the value of the "deleted_at" field.
|
|
func (_u *ProjectUpdateOne) ClearDeletedAt() *ProjectUpdateOne {
|
|
_u.mutation.ClearDeletedAt()
|
|
return _u
|
|
}
|
|
|
|
// SetUserID sets the "user_id" field.
|
|
func (_u *ProjectUpdateOne) SetUserID(v uuid.UUID) *ProjectUpdateOne {
|
|
_u.mutation.SetUserID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableUserID sets the "user_id" field if the given value is not nil.
|
|
func (_u *ProjectUpdateOne) SetNillableUserID(v *uuid.UUID) *ProjectUpdateOne {
|
|
if v != nil {
|
|
_u.SetUserID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetName sets the "name" field.
|
|
func (_u *ProjectUpdateOne) SetName(v string) *ProjectUpdateOne {
|
|
_u.mutation.SetName(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableName sets the "name" field if the given value is not nil.
|
|
func (_u *ProjectUpdateOne) SetNillableName(v *string) *ProjectUpdateOne {
|
|
if v != nil {
|
|
_u.SetName(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetDescription sets the "description" field.
|
|
func (_u *ProjectUpdateOne) SetDescription(v string) *ProjectUpdateOne {
|
|
_u.mutation.SetDescription(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableDescription sets the "description" field if the given value is not nil.
|
|
func (_u *ProjectUpdateOne) SetNillableDescription(v *string) *ProjectUpdateOne {
|
|
if v != nil {
|
|
_u.SetDescription(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearDescription clears the value of the "description" field.
|
|
func (_u *ProjectUpdateOne) ClearDescription() *ProjectUpdateOne {
|
|
_u.mutation.ClearDescription()
|
|
return _u
|
|
}
|
|
|
|
// SetPlatform sets the "platform" field.
|
|
func (_u *ProjectUpdateOne) SetPlatform(v consts.GitPlatform) *ProjectUpdateOne {
|
|
_u.mutation.SetPlatform(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillablePlatform sets the "platform" field if the given value is not nil.
|
|
func (_u *ProjectUpdateOne) SetNillablePlatform(v *consts.GitPlatform) *ProjectUpdateOne {
|
|
if v != nil {
|
|
_u.SetPlatform(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearPlatform clears the value of the "platform" field.
|
|
func (_u *ProjectUpdateOne) ClearPlatform() *ProjectUpdateOne {
|
|
_u.mutation.ClearPlatform()
|
|
return _u
|
|
}
|
|
|
|
// SetRepoURL sets the "repo_url" field.
|
|
func (_u *ProjectUpdateOne) SetRepoURL(v string) *ProjectUpdateOne {
|
|
_u.mutation.SetRepoURL(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRepoURL sets the "repo_url" field if the given value is not nil.
|
|
func (_u *ProjectUpdateOne) SetNillableRepoURL(v *string) *ProjectUpdateOne {
|
|
if v != nil {
|
|
_u.SetRepoURL(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearRepoURL clears the value of the "repo_url" field.
|
|
func (_u *ProjectUpdateOne) ClearRepoURL() *ProjectUpdateOne {
|
|
_u.mutation.ClearRepoURL()
|
|
return _u
|
|
}
|
|
|
|
// SetBranch sets the "branch" field.
|
|
func (_u *ProjectUpdateOne) SetBranch(v string) *ProjectUpdateOne {
|
|
_u.mutation.SetBranch(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableBranch sets the "branch" field if the given value is not nil.
|
|
func (_u *ProjectUpdateOne) SetNillableBranch(v *string) *ProjectUpdateOne {
|
|
if v != nil {
|
|
_u.SetBranch(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearBranch clears the value of the "branch" field.
|
|
func (_u *ProjectUpdateOne) ClearBranch() *ProjectUpdateOne {
|
|
_u.mutation.ClearBranch()
|
|
return _u
|
|
}
|
|
|
|
// SetGitIdentityID sets the "git_identity_id" field.
|
|
func (_u *ProjectUpdateOne) SetGitIdentityID(v uuid.UUID) *ProjectUpdateOne {
|
|
_u.mutation.SetGitIdentityID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableGitIdentityID sets the "git_identity_id" field if the given value is not nil.
|
|
func (_u *ProjectUpdateOne) SetNillableGitIdentityID(v *uuid.UUID) *ProjectUpdateOne {
|
|
if v != nil {
|
|
_u.SetGitIdentityID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearGitIdentityID clears the value of the "git_identity_id" field.
|
|
func (_u *ProjectUpdateOne) ClearGitIdentityID() *ProjectUpdateOne {
|
|
_u.mutation.ClearGitIdentityID()
|
|
return _u
|
|
}
|
|
|
|
// SetImageID sets the "image_id" field.
|
|
func (_u *ProjectUpdateOne) SetImageID(v uuid.UUID) *ProjectUpdateOne {
|
|
_u.mutation.SetImageID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableImageID sets the "image_id" field if the given value is not nil.
|
|
func (_u *ProjectUpdateOne) SetNillableImageID(v *uuid.UUID) *ProjectUpdateOne {
|
|
if v != nil {
|
|
_u.SetImageID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearImageID clears the value of the "image_id" field.
|
|
func (_u *ProjectUpdateOne) ClearImageID() *ProjectUpdateOne {
|
|
_u.mutation.ClearImageID()
|
|
return _u
|
|
}
|
|
|
|
// SetEnvVariables sets the "env_variables" field.
|
|
func (_u *ProjectUpdateOne) SetEnvVariables(v map[string]interface{}) *ProjectUpdateOne {
|
|
_u.mutation.SetEnvVariables(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearEnvVariables clears the value of the "env_variables" field.
|
|
func (_u *ProjectUpdateOne) ClearEnvVariables() *ProjectUpdateOne {
|
|
_u.mutation.ClearEnvVariables()
|
|
return _u
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (_u *ProjectUpdateOne) SetCreatedAt(v time.Time) *ProjectUpdateOne {
|
|
_u.mutation.SetCreatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
|
func (_u *ProjectUpdateOne) SetNillableCreatedAt(v *time.Time) *ProjectUpdateOne {
|
|
if v != nil {
|
|
_u.SetCreatedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (_u *ProjectUpdateOne) SetUpdatedAt(v time.Time) *ProjectUpdateOne {
|
|
_u.mutation.SetUpdatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetUser sets the "user" edge to the User entity.
|
|
func (_u *ProjectUpdateOne) SetUser(v *User) *ProjectUpdateOne {
|
|
return _u.SetUserID(v.ID)
|
|
}
|
|
|
|
// SetGitIdentity sets the "git_identity" edge to the GitIdentity entity.
|
|
func (_u *ProjectUpdateOne) SetGitIdentity(v *GitIdentity) *ProjectUpdateOne {
|
|
return _u.SetGitIdentityID(v.ID)
|
|
}
|
|
|
|
// SetImage sets the "image" edge to the Image entity.
|
|
func (_u *ProjectUpdateOne) SetImage(v *Image) *ProjectUpdateOne {
|
|
return _u.SetImageID(v.ID)
|
|
}
|
|
|
|
// AddIssueIDs adds the "issues" edge to the ProjectIssue entity by IDs.
|
|
func (_u *ProjectUpdateOne) AddIssueIDs(ids ...uuid.UUID) *ProjectUpdateOne {
|
|
_u.mutation.AddIssueIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// AddIssues adds the "issues" edges to the ProjectIssue entity.
|
|
func (_u *ProjectUpdateOne) AddIssues(v ...*ProjectIssue) *ProjectUpdateOne {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.AddIssueIDs(ids...)
|
|
}
|
|
|
|
// AddCollaboratorIDs adds the "collaborators" edge to the ProjectCollaborator entity by IDs.
|
|
func (_u *ProjectUpdateOne) AddCollaboratorIDs(ids ...uuid.UUID) *ProjectUpdateOne {
|
|
_u.mutation.AddCollaboratorIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// AddCollaborators adds the "collaborators" edges to the ProjectCollaborator entity.
|
|
func (_u *ProjectUpdateOne) AddCollaborators(v ...*ProjectCollaborator) *ProjectUpdateOne {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.AddCollaboratorIDs(ids...)
|
|
}
|
|
|
|
// AddProjectTaskIDs adds the "project_tasks" edge to the ProjectTask entity by IDs.
|
|
func (_u *ProjectUpdateOne) AddProjectTaskIDs(ids ...uuid.UUID) *ProjectUpdateOne {
|
|
_u.mutation.AddProjectTaskIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// AddProjectTasks adds the "project_tasks" edges to the ProjectTask entity.
|
|
func (_u *ProjectUpdateOne) AddProjectTasks(v ...*ProjectTask) *ProjectUpdateOne {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.AddProjectTaskIDs(ids...)
|
|
}
|
|
|
|
// AddGitBotIDs adds the "git_bots" edge to the GitBot entity by IDs.
|
|
func (_u *ProjectUpdateOne) AddGitBotIDs(ids ...uuid.UUID) *ProjectUpdateOne {
|
|
_u.mutation.AddGitBotIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// AddGitBots adds the "git_bots" edges to the GitBot entity.
|
|
func (_u *ProjectUpdateOne) AddGitBots(v ...*GitBot) *ProjectUpdateOne {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.AddGitBotIDs(ids...)
|
|
}
|
|
|
|
// AddProjectGitBotIDs adds the "project_git_bots" edge to the ProjectGitBot entity by IDs.
|
|
func (_u *ProjectUpdateOne) AddProjectGitBotIDs(ids ...uuid.UUID) *ProjectUpdateOne {
|
|
_u.mutation.AddProjectGitBotIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// AddProjectGitBots adds the "project_git_bots" edges to the ProjectGitBot entity.
|
|
func (_u *ProjectUpdateOne) AddProjectGitBots(v ...*ProjectGitBot) *ProjectUpdateOne {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.AddProjectGitBotIDs(ids...)
|
|
}
|
|
|
|
// Mutation returns the ProjectMutation object of the builder.
|
|
func (_u *ProjectUpdateOne) Mutation() *ProjectMutation {
|
|
return _u.mutation
|
|
}
|
|
|
|
// ClearUser clears the "user" edge to the User entity.
|
|
func (_u *ProjectUpdateOne) ClearUser() *ProjectUpdateOne {
|
|
_u.mutation.ClearUser()
|
|
return _u
|
|
}
|
|
|
|
// ClearGitIdentity clears the "git_identity" edge to the GitIdentity entity.
|
|
func (_u *ProjectUpdateOne) ClearGitIdentity() *ProjectUpdateOne {
|
|
_u.mutation.ClearGitIdentity()
|
|
return _u
|
|
}
|
|
|
|
// ClearImage clears the "image" edge to the Image entity.
|
|
func (_u *ProjectUpdateOne) ClearImage() *ProjectUpdateOne {
|
|
_u.mutation.ClearImage()
|
|
return _u
|
|
}
|
|
|
|
// ClearIssues clears all "issues" edges to the ProjectIssue entity.
|
|
func (_u *ProjectUpdateOne) ClearIssues() *ProjectUpdateOne {
|
|
_u.mutation.ClearIssues()
|
|
return _u
|
|
}
|
|
|
|
// RemoveIssueIDs removes the "issues" edge to ProjectIssue entities by IDs.
|
|
func (_u *ProjectUpdateOne) RemoveIssueIDs(ids ...uuid.UUID) *ProjectUpdateOne {
|
|
_u.mutation.RemoveIssueIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// RemoveIssues removes "issues" edges to ProjectIssue entities.
|
|
func (_u *ProjectUpdateOne) RemoveIssues(v ...*ProjectIssue) *ProjectUpdateOne {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.RemoveIssueIDs(ids...)
|
|
}
|
|
|
|
// ClearCollaborators clears all "collaborators" edges to the ProjectCollaborator entity.
|
|
func (_u *ProjectUpdateOne) ClearCollaborators() *ProjectUpdateOne {
|
|
_u.mutation.ClearCollaborators()
|
|
return _u
|
|
}
|
|
|
|
// RemoveCollaboratorIDs removes the "collaborators" edge to ProjectCollaborator entities by IDs.
|
|
func (_u *ProjectUpdateOne) RemoveCollaboratorIDs(ids ...uuid.UUID) *ProjectUpdateOne {
|
|
_u.mutation.RemoveCollaboratorIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// RemoveCollaborators removes "collaborators" edges to ProjectCollaborator entities.
|
|
func (_u *ProjectUpdateOne) RemoveCollaborators(v ...*ProjectCollaborator) *ProjectUpdateOne {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.RemoveCollaboratorIDs(ids...)
|
|
}
|
|
|
|
// ClearProjectTasks clears all "project_tasks" edges to the ProjectTask entity.
|
|
func (_u *ProjectUpdateOne) ClearProjectTasks() *ProjectUpdateOne {
|
|
_u.mutation.ClearProjectTasks()
|
|
return _u
|
|
}
|
|
|
|
// RemoveProjectTaskIDs removes the "project_tasks" edge to ProjectTask entities by IDs.
|
|
func (_u *ProjectUpdateOne) RemoveProjectTaskIDs(ids ...uuid.UUID) *ProjectUpdateOne {
|
|
_u.mutation.RemoveProjectTaskIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// RemoveProjectTasks removes "project_tasks" edges to ProjectTask entities.
|
|
func (_u *ProjectUpdateOne) RemoveProjectTasks(v ...*ProjectTask) *ProjectUpdateOne {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.RemoveProjectTaskIDs(ids...)
|
|
}
|
|
|
|
// ClearGitBots clears all "git_bots" edges to the GitBot entity.
|
|
func (_u *ProjectUpdateOne) ClearGitBots() *ProjectUpdateOne {
|
|
_u.mutation.ClearGitBots()
|
|
return _u
|
|
}
|
|
|
|
// RemoveGitBotIDs removes the "git_bots" edge to GitBot entities by IDs.
|
|
func (_u *ProjectUpdateOne) RemoveGitBotIDs(ids ...uuid.UUID) *ProjectUpdateOne {
|
|
_u.mutation.RemoveGitBotIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// RemoveGitBots removes "git_bots" edges to GitBot entities.
|
|
func (_u *ProjectUpdateOne) RemoveGitBots(v ...*GitBot) *ProjectUpdateOne {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.RemoveGitBotIDs(ids...)
|
|
}
|
|
|
|
// ClearProjectGitBots clears all "project_git_bots" edges to the ProjectGitBot entity.
|
|
func (_u *ProjectUpdateOne) ClearProjectGitBots() *ProjectUpdateOne {
|
|
_u.mutation.ClearProjectGitBots()
|
|
return _u
|
|
}
|
|
|
|
// RemoveProjectGitBotIDs removes the "project_git_bots" edge to ProjectGitBot entities by IDs.
|
|
func (_u *ProjectUpdateOne) RemoveProjectGitBotIDs(ids ...uuid.UUID) *ProjectUpdateOne {
|
|
_u.mutation.RemoveProjectGitBotIDs(ids...)
|
|
return _u
|
|
}
|
|
|
|
// RemoveProjectGitBots removes "project_git_bots" edges to ProjectGitBot entities.
|
|
func (_u *ProjectUpdateOne) RemoveProjectGitBots(v ...*ProjectGitBot) *ProjectUpdateOne {
|
|
ids := make([]uuid.UUID, len(v))
|
|
for i := range v {
|
|
ids[i] = v[i].ID
|
|
}
|
|
return _u.RemoveProjectGitBotIDs(ids...)
|
|
}
|
|
|
|
// Where appends a list predicates to the ProjectUpdate builder.
|
|
func (_u *ProjectUpdateOne) Where(ps ...predicate.Project) *ProjectUpdateOne {
|
|
_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 *ProjectUpdateOne) Select(field string, fields ...string) *ProjectUpdateOne {
|
|
_u.fields = append([]string{field}, fields...)
|
|
return _u
|
|
}
|
|
|
|
// Save executes the query and returns the updated Project entity.
|
|
func (_u *ProjectUpdateOne) Save(ctx context.Context) (*Project, error) {
|
|
if err := _u.defaults(); err != nil {
|
|
return nil, err
|
|
}
|
|
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (_u *ProjectUpdateOne) SaveX(ctx context.Context) *Project {
|
|
node, err := _u.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return node
|
|
}
|
|
|
|
// Exec executes the query on the entity.
|
|
func (_u *ProjectUpdateOne) Exec(ctx context.Context) error {
|
|
_, err := _u.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_u *ProjectUpdateOne) ExecX(ctx context.Context) {
|
|
if err := _u.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// defaults sets the default values of the builder before save.
|
|
func (_u *ProjectUpdateOne) defaults() error {
|
|
if _, ok := _u.mutation.UpdatedAt(); !ok {
|
|
if project.UpdateDefaultUpdatedAt == nil {
|
|
return fmt.Errorf("db: uninitialized project.UpdateDefaultUpdatedAt (forgotten import db/runtime?)")
|
|
}
|
|
v := project.UpdateDefaultUpdatedAt()
|
|
_u.mutation.SetUpdatedAt(v)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
func (_u *ProjectUpdateOne) check() error {
|
|
if v, ok := _u.mutation.Name(); ok {
|
|
if err := project.NameValidator(v); err != nil {
|
|
return &ValidationError{Name: "name", err: fmt.Errorf(`db: validator failed for field "Project.name": %w`, err)}
|
|
}
|
|
}
|
|
if _u.mutation.UserCleared() && len(_u.mutation.UserIDs()) > 0 {
|
|
return errors.New(`db: clearing a required unique edge "Project.user"`)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
|
|
func (_u *ProjectUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *ProjectUpdateOne {
|
|
_u.modifiers = append(_u.modifiers, modifiers...)
|
|
return _u
|
|
}
|
|
|
|
func (_u *ProjectUpdateOne) sqlSave(ctx context.Context) (_node *Project, err error) {
|
|
if err := _u.check(); err != nil {
|
|
return _node, err
|
|
}
|
|
_spec := sqlgraph.NewUpdateSpec(project.Table, project.Columns, sqlgraph.NewFieldSpec(project.FieldID, field.TypeUUID))
|
|
id, ok := _u.mutation.ID()
|
|
if !ok {
|
|
return nil, &ValidationError{Name: "id", err: errors.New(`db: missing "Project.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, project.FieldID)
|
|
for _, f := range fields {
|
|
if !project.ValidColumn(f) {
|
|
return nil, &ValidationError{Name: f, err: fmt.Errorf("db: invalid field %q for query", f)}
|
|
}
|
|
if f != project.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(project.FieldDeletedAt, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.DeletedAtCleared() {
|
|
_spec.ClearField(project.FieldDeletedAt, field.TypeTime)
|
|
}
|
|
if value, ok := _u.mutation.Name(); ok {
|
|
_spec.SetField(project.FieldName, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.Description(); ok {
|
|
_spec.SetField(project.FieldDescription, field.TypeString, value)
|
|
}
|
|
if _u.mutation.DescriptionCleared() {
|
|
_spec.ClearField(project.FieldDescription, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Platform(); ok {
|
|
_spec.SetField(project.FieldPlatform, field.TypeString, value)
|
|
}
|
|
if _u.mutation.PlatformCleared() {
|
|
_spec.ClearField(project.FieldPlatform, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.RepoURL(); ok {
|
|
_spec.SetField(project.FieldRepoURL, field.TypeString, value)
|
|
}
|
|
if _u.mutation.RepoURLCleared() {
|
|
_spec.ClearField(project.FieldRepoURL, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Branch(); ok {
|
|
_spec.SetField(project.FieldBranch, field.TypeString, value)
|
|
}
|
|
if _u.mutation.BranchCleared() {
|
|
_spec.ClearField(project.FieldBranch, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.EnvVariables(); ok {
|
|
_spec.SetField(project.FieldEnvVariables, field.TypeJSON, value)
|
|
}
|
|
if _u.mutation.EnvVariablesCleared() {
|
|
_spec.ClearField(project.FieldEnvVariables, field.TypeJSON)
|
|
}
|
|
if value, ok := _u.mutation.CreatedAt(); ok {
|
|
_spec.SetField(project.FieldCreatedAt, field.TypeTime, value)
|
|
}
|
|
if value, ok := _u.mutation.UpdatedAt(); ok {
|
|
_spec.SetField(project.FieldUpdatedAt, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.UserCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: project.UserTable,
|
|
Columns: []string{project.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: project.UserTable,
|
|
Columns: []string{project.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: project.GitIdentityTable,
|
|
Columns: []string{project.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: project.GitIdentityTable,
|
|
Columns: []string{project.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.ImageCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: project.ImageTable,
|
|
Columns: []string{project.ImageColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(image.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.ImageIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: project.ImageTable,
|
|
Columns: []string{project.ImageColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(image.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.IssuesCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: false,
|
|
Table: project.IssuesTable,
|
|
Columns: []string{project.IssuesColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projectissue.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.RemovedIssuesIDs(); len(nodes) > 0 && !_u.mutation.IssuesCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: false,
|
|
Table: project.IssuesTable,
|
|
Columns: []string{project.IssuesColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projectissue.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.IssuesIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: false,
|
|
Table: project.IssuesTable,
|
|
Columns: []string{project.IssuesColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projectissue.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.CollaboratorsCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: false,
|
|
Table: project.CollaboratorsTable,
|
|
Columns: []string{project.CollaboratorsColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projectcollaborator.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.RemovedCollaboratorsIDs(); len(nodes) > 0 && !_u.mutation.CollaboratorsCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: false,
|
|
Table: project.CollaboratorsTable,
|
|
Columns: []string{project.CollaboratorsColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projectcollaborator.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.CollaboratorsIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: false,
|
|
Table: project.CollaboratorsTable,
|
|
Columns: []string{project.CollaboratorsColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projectcollaborator.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.ProjectTasksCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: false,
|
|
Table: project.ProjectTasksTable,
|
|
Columns: []string{project.ProjectTasksColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projecttask.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.RemovedProjectTasksIDs(); len(nodes) > 0 && !_u.mutation.ProjectTasksCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: false,
|
|
Table: project.ProjectTasksTable,
|
|
Columns: []string{project.ProjectTasksColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projecttask.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.ProjectTasksIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: false,
|
|
Table: project.ProjectTasksTable,
|
|
Columns: []string{project.ProjectTasksColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projecttask.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.GitBotsCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2M,
|
|
Inverse: false,
|
|
Table: project.GitBotsTable,
|
|
Columns: project.GitBotsPrimaryKey,
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(gitbot.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
createE := &ProjectGitBotCreate{config: _u.config, mutation: newProjectGitBotMutation(_u.config, OpCreate)}
|
|
createE.defaults()
|
|
_, specE := createE.createSpec()
|
|
edge.Target.Fields = specE.Fields
|
|
if specE.ID.Value != nil {
|
|
edge.Target.Fields = append(edge.Target.Fields, specE.ID)
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.RemovedGitBotsIDs(); len(nodes) > 0 && !_u.mutation.GitBotsCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2M,
|
|
Inverse: false,
|
|
Table: project.GitBotsTable,
|
|
Columns: project.GitBotsPrimaryKey,
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(gitbot.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
createE := &ProjectGitBotCreate{config: _u.config, mutation: newProjectGitBotMutation(_u.config, OpCreate)}
|
|
createE.defaults()
|
|
_, specE := createE.createSpec()
|
|
edge.Target.Fields = specE.Fields
|
|
if specE.ID.Value != nil {
|
|
edge.Target.Fields = append(edge.Target.Fields, specE.ID)
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.GitBotsIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2M,
|
|
Inverse: false,
|
|
Table: project.GitBotsTable,
|
|
Columns: project.GitBotsPrimaryKey,
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(gitbot.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
createE := &ProjectGitBotCreate{config: _u.config, mutation: newProjectGitBotMutation(_u.config, OpCreate)}
|
|
createE.defaults()
|
|
_, specE := createE.createSpec()
|
|
edge.Target.Fields = specE.Fields
|
|
if specE.ID.Value != nil {
|
|
edge.Target.Fields = append(edge.Target.Fields, specE.ID)
|
|
}
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
}
|
|
if _u.mutation.ProjectGitBotsCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: true,
|
|
Table: project.ProjectGitBotsTable,
|
|
Columns: []string{project.ProjectGitBotsColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projectgitbot.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.RemovedProjectGitBotsIDs(); len(nodes) > 0 && !_u.mutation.ProjectGitBotsCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: true,
|
|
Table: project.ProjectGitBotsTable,
|
|
Columns: []string{project.ProjectGitBotsColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projectgitbot.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.ProjectGitBotsIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: true,
|
|
Table: project.ProjectGitBotsTable,
|
|
Columns: []string{project.ProjectGitBotsColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projectgitbot.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 = &Project{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{project.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return nil, err
|
|
}
|
|
_u.mutation.done = true
|
|
return _node, nil
|
|
}
|