mirror of
https://github.com/chaitin/MonkeyCode.git
synced 2026-11-22 11:28:46 +08:00
1143 lines
34 KiB
Go
1143 lines
34 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/gitidentity"
|
|
"github.com/chaitin/MonkeyCode/backend/db/image"
|
|
"github.com/chaitin/MonkeyCode/backend/db/model"
|
|
"github.com/chaitin/MonkeyCode/backend/db/predicate"
|
|
"github.com/chaitin/MonkeyCode/backend/db/project"
|
|
"github.com/chaitin/MonkeyCode/backend/db/projectissue"
|
|
"github.com/chaitin/MonkeyCode/backend/db/projecttask"
|
|
"github.com/chaitin/MonkeyCode/backend/db/task"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// ProjectTaskUpdate is the builder for updating ProjectTask entities.
|
|
type ProjectTaskUpdate struct {
|
|
config
|
|
hooks []Hook
|
|
mutation *ProjectTaskMutation
|
|
modifiers []func(*sql.UpdateBuilder)
|
|
}
|
|
|
|
// Where appends a list predicates to the ProjectTaskUpdate builder.
|
|
func (_u *ProjectTaskUpdate) Where(ps ...predicate.ProjectTask) *ProjectTaskUpdate {
|
|
_u.mutation.Where(ps...)
|
|
return _u
|
|
}
|
|
|
|
// SetTaskID sets the "task_id" field.
|
|
func (_u *ProjectTaskUpdate) SetTaskID(v uuid.UUID) *ProjectTaskUpdate {
|
|
_u.mutation.SetTaskID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableTaskID sets the "task_id" field if the given value is not nil.
|
|
func (_u *ProjectTaskUpdate) SetNillableTaskID(v *uuid.UUID) *ProjectTaskUpdate {
|
|
if v != nil {
|
|
_u.SetTaskID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetModelID sets the "model_id" field.
|
|
func (_u *ProjectTaskUpdate) SetModelID(v uuid.UUID) *ProjectTaskUpdate {
|
|
_u.mutation.SetModelID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableModelID sets the "model_id" field if the given value is not nil.
|
|
func (_u *ProjectTaskUpdate) SetNillableModelID(v *uuid.UUID) *ProjectTaskUpdate {
|
|
if v != nil {
|
|
_u.SetModelID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetImageID sets the "image_id" field.
|
|
func (_u *ProjectTaskUpdate) SetImageID(v uuid.UUID) *ProjectTaskUpdate {
|
|
_u.mutation.SetImageID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableImageID sets the "image_id" field if the given value is not nil.
|
|
func (_u *ProjectTaskUpdate) SetNillableImageID(v *uuid.UUID) *ProjectTaskUpdate {
|
|
if v != nil {
|
|
_u.SetImageID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetGitIdentityID sets the "git_identity_id" field.
|
|
func (_u *ProjectTaskUpdate) SetGitIdentityID(v uuid.UUID) *ProjectTaskUpdate {
|
|
_u.mutation.SetGitIdentityID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableGitIdentityID sets the "git_identity_id" field if the given value is not nil.
|
|
func (_u *ProjectTaskUpdate) SetNillableGitIdentityID(v *uuid.UUID) *ProjectTaskUpdate {
|
|
if v != nil {
|
|
_u.SetGitIdentityID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearGitIdentityID clears the value of the "git_identity_id" field.
|
|
func (_u *ProjectTaskUpdate) ClearGitIdentityID() *ProjectTaskUpdate {
|
|
_u.mutation.ClearGitIdentityID()
|
|
return _u
|
|
}
|
|
|
|
// SetProjectID sets the "project_id" field.
|
|
func (_u *ProjectTaskUpdate) SetProjectID(v uuid.UUID) *ProjectTaskUpdate {
|
|
_u.mutation.SetProjectID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableProjectID sets the "project_id" field if the given value is not nil.
|
|
func (_u *ProjectTaskUpdate) SetNillableProjectID(v *uuid.UUID) *ProjectTaskUpdate {
|
|
if v != nil {
|
|
_u.SetProjectID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearProjectID clears the value of the "project_id" field.
|
|
func (_u *ProjectTaskUpdate) ClearProjectID() *ProjectTaskUpdate {
|
|
_u.mutation.ClearProjectID()
|
|
return _u
|
|
}
|
|
|
|
// SetIssueID sets the "issue_id" field.
|
|
func (_u *ProjectTaskUpdate) SetIssueID(v uuid.UUID) *ProjectTaskUpdate {
|
|
_u.mutation.SetIssueID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableIssueID sets the "issue_id" field if the given value is not nil.
|
|
func (_u *ProjectTaskUpdate) SetNillableIssueID(v *uuid.UUID) *ProjectTaskUpdate {
|
|
if v != nil {
|
|
_u.SetIssueID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearIssueID clears the value of the "issue_id" field.
|
|
func (_u *ProjectTaskUpdate) ClearIssueID() *ProjectTaskUpdate {
|
|
_u.mutation.ClearIssueID()
|
|
return _u
|
|
}
|
|
|
|
// SetRepoURL sets the "repo_url" field.
|
|
func (_u *ProjectTaskUpdate) SetRepoURL(v string) *ProjectTaskUpdate {
|
|
_u.mutation.SetRepoURL(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRepoURL sets the "repo_url" field if the given value is not nil.
|
|
func (_u *ProjectTaskUpdate) SetNillableRepoURL(v *string) *ProjectTaskUpdate {
|
|
if v != nil {
|
|
_u.SetRepoURL(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearRepoURL clears the value of the "repo_url" field.
|
|
func (_u *ProjectTaskUpdate) ClearRepoURL() *ProjectTaskUpdate {
|
|
_u.mutation.ClearRepoURL()
|
|
return _u
|
|
}
|
|
|
|
// SetRepoFilename sets the "repo_filename" field.
|
|
func (_u *ProjectTaskUpdate) SetRepoFilename(v string) *ProjectTaskUpdate {
|
|
_u.mutation.SetRepoFilename(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRepoFilename sets the "repo_filename" field if the given value is not nil.
|
|
func (_u *ProjectTaskUpdate) SetNillableRepoFilename(v *string) *ProjectTaskUpdate {
|
|
if v != nil {
|
|
_u.SetRepoFilename(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearRepoFilename clears the value of the "repo_filename" field.
|
|
func (_u *ProjectTaskUpdate) ClearRepoFilename() *ProjectTaskUpdate {
|
|
_u.mutation.ClearRepoFilename()
|
|
return _u
|
|
}
|
|
|
|
// SetBranch sets the "branch" field.
|
|
func (_u *ProjectTaskUpdate) SetBranch(v string) *ProjectTaskUpdate {
|
|
_u.mutation.SetBranch(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableBranch sets the "branch" field if the given value is not nil.
|
|
func (_u *ProjectTaskUpdate) SetNillableBranch(v *string) *ProjectTaskUpdate {
|
|
if v != nil {
|
|
_u.SetBranch(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearBranch clears the value of the "branch" field.
|
|
func (_u *ProjectTaskUpdate) ClearBranch() *ProjectTaskUpdate {
|
|
_u.mutation.ClearBranch()
|
|
return _u
|
|
}
|
|
|
|
// SetCliName sets the "cli_name" field.
|
|
func (_u *ProjectTaskUpdate) SetCliName(v consts.CliName) *ProjectTaskUpdate {
|
|
_u.mutation.SetCliName(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableCliName sets the "cli_name" field if the given value is not nil.
|
|
func (_u *ProjectTaskUpdate) SetNillableCliName(v *consts.CliName) *ProjectTaskUpdate {
|
|
if v != nil {
|
|
_u.SetCliName(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (_u *ProjectTaskUpdate) SetCreatedAt(v time.Time) *ProjectTaskUpdate {
|
|
_u.mutation.SetCreatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
|
func (_u *ProjectTaskUpdate) SetNillableCreatedAt(v *time.Time) *ProjectTaskUpdate {
|
|
if v != nil {
|
|
_u.SetCreatedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetTask sets the "task" edge to the Task entity.
|
|
func (_u *ProjectTaskUpdate) SetTask(v *Task) *ProjectTaskUpdate {
|
|
return _u.SetTaskID(v.ID)
|
|
}
|
|
|
|
// SetModel sets the "model" edge to the Model entity.
|
|
func (_u *ProjectTaskUpdate) SetModel(v *Model) *ProjectTaskUpdate {
|
|
return _u.SetModelID(v.ID)
|
|
}
|
|
|
|
// SetImage sets the "image" edge to the Image entity.
|
|
func (_u *ProjectTaskUpdate) SetImage(v *Image) *ProjectTaskUpdate {
|
|
return _u.SetImageID(v.ID)
|
|
}
|
|
|
|
// SetGitIdentity sets the "git_identity" edge to the GitIdentity entity.
|
|
func (_u *ProjectTaskUpdate) SetGitIdentity(v *GitIdentity) *ProjectTaskUpdate {
|
|
return _u.SetGitIdentityID(v.ID)
|
|
}
|
|
|
|
// SetProject sets the "project" edge to the Project entity.
|
|
func (_u *ProjectTaskUpdate) SetProject(v *Project) *ProjectTaskUpdate {
|
|
return _u.SetProjectID(v.ID)
|
|
}
|
|
|
|
// SetIssue sets the "issue" edge to the ProjectIssue entity.
|
|
func (_u *ProjectTaskUpdate) SetIssue(v *ProjectIssue) *ProjectTaskUpdate {
|
|
return _u.SetIssueID(v.ID)
|
|
}
|
|
|
|
// Mutation returns the ProjectTaskMutation object of the builder.
|
|
func (_u *ProjectTaskUpdate) Mutation() *ProjectTaskMutation {
|
|
return _u.mutation
|
|
}
|
|
|
|
// ClearTask clears the "task" edge to the Task entity.
|
|
func (_u *ProjectTaskUpdate) ClearTask() *ProjectTaskUpdate {
|
|
_u.mutation.ClearTask()
|
|
return _u
|
|
}
|
|
|
|
// ClearModel clears the "model" edge to the Model entity.
|
|
func (_u *ProjectTaskUpdate) ClearModel() *ProjectTaskUpdate {
|
|
_u.mutation.ClearModel()
|
|
return _u
|
|
}
|
|
|
|
// ClearImage clears the "image" edge to the Image entity.
|
|
func (_u *ProjectTaskUpdate) ClearImage() *ProjectTaskUpdate {
|
|
_u.mutation.ClearImage()
|
|
return _u
|
|
}
|
|
|
|
// ClearGitIdentity clears the "git_identity" edge to the GitIdentity entity.
|
|
func (_u *ProjectTaskUpdate) ClearGitIdentity() *ProjectTaskUpdate {
|
|
_u.mutation.ClearGitIdentity()
|
|
return _u
|
|
}
|
|
|
|
// ClearProject clears the "project" edge to the Project entity.
|
|
func (_u *ProjectTaskUpdate) ClearProject() *ProjectTaskUpdate {
|
|
_u.mutation.ClearProject()
|
|
return _u
|
|
}
|
|
|
|
// ClearIssue clears the "issue" edge to the ProjectIssue entity.
|
|
func (_u *ProjectTaskUpdate) ClearIssue() *ProjectTaskUpdate {
|
|
_u.mutation.ClearIssue()
|
|
return _u
|
|
}
|
|
|
|
// Save executes the query and returns the number of nodes affected by the update operation.
|
|
func (_u *ProjectTaskUpdate) 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 *ProjectTaskUpdate) SaveX(ctx context.Context) int {
|
|
affected, err := _u.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return affected
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_u *ProjectTaskUpdate) Exec(ctx context.Context) error {
|
|
_, err := _u.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_u *ProjectTaskUpdate) 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 *ProjectTaskUpdate) check() error {
|
|
if _u.mutation.TaskCleared() && len(_u.mutation.TaskIDs()) > 0 {
|
|
return errors.New(`db: clearing a required unique edge "ProjectTask.task"`)
|
|
}
|
|
if _u.mutation.ModelCleared() && len(_u.mutation.ModelIDs()) > 0 {
|
|
return errors.New(`db: clearing a required unique edge "ProjectTask.model"`)
|
|
}
|
|
if _u.mutation.ImageCleared() && len(_u.mutation.ImageIDs()) > 0 {
|
|
return errors.New(`db: clearing a required unique edge "ProjectTask.image"`)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
|
|
func (_u *ProjectTaskUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *ProjectTaskUpdate {
|
|
_u.modifiers = append(_u.modifiers, modifiers...)
|
|
return _u
|
|
}
|
|
|
|
func (_u *ProjectTaskUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
|
if err := _u.check(); err != nil {
|
|
return _node, err
|
|
}
|
|
_spec := sqlgraph.NewUpdateSpec(projecttask.Table, projecttask.Columns, sqlgraph.NewFieldSpec(projecttask.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.RepoURL(); ok {
|
|
_spec.SetField(projecttask.FieldRepoURL, field.TypeString, value)
|
|
}
|
|
if _u.mutation.RepoURLCleared() {
|
|
_spec.ClearField(projecttask.FieldRepoURL, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.RepoFilename(); ok {
|
|
_spec.SetField(projecttask.FieldRepoFilename, field.TypeString, value)
|
|
}
|
|
if _u.mutation.RepoFilenameCleared() {
|
|
_spec.ClearField(projecttask.FieldRepoFilename, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Branch(); ok {
|
|
_spec.SetField(projecttask.FieldBranch, field.TypeString, value)
|
|
}
|
|
if _u.mutation.BranchCleared() {
|
|
_spec.ClearField(projecttask.FieldBranch, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.CliName(); ok {
|
|
_spec.SetField(projecttask.FieldCliName, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.CreatedAt(); ok {
|
|
_spec.SetField(projecttask.FieldCreatedAt, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.TaskCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: projecttask.TaskTable,
|
|
Columns: []string{projecttask.TaskColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(task.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.TaskIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: projecttask.TaskTable,
|
|
Columns: []string{projecttask.TaskColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(task.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.ModelCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: projecttask.ModelTable,
|
|
Columns: []string{projecttask.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: projecttask.ModelTable,
|
|
Columns: []string{projecttask.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.ImageCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: projecttask.ImageTable,
|
|
Columns: []string{projecttask.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: projecttask.ImageTable,
|
|
Columns: []string{projecttask.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.GitIdentityCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: projecttask.GitIdentityTable,
|
|
Columns: []string{projecttask.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: projecttask.GitIdentityTable,
|
|
Columns: []string{projecttask.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.ProjectCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: projecttask.ProjectTable,
|
|
Columns: []string{projecttask.ProjectColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(project.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.ProjectIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: projecttask.ProjectTable,
|
|
Columns: []string{projecttask.ProjectColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(project.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.IssueCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: projecttask.IssueTable,
|
|
Columns: []string{projecttask.IssueColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projectissue.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.IssueIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: projecttask.IssueTable,
|
|
Columns: []string{projecttask.IssueColumn},
|
|
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)
|
|
}
|
|
_spec.AddModifiers(_u.modifiers...)
|
|
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
|
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
|
err = &NotFoundError{projecttask.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return 0, err
|
|
}
|
|
_u.mutation.done = true
|
|
return _node, nil
|
|
}
|
|
|
|
// ProjectTaskUpdateOne is the builder for updating a single ProjectTask entity.
|
|
type ProjectTaskUpdateOne struct {
|
|
config
|
|
fields []string
|
|
hooks []Hook
|
|
mutation *ProjectTaskMutation
|
|
modifiers []func(*sql.UpdateBuilder)
|
|
}
|
|
|
|
// SetTaskID sets the "task_id" field.
|
|
func (_u *ProjectTaskUpdateOne) SetTaskID(v uuid.UUID) *ProjectTaskUpdateOne {
|
|
_u.mutation.SetTaskID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableTaskID sets the "task_id" field if the given value is not nil.
|
|
func (_u *ProjectTaskUpdateOne) SetNillableTaskID(v *uuid.UUID) *ProjectTaskUpdateOne {
|
|
if v != nil {
|
|
_u.SetTaskID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetModelID sets the "model_id" field.
|
|
func (_u *ProjectTaskUpdateOne) SetModelID(v uuid.UUID) *ProjectTaskUpdateOne {
|
|
_u.mutation.SetModelID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableModelID sets the "model_id" field if the given value is not nil.
|
|
func (_u *ProjectTaskUpdateOne) SetNillableModelID(v *uuid.UUID) *ProjectTaskUpdateOne {
|
|
if v != nil {
|
|
_u.SetModelID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetImageID sets the "image_id" field.
|
|
func (_u *ProjectTaskUpdateOne) SetImageID(v uuid.UUID) *ProjectTaskUpdateOne {
|
|
_u.mutation.SetImageID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableImageID sets the "image_id" field if the given value is not nil.
|
|
func (_u *ProjectTaskUpdateOne) SetNillableImageID(v *uuid.UUID) *ProjectTaskUpdateOne {
|
|
if v != nil {
|
|
_u.SetImageID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetGitIdentityID sets the "git_identity_id" field.
|
|
func (_u *ProjectTaskUpdateOne) SetGitIdentityID(v uuid.UUID) *ProjectTaskUpdateOne {
|
|
_u.mutation.SetGitIdentityID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableGitIdentityID sets the "git_identity_id" field if the given value is not nil.
|
|
func (_u *ProjectTaskUpdateOne) SetNillableGitIdentityID(v *uuid.UUID) *ProjectTaskUpdateOne {
|
|
if v != nil {
|
|
_u.SetGitIdentityID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearGitIdentityID clears the value of the "git_identity_id" field.
|
|
func (_u *ProjectTaskUpdateOne) ClearGitIdentityID() *ProjectTaskUpdateOne {
|
|
_u.mutation.ClearGitIdentityID()
|
|
return _u
|
|
}
|
|
|
|
// SetProjectID sets the "project_id" field.
|
|
func (_u *ProjectTaskUpdateOne) SetProjectID(v uuid.UUID) *ProjectTaskUpdateOne {
|
|
_u.mutation.SetProjectID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableProjectID sets the "project_id" field if the given value is not nil.
|
|
func (_u *ProjectTaskUpdateOne) SetNillableProjectID(v *uuid.UUID) *ProjectTaskUpdateOne {
|
|
if v != nil {
|
|
_u.SetProjectID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearProjectID clears the value of the "project_id" field.
|
|
func (_u *ProjectTaskUpdateOne) ClearProjectID() *ProjectTaskUpdateOne {
|
|
_u.mutation.ClearProjectID()
|
|
return _u
|
|
}
|
|
|
|
// SetIssueID sets the "issue_id" field.
|
|
func (_u *ProjectTaskUpdateOne) SetIssueID(v uuid.UUID) *ProjectTaskUpdateOne {
|
|
_u.mutation.SetIssueID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableIssueID sets the "issue_id" field if the given value is not nil.
|
|
func (_u *ProjectTaskUpdateOne) SetNillableIssueID(v *uuid.UUID) *ProjectTaskUpdateOne {
|
|
if v != nil {
|
|
_u.SetIssueID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearIssueID clears the value of the "issue_id" field.
|
|
func (_u *ProjectTaskUpdateOne) ClearIssueID() *ProjectTaskUpdateOne {
|
|
_u.mutation.ClearIssueID()
|
|
return _u
|
|
}
|
|
|
|
// SetRepoURL sets the "repo_url" field.
|
|
func (_u *ProjectTaskUpdateOne) SetRepoURL(v string) *ProjectTaskUpdateOne {
|
|
_u.mutation.SetRepoURL(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRepoURL sets the "repo_url" field if the given value is not nil.
|
|
func (_u *ProjectTaskUpdateOne) SetNillableRepoURL(v *string) *ProjectTaskUpdateOne {
|
|
if v != nil {
|
|
_u.SetRepoURL(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearRepoURL clears the value of the "repo_url" field.
|
|
func (_u *ProjectTaskUpdateOne) ClearRepoURL() *ProjectTaskUpdateOne {
|
|
_u.mutation.ClearRepoURL()
|
|
return _u
|
|
}
|
|
|
|
// SetRepoFilename sets the "repo_filename" field.
|
|
func (_u *ProjectTaskUpdateOne) SetRepoFilename(v string) *ProjectTaskUpdateOne {
|
|
_u.mutation.SetRepoFilename(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRepoFilename sets the "repo_filename" field if the given value is not nil.
|
|
func (_u *ProjectTaskUpdateOne) SetNillableRepoFilename(v *string) *ProjectTaskUpdateOne {
|
|
if v != nil {
|
|
_u.SetRepoFilename(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearRepoFilename clears the value of the "repo_filename" field.
|
|
func (_u *ProjectTaskUpdateOne) ClearRepoFilename() *ProjectTaskUpdateOne {
|
|
_u.mutation.ClearRepoFilename()
|
|
return _u
|
|
}
|
|
|
|
// SetBranch sets the "branch" field.
|
|
func (_u *ProjectTaskUpdateOne) SetBranch(v string) *ProjectTaskUpdateOne {
|
|
_u.mutation.SetBranch(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableBranch sets the "branch" field if the given value is not nil.
|
|
func (_u *ProjectTaskUpdateOne) SetNillableBranch(v *string) *ProjectTaskUpdateOne {
|
|
if v != nil {
|
|
_u.SetBranch(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearBranch clears the value of the "branch" field.
|
|
func (_u *ProjectTaskUpdateOne) ClearBranch() *ProjectTaskUpdateOne {
|
|
_u.mutation.ClearBranch()
|
|
return _u
|
|
}
|
|
|
|
// SetCliName sets the "cli_name" field.
|
|
func (_u *ProjectTaskUpdateOne) SetCliName(v consts.CliName) *ProjectTaskUpdateOne {
|
|
_u.mutation.SetCliName(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableCliName sets the "cli_name" field if the given value is not nil.
|
|
func (_u *ProjectTaskUpdateOne) SetNillableCliName(v *consts.CliName) *ProjectTaskUpdateOne {
|
|
if v != nil {
|
|
_u.SetCliName(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (_u *ProjectTaskUpdateOne) SetCreatedAt(v time.Time) *ProjectTaskUpdateOne {
|
|
_u.mutation.SetCreatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
|
func (_u *ProjectTaskUpdateOne) SetNillableCreatedAt(v *time.Time) *ProjectTaskUpdateOne {
|
|
if v != nil {
|
|
_u.SetCreatedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetTask sets the "task" edge to the Task entity.
|
|
func (_u *ProjectTaskUpdateOne) SetTask(v *Task) *ProjectTaskUpdateOne {
|
|
return _u.SetTaskID(v.ID)
|
|
}
|
|
|
|
// SetModel sets the "model" edge to the Model entity.
|
|
func (_u *ProjectTaskUpdateOne) SetModel(v *Model) *ProjectTaskUpdateOne {
|
|
return _u.SetModelID(v.ID)
|
|
}
|
|
|
|
// SetImage sets the "image" edge to the Image entity.
|
|
func (_u *ProjectTaskUpdateOne) SetImage(v *Image) *ProjectTaskUpdateOne {
|
|
return _u.SetImageID(v.ID)
|
|
}
|
|
|
|
// SetGitIdentity sets the "git_identity" edge to the GitIdentity entity.
|
|
func (_u *ProjectTaskUpdateOne) SetGitIdentity(v *GitIdentity) *ProjectTaskUpdateOne {
|
|
return _u.SetGitIdentityID(v.ID)
|
|
}
|
|
|
|
// SetProject sets the "project" edge to the Project entity.
|
|
func (_u *ProjectTaskUpdateOne) SetProject(v *Project) *ProjectTaskUpdateOne {
|
|
return _u.SetProjectID(v.ID)
|
|
}
|
|
|
|
// SetIssue sets the "issue" edge to the ProjectIssue entity.
|
|
func (_u *ProjectTaskUpdateOne) SetIssue(v *ProjectIssue) *ProjectTaskUpdateOne {
|
|
return _u.SetIssueID(v.ID)
|
|
}
|
|
|
|
// Mutation returns the ProjectTaskMutation object of the builder.
|
|
func (_u *ProjectTaskUpdateOne) Mutation() *ProjectTaskMutation {
|
|
return _u.mutation
|
|
}
|
|
|
|
// ClearTask clears the "task" edge to the Task entity.
|
|
func (_u *ProjectTaskUpdateOne) ClearTask() *ProjectTaskUpdateOne {
|
|
_u.mutation.ClearTask()
|
|
return _u
|
|
}
|
|
|
|
// ClearModel clears the "model" edge to the Model entity.
|
|
func (_u *ProjectTaskUpdateOne) ClearModel() *ProjectTaskUpdateOne {
|
|
_u.mutation.ClearModel()
|
|
return _u
|
|
}
|
|
|
|
// ClearImage clears the "image" edge to the Image entity.
|
|
func (_u *ProjectTaskUpdateOne) ClearImage() *ProjectTaskUpdateOne {
|
|
_u.mutation.ClearImage()
|
|
return _u
|
|
}
|
|
|
|
// ClearGitIdentity clears the "git_identity" edge to the GitIdentity entity.
|
|
func (_u *ProjectTaskUpdateOne) ClearGitIdentity() *ProjectTaskUpdateOne {
|
|
_u.mutation.ClearGitIdentity()
|
|
return _u
|
|
}
|
|
|
|
// ClearProject clears the "project" edge to the Project entity.
|
|
func (_u *ProjectTaskUpdateOne) ClearProject() *ProjectTaskUpdateOne {
|
|
_u.mutation.ClearProject()
|
|
return _u
|
|
}
|
|
|
|
// ClearIssue clears the "issue" edge to the ProjectIssue entity.
|
|
func (_u *ProjectTaskUpdateOne) ClearIssue() *ProjectTaskUpdateOne {
|
|
_u.mutation.ClearIssue()
|
|
return _u
|
|
}
|
|
|
|
// Where appends a list predicates to the ProjectTaskUpdate builder.
|
|
func (_u *ProjectTaskUpdateOne) Where(ps ...predicate.ProjectTask) *ProjectTaskUpdateOne {
|
|
_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 *ProjectTaskUpdateOne) Select(field string, fields ...string) *ProjectTaskUpdateOne {
|
|
_u.fields = append([]string{field}, fields...)
|
|
return _u
|
|
}
|
|
|
|
// Save executes the query and returns the updated ProjectTask entity.
|
|
func (_u *ProjectTaskUpdateOne) Save(ctx context.Context) (*ProjectTask, error) {
|
|
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (_u *ProjectTaskUpdateOne) SaveX(ctx context.Context) *ProjectTask {
|
|
node, err := _u.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return node
|
|
}
|
|
|
|
// Exec executes the query on the entity.
|
|
func (_u *ProjectTaskUpdateOne) Exec(ctx context.Context) error {
|
|
_, err := _u.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_u *ProjectTaskUpdateOne) 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 *ProjectTaskUpdateOne) check() error {
|
|
if _u.mutation.TaskCleared() && len(_u.mutation.TaskIDs()) > 0 {
|
|
return errors.New(`db: clearing a required unique edge "ProjectTask.task"`)
|
|
}
|
|
if _u.mutation.ModelCleared() && len(_u.mutation.ModelIDs()) > 0 {
|
|
return errors.New(`db: clearing a required unique edge "ProjectTask.model"`)
|
|
}
|
|
if _u.mutation.ImageCleared() && len(_u.mutation.ImageIDs()) > 0 {
|
|
return errors.New(`db: clearing a required unique edge "ProjectTask.image"`)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
|
|
func (_u *ProjectTaskUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *ProjectTaskUpdateOne {
|
|
_u.modifiers = append(_u.modifiers, modifiers...)
|
|
return _u
|
|
}
|
|
|
|
func (_u *ProjectTaskUpdateOne) sqlSave(ctx context.Context) (_node *ProjectTask, err error) {
|
|
if err := _u.check(); err != nil {
|
|
return _node, err
|
|
}
|
|
_spec := sqlgraph.NewUpdateSpec(projecttask.Table, projecttask.Columns, sqlgraph.NewFieldSpec(projecttask.FieldID, field.TypeUUID))
|
|
id, ok := _u.mutation.ID()
|
|
if !ok {
|
|
return nil, &ValidationError{Name: "id", err: errors.New(`db: missing "ProjectTask.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, projecttask.FieldID)
|
|
for _, f := range fields {
|
|
if !projecttask.ValidColumn(f) {
|
|
return nil, &ValidationError{Name: f, err: fmt.Errorf("db: invalid field %q for query", f)}
|
|
}
|
|
if f != projecttask.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.RepoURL(); ok {
|
|
_spec.SetField(projecttask.FieldRepoURL, field.TypeString, value)
|
|
}
|
|
if _u.mutation.RepoURLCleared() {
|
|
_spec.ClearField(projecttask.FieldRepoURL, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.RepoFilename(); ok {
|
|
_spec.SetField(projecttask.FieldRepoFilename, field.TypeString, value)
|
|
}
|
|
if _u.mutation.RepoFilenameCleared() {
|
|
_spec.ClearField(projecttask.FieldRepoFilename, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Branch(); ok {
|
|
_spec.SetField(projecttask.FieldBranch, field.TypeString, value)
|
|
}
|
|
if _u.mutation.BranchCleared() {
|
|
_spec.ClearField(projecttask.FieldBranch, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.CliName(); ok {
|
|
_spec.SetField(projecttask.FieldCliName, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.CreatedAt(); ok {
|
|
_spec.SetField(projecttask.FieldCreatedAt, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.TaskCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: projecttask.TaskTable,
|
|
Columns: []string{projecttask.TaskColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(task.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.TaskIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: projecttask.TaskTable,
|
|
Columns: []string{projecttask.TaskColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(task.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.ModelCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: projecttask.ModelTable,
|
|
Columns: []string{projecttask.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: projecttask.ModelTable,
|
|
Columns: []string{projecttask.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.ImageCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: projecttask.ImageTable,
|
|
Columns: []string{projecttask.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: projecttask.ImageTable,
|
|
Columns: []string{projecttask.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.GitIdentityCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: projecttask.GitIdentityTable,
|
|
Columns: []string{projecttask.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: projecttask.GitIdentityTable,
|
|
Columns: []string{projecttask.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.ProjectCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: projecttask.ProjectTable,
|
|
Columns: []string{projecttask.ProjectColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(project.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.ProjectIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: projecttask.ProjectTable,
|
|
Columns: []string{projecttask.ProjectColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(project.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.IssueCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: projecttask.IssueTable,
|
|
Columns: []string{projecttask.IssueColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(projectissue.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.IssueIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: projecttask.IssueTable,
|
|
Columns: []string{projecttask.IssueColumn},
|
|
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)
|
|
}
|
|
_spec.AddModifiers(_u.modifiers...)
|
|
_node = &ProjectTask{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{projecttask.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return nil, err
|
|
}
|
|
_u.mutation.done = true
|
|
return _node, nil
|
|
}
|