// Code generated by ent, DO NOT EDIT.

package ent

import (
	"context"
	"errors"
	"fmt"
	"time"

	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
	"github.com/buildbarn/bb-portal/ent/gen/ent/bazelinvocation"
	"github.com/buildbarn/bb-portal/ent/gen/ent/bazelinvocationproblem"
	"github.com/buildbarn/bb-portal/ent/gen/ent/build"
	"github.com/buildbarn/bb-portal/ent/gen/ent/eventfile"
	"github.com/buildbarn/bb-portal/ent/gen/ent/metrics"
	"github.com/buildbarn/bb-portal/ent/gen/ent/predicate"
	"github.com/buildbarn/bb-portal/ent/gen/ent/sourcecontrol"
	"github.com/buildbarn/bb-portal/ent/gen/ent/targetpair"
	"github.com/buildbarn/bb-portal/ent/gen/ent/testcollection"
	"github.com/buildbarn/bb-portal/pkg/summary"
)

// BazelInvocationUpdate is the builder for updating BazelInvocation entities.
type BazelInvocationUpdate struct {
	config
	hooks    []Hook
	mutation *BazelInvocationMutation
}

// Where appends a list predicates to the BazelInvocationUpdate builder.
func (biu *BazelInvocationUpdate) Where(ps ...predicate.BazelInvocation) *BazelInvocationUpdate {
	biu.mutation.Where(ps...)
	return biu
}

// SetStartedAt sets the "started_at" field.
func (biu *BazelInvocationUpdate) SetStartedAt(t time.Time) *BazelInvocationUpdate {
	biu.mutation.SetStartedAt(t)
	return biu
}

// SetNillableStartedAt sets the "started_at" field if the given value is not nil.
func (biu *BazelInvocationUpdate) SetNillableStartedAt(t *time.Time) *BazelInvocationUpdate {
	if t != nil {
		biu.SetStartedAt(*t)
	}
	return biu
}

// SetEndedAt sets the "ended_at" field.
func (biu *BazelInvocationUpdate) SetEndedAt(t time.Time) *BazelInvocationUpdate {
	biu.mutation.SetEndedAt(t)
	return biu
}

// SetNillableEndedAt sets the "ended_at" field if the given value is not nil.
func (biu *BazelInvocationUpdate) SetNillableEndedAt(t *time.Time) *BazelInvocationUpdate {
	if t != nil {
		biu.SetEndedAt(*t)
	}
	return biu
}

// ClearEndedAt clears the value of the "ended_at" field.
func (biu *BazelInvocationUpdate) ClearEndedAt() *BazelInvocationUpdate {
	biu.mutation.ClearEndedAt()
	return biu
}

// SetChangeNumber sets the "change_number" field.
func (biu *BazelInvocationUpdate) SetChangeNumber(i int) *BazelInvocationUpdate {
	biu.mutation.ResetChangeNumber()
	biu.mutation.SetChangeNumber(i)
	return biu
}

// SetNillableChangeNumber sets the "change_number" field if the given value is not nil.
func (biu *BazelInvocationUpdate) SetNillableChangeNumber(i *int) *BazelInvocationUpdate {
	if i != nil {
		biu.SetChangeNumber(*i)
	}
	return biu
}

// AddChangeNumber adds i to the "change_number" field.
func (biu *BazelInvocationUpdate) AddChangeNumber(i int) *BazelInvocationUpdate {
	biu.mutation.AddChangeNumber(i)
	return biu
}

// ClearChangeNumber clears the value of the "change_number" field.
func (biu *BazelInvocationUpdate) ClearChangeNumber() *BazelInvocationUpdate {
	biu.mutation.ClearChangeNumber()
	return biu
}

// SetPatchsetNumber sets the "patchset_number" field.
func (biu *BazelInvocationUpdate) SetPatchsetNumber(i int) *BazelInvocationUpdate {
	biu.mutation.ResetPatchsetNumber()
	biu.mutation.SetPatchsetNumber(i)
	return biu
}

// SetNillablePatchsetNumber sets the "patchset_number" field if the given value is not nil.
func (biu *BazelInvocationUpdate) SetNillablePatchsetNumber(i *int) *BazelInvocationUpdate {
	if i != nil {
		biu.SetPatchsetNumber(*i)
	}
	return biu
}

// AddPatchsetNumber adds i to the "patchset_number" field.
func (biu *BazelInvocationUpdate) AddPatchsetNumber(i int) *BazelInvocationUpdate {
	biu.mutation.AddPatchsetNumber(i)
	return biu
}

// ClearPatchsetNumber clears the value of the "patchset_number" field.
func (biu *BazelInvocationUpdate) ClearPatchsetNumber() *BazelInvocationUpdate {
	biu.mutation.ClearPatchsetNumber()
	return biu
}

// SetSummary sets the "summary" field.
func (biu *BazelInvocationUpdate) SetSummary(ss summary.InvocationSummary) *BazelInvocationUpdate {
	biu.mutation.SetSummary(ss)
	return biu
}

// SetNillableSummary sets the "summary" field if the given value is not nil.
func (biu *BazelInvocationUpdate) SetNillableSummary(ss *summary.InvocationSummary) *BazelInvocationUpdate {
	if ss != nil {
		biu.SetSummary(*ss)
	}
	return biu
}

// SetBepCompleted sets the "bep_completed" field.
func (biu *BazelInvocationUpdate) SetBepCompleted(b bool) *BazelInvocationUpdate {
	biu.mutation.SetBepCompleted(b)
	return biu
}

// SetNillableBepCompleted sets the "bep_completed" field if the given value is not nil.
func (biu *BazelInvocationUpdate) SetNillableBepCompleted(b *bool) *BazelInvocationUpdate {
	if b != nil {
		biu.SetBepCompleted(*b)
	}
	return biu
}

// ClearBepCompleted clears the value of the "bep_completed" field.
func (biu *BazelInvocationUpdate) ClearBepCompleted() *BazelInvocationUpdate {
	biu.mutation.ClearBepCompleted()
	return biu
}

// SetStepLabel sets the "step_label" field.
func (biu *BazelInvocationUpdate) SetStepLabel(s string) *BazelInvocationUpdate {
	biu.mutation.SetStepLabel(s)
	return biu
}

// SetNillableStepLabel sets the "step_label" field if the given value is not nil.
func (biu *BazelInvocationUpdate) SetNillableStepLabel(s *string) *BazelInvocationUpdate {
	if s != nil {
		biu.SetStepLabel(*s)
	}
	return biu
}

// SetRelatedFiles sets the "related_files" field.
func (biu *BazelInvocationUpdate) SetRelatedFiles(m map[string]string) *BazelInvocationUpdate {
	biu.mutation.SetRelatedFiles(m)
	return biu
}

// SetUserEmail sets the "user_email" field.
func (biu *BazelInvocationUpdate) SetUserEmail(s string) *BazelInvocationUpdate {
	biu.mutation.SetUserEmail(s)
	return biu
}

// SetNillableUserEmail sets the "user_email" field if the given value is not nil.
func (biu *BazelInvocationUpdate) SetNillableUserEmail(s *string) *BazelInvocationUpdate {
	if s != nil {
		biu.SetUserEmail(*s)
	}
	return biu
}

// ClearUserEmail clears the value of the "user_email" field.
func (biu *BazelInvocationUpdate) ClearUserEmail() *BazelInvocationUpdate {
	biu.mutation.ClearUserEmail()
	return biu
}

// SetUserLdap sets the "user_ldap" field.
func (biu *BazelInvocationUpdate) SetUserLdap(s string) *BazelInvocationUpdate {
	biu.mutation.SetUserLdap(s)
	return biu
}

// SetNillableUserLdap sets the "user_ldap" field if the given value is not nil.
func (biu *BazelInvocationUpdate) SetNillableUserLdap(s *string) *BazelInvocationUpdate {
	if s != nil {
		biu.SetUserLdap(*s)
	}
	return biu
}

// ClearUserLdap clears the value of the "user_ldap" field.
func (biu *BazelInvocationUpdate) ClearUserLdap() *BazelInvocationUpdate {
	biu.mutation.ClearUserLdap()
	return biu
}

// SetBuildLogs sets the "build_logs" field.
func (biu *BazelInvocationUpdate) SetBuildLogs(s string) *BazelInvocationUpdate {
	biu.mutation.SetBuildLogs(s)
	return biu
}

// SetNillableBuildLogs sets the "build_logs" field if the given value is not nil.
func (biu *BazelInvocationUpdate) SetNillableBuildLogs(s *string) *BazelInvocationUpdate {
	if s != nil {
		biu.SetBuildLogs(*s)
	}
	return biu
}

// ClearBuildLogs clears the value of the "build_logs" field.
func (biu *BazelInvocationUpdate) ClearBuildLogs() *BazelInvocationUpdate {
	biu.mutation.ClearBuildLogs()
	return biu
}

// SetCPU sets the "cpu" field.
func (biu *BazelInvocationUpdate) SetCPU(s string) *BazelInvocationUpdate {
	biu.mutation.SetCPU(s)
	return biu
}

// SetNillableCPU sets the "cpu" field if the given value is not nil.
func (biu *BazelInvocationUpdate) SetNillableCPU(s *string) *BazelInvocationUpdate {
	if s != nil {
		biu.SetCPU(*s)
	}
	return biu
}

// ClearCPU clears the value of the "cpu" field.
func (biu *BazelInvocationUpdate) ClearCPU() *BazelInvocationUpdate {
	biu.mutation.ClearCPU()
	return biu
}

// SetPlatformName sets the "platform_name" field.
func (biu *BazelInvocationUpdate) SetPlatformName(s string) *BazelInvocationUpdate {
	biu.mutation.SetPlatformName(s)
	return biu
}

// SetNillablePlatformName sets the "platform_name" field if the given value is not nil.
func (biu *BazelInvocationUpdate) SetNillablePlatformName(s *string) *BazelInvocationUpdate {
	if s != nil {
		biu.SetPlatformName(*s)
	}
	return biu
}

// ClearPlatformName clears the value of the "platform_name" field.
func (biu *BazelInvocationUpdate) ClearPlatformName() *BazelInvocationUpdate {
	biu.mutation.ClearPlatformName()
	return biu
}

// SetHostname sets the "hostname" field.
func (biu *BazelInvocationUpdate) SetHostname(s string) *BazelInvocationUpdate {
	biu.mutation.SetHostname(s)
	return biu
}

// SetNillableHostname sets the "hostname" field if the given value is not nil.
func (biu *BazelInvocationUpdate) SetNillableHostname(s *string) *BazelInvocationUpdate {
	if s != nil {
		biu.SetHostname(*s)
	}
	return biu
}

// ClearHostname clears the value of the "hostname" field.
func (biu *BazelInvocationUpdate) ClearHostname() *BazelInvocationUpdate {
	biu.mutation.ClearHostname()
	return biu
}

// SetIsCiWorker sets the "is_ci_worker" field.
func (biu *BazelInvocationUpdate) SetIsCiWorker(b bool) *BazelInvocationUpdate {
	biu.mutation.SetIsCiWorker(b)
	return biu
}

// SetNillableIsCiWorker sets the "is_ci_worker" field if the given value is not nil.
func (biu *BazelInvocationUpdate) SetNillableIsCiWorker(b *bool) *BazelInvocationUpdate {
	if b != nil {
		biu.SetIsCiWorker(*b)
	}
	return biu
}

// ClearIsCiWorker clears the value of the "is_ci_worker" field.
func (biu *BazelInvocationUpdate) ClearIsCiWorker() *BazelInvocationUpdate {
	biu.mutation.ClearIsCiWorker()
	return biu
}

// SetConfigurationMnemonic sets the "configuration_mnemonic" field.
func (biu *BazelInvocationUpdate) SetConfigurationMnemonic(s string) *BazelInvocationUpdate {
	biu.mutation.SetConfigurationMnemonic(s)
	return biu
}

// SetNillableConfigurationMnemonic sets the "configuration_mnemonic" field if the given value is not nil.
func (biu *BazelInvocationUpdate) SetNillableConfigurationMnemonic(s *string) *BazelInvocationUpdate {
	if s != nil {
		biu.SetConfigurationMnemonic(*s)
	}
	return biu
}

// ClearConfigurationMnemonic clears the value of the "configuration_mnemonic" field.
func (biu *BazelInvocationUpdate) ClearConfigurationMnemonic() *BazelInvocationUpdate {
	biu.mutation.ClearConfigurationMnemonic()
	return biu
}

// SetNumFetches sets the "num_fetches" field.
func (biu *BazelInvocationUpdate) SetNumFetches(i int64) *BazelInvocationUpdate {
	biu.mutation.ResetNumFetches()
	biu.mutation.SetNumFetches(i)
	return biu
}

// SetNillableNumFetches sets the "num_fetches" field if the given value is not nil.
func (biu *BazelInvocationUpdate) SetNillableNumFetches(i *int64) *BazelInvocationUpdate {
	if i != nil {
		biu.SetNumFetches(*i)
	}
	return biu
}

// AddNumFetches adds i to the "num_fetches" field.
func (biu *BazelInvocationUpdate) AddNumFetches(i int64) *BazelInvocationUpdate {
	biu.mutation.AddNumFetches(i)
	return biu
}

// ClearNumFetches clears the value of the "num_fetches" field.
func (biu *BazelInvocationUpdate) ClearNumFetches() *BazelInvocationUpdate {
	biu.mutation.ClearNumFetches()
	return biu
}

// SetProfileName sets the "profile_name" field.
func (biu *BazelInvocationUpdate) SetProfileName(s string) *BazelInvocationUpdate {
	biu.mutation.SetProfileName(s)
	return biu
}

// SetNillableProfileName sets the "profile_name" field if the given value is not nil.
func (biu *BazelInvocationUpdate) SetNillableProfileName(s *string) *BazelInvocationUpdate {
	if s != nil {
		biu.SetProfileName(*s)
	}
	return biu
}

// SetInstanceName sets the "instance_name" field.
func (biu *BazelInvocationUpdate) SetInstanceName(s string) *BazelInvocationUpdate {
	biu.mutation.SetInstanceName(s)
	return biu
}

// SetNillableInstanceName sets the "instance_name" field if the given value is not nil.
func (biu *BazelInvocationUpdate) SetNillableInstanceName(s *string) *BazelInvocationUpdate {
	if s != nil {
		biu.SetInstanceName(*s)
	}
	return biu
}

// ClearInstanceName clears the value of the "instance_name" field.
func (biu *BazelInvocationUpdate) ClearInstanceName() *BazelInvocationUpdate {
	biu.mutation.ClearInstanceName()
	return biu
}

// SetEventFileID sets the "event_file" edge to the EventFile entity by ID.
func (biu *BazelInvocationUpdate) SetEventFileID(id int) *BazelInvocationUpdate {
	biu.mutation.SetEventFileID(id)
	return biu
}

// SetEventFile sets the "event_file" edge to the EventFile entity.
func (biu *BazelInvocationUpdate) SetEventFile(e *EventFile) *BazelInvocationUpdate {
	return biu.SetEventFileID(e.ID)
}

// SetBuildID sets the "build" edge to the Build entity by ID.
func (biu *BazelInvocationUpdate) SetBuildID(id int) *BazelInvocationUpdate {
	biu.mutation.SetBuildID(id)
	return biu
}

// SetNillableBuildID sets the "build" edge to the Build entity by ID if the given value is not nil.
func (biu *BazelInvocationUpdate) SetNillableBuildID(id *int) *BazelInvocationUpdate {
	if id != nil {
		biu = biu.SetBuildID(*id)
	}
	return biu
}

// SetBuild sets the "build" edge to the Build entity.
func (biu *BazelInvocationUpdate) SetBuild(b *Build) *BazelInvocationUpdate {
	return biu.SetBuildID(b.ID)
}

// AddProblemIDs adds the "problems" edge to the BazelInvocationProblem entity by IDs.
func (biu *BazelInvocationUpdate) AddProblemIDs(ids ...int) *BazelInvocationUpdate {
	biu.mutation.AddProblemIDs(ids...)
	return biu
}

// AddProblems adds the "problems" edges to the BazelInvocationProblem entity.
func (biu *BazelInvocationUpdate) AddProblems(b ...*BazelInvocationProblem) *BazelInvocationUpdate {
	ids := make([]int, len(b))
	for i := range b {
		ids[i] = b[i].ID
	}
	return biu.AddProblemIDs(ids...)
}

// SetMetricsID sets the "metrics" edge to the Metrics entity by ID.
func (biu *BazelInvocationUpdate) SetMetricsID(id int) *BazelInvocationUpdate {
	biu.mutation.SetMetricsID(id)
	return biu
}

// SetNillableMetricsID sets the "metrics" edge to the Metrics entity by ID if the given value is not nil.
func (biu *BazelInvocationUpdate) SetNillableMetricsID(id *int) *BazelInvocationUpdate {
	if id != nil {
		biu = biu.SetMetricsID(*id)
	}
	return biu
}

// SetMetrics sets the "metrics" edge to the Metrics entity.
func (biu *BazelInvocationUpdate) SetMetrics(m *Metrics) *BazelInvocationUpdate {
	return biu.SetMetricsID(m.ID)
}

// AddTestCollectionIDs adds the "test_collection" edge to the TestCollection entity by IDs.
func (biu *BazelInvocationUpdate) AddTestCollectionIDs(ids ...int) *BazelInvocationUpdate {
	biu.mutation.AddTestCollectionIDs(ids...)
	return biu
}

// AddTestCollection adds the "test_collection" edges to the TestCollection entity.
func (biu *BazelInvocationUpdate) AddTestCollection(t ...*TestCollection) *BazelInvocationUpdate {
	ids := make([]int, len(t))
	for i := range t {
		ids[i] = t[i].ID
	}
	return biu.AddTestCollectionIDs(ids...)
}

// AddTargetIDs adds the "targets" edge to the TargetPair entity by IDs.
func (biu *BazelInvocationUpdate) AddTargetIDs(ids ...int) *BazelInvocationUpdate {
	biu.mutation.AddTargetIDs(ids...)
	return biu
}

// AddTargets adds the "targets" edges to the TargetPair entity.
func (biu *BazelInvocationUpdate) AddTargets(t ...*TargetPair) *BazelInvocationUpdate {
	ids := make([]int, len(t))
	for i := range t {
		ids[i] = t[i].ID
	}
	return biu.AddTargetIDs(ids...)
}

// SetSourceControlID sets the "source_control" edge to the SourceControl entity by ID.
func (biu *BazelInvocationUpdate) SetSourceControlID(id int) *BazelInvocationUpdate {
	biu.mutation.SetSourceControlID(id)
	return biu
}

// SetNillableSourceControlID sets the "source_control" edge to the SourceControl entity by ID if the given value is not nil.
func (biu *BazelInvocationUpdate) SetNillableSourceControlID(id *int) *BazelInvocationUpdate {
	if id != nil {
		biu = biu.SetSourceControlID(*id)
	}
	return biu
}

// SetSourceControl sets the "source_control" edge to the SourceControl entity.
func (biu *BazelInvocationUpdate) SetSourceControl(s *SourceControl) *BazelInvocationUpdate {
	return biu.SetSourceControlID(s.ID)
}

// Mutation returns the BazelInvocationMutation object of the builder.
func (biu *BazelInvocationUpdate) Mutation() *BazelInvocationMutation {
	return biu.mutation
}

// ClearEventFile clears the "event_file" edge to the EventFile entity.
func (biu *BazelInvocationUpdate) ClearEventFile() *BazelInvocationUpdate {
	biu.mutation.ClearEventFile()
	return biu
}

// ClearBuild clears the "build" edge to the Build entity.
func (biu *BazelInvocationUpdate) ClearBuild() *BazelInvocationUpdate {
	biu.mutation.ClearBuild()
	return biu
}

// ClearProblems clears all "problems" edges to the BazelInvocationProblem entity.
func (biu *BazelInvocationUpdate) ClearProblems() *BazelInvocationUpdate {
	biu.mutation.ClearProblems()
	return biu
}

// RemoveProblemIDs removes the "problems" edge to BazelInvocationProblem entities by IDs.
func (biu *BazelInvocationUpdate) RemoveProblemIDs(ids ...int) *BazelInvocationUpdate {
	biu.mutation.RemoveProblemIDs(ids...)
	return biu
}

// RemoveProblems removes "problems" edges to BazelInvocationProblem entities.
func (biu *BazelInvocationUpdate) RemoveProblems(b ...*BazelInvocationProblem) *BazelInvocationUpdate {
	ids := make([]int, len(b))
	for i := range b {
		ids[i] = b[i].ID
	}
	return biu.RemoveProblemIDs(ids...)
}

// ClearMetrics clears the "metrics" edge to the Metrics entity.
func (biu *BazelInvocationUpdate) ClearMetrics() *BazelInvocationUpdate {
	biu.mutation.ClearMetrics()
	return biu
}

// ClearTestCollection clears all "test_collection" edges to the TestCollection entity.
func (biu *BazelInvocationUpdate) ClearTestCollection() *BazelInvocationUpdate {
	biu.mutation.ClearTestCollection()
	return biu
}

// RemoveTestCollectionIDs removes the "test_collection" edge to TestCollection entities by IDs.
func (biu *BazelInvocationUpdate) RemoveTestCollectionIDs(ids ...int) *BazelInvocationUpdate {
	biu.mutation.RemoveTestCollectionIDs(ids...)
	return biu
}

// RemoveTestCollection removes "test_collection" edges to TestCollection entities.
func (biu *BazelInvocationUpdate) RemoveTestCollection(t ...*TestCollection) *BazelInvocationUpdate {
	ids := make([]int, len(t))
	for i := range t {
		ids[i] = t[i].ID
	}
	return biu.RemoveTestCollectionIDs(ids...)
}

// ClearTargets clears all "targets" edges to the TargetPair entity.
func (biu *BazelInvocationUpdate) ClearTargets() *BazelInvocationUpdate {
	biu.mutation.ClearTargets()
	return biu
}

// RemoveTargetIDs removes the "targets" edge to TargetPair entities by IDs.
func (biu *BazelInvocationUpdate) RemoveTargetIDs(ids ...int) *BazelInvocationUpdate {
	biu.mutation.RemoveTargetIDs(ids...)
	return biu
}

// RemoveTargets removes "targets" edges to TargetPair entities.
func (biu *BazelInvocationUpdate) RemoveTargets(t ...*TargetPair) *BazelInvocationUpdate {
	ids := make([]int, len(t))
	for i := range t {
		ids[i] = t[i].ID
	}
	return biu.RemoveTargetIDs(ids...)
}

// ClearSourceControl clears the "source_control" edge to the SourceControl entity.
func (biu *BazelInvocationUpdate) ClearSourceControl() *BazelInvocationUpdate {
	biu.mutation.ClearSourceControl()
	return biu
}

// Save executes the query and returns the number of nodes affected by the update operation.
func (biu *BazelInvocationUpdate) Save(ctx context.Context) (int, error) {
	return withHooks(ctx, biu.sqlSave, biu.mutation, biu.hooks)
}

// SaveX is like Save, but panics if an error occurs.
func (biu *BazelInvocationUpdate) SaveX(ctx context.Context) int {
	affected, err := biu.Save(ctx)
	if err != nil {
		panic(err)
	}
	return affected
}

// Exec executes the query.
func (biu *BazelInvocationUpdate) Exec(ctx context.Context) error {
	_, err := biu.Save(ctx)
	return err
}

// ExecX is like Exec, but panics if an error occurs.
func (biu *BazelInvocationUpdate) ExecX(ctx context.Context) {
	if err := biu.Exec(ctx); err != nil {
		panic(err)
	}
}

// check runs all checks and user-defined validators on the builder.
func (biu *BazelInvocationUpdate) check() error {
	if biu.mutation.EventFileCleared() && len(biu.mutation.EventFileIDs()) > 0 {
		return errors.New(`ent: clearing a required unique edge "BazelInvocation.event_file"`)
	}
	return nil
}

func (biu *BazelInvocationUpdate) sqlSave(ctx context.Context) (n int, err error) {
	if err := biu.check(); err != nil {
		return n, err
	}
	_spec := sqlgraph.NewUpdateSpec(bazelinvocation.Table, bazelinvocation.Columns, sqlgraph.NewFieldSpec(bazelinvocation.FieldID, field.TypeInt))
	if ps := biu.mutation.predicates; len(ps) > 0 {
		_spec.Predicate = func(selector *sql.Selector) {
			for i := range ps {
				ps[i](selector)
			}
		}
	}
	if value, ok := biu.mutation.StartedAt(); ok {
		_spec.SetField(bazelinvocation.FieldStartedAt, field.TypeTime, value)
	}
	if value, ok := biu.mutation.EndedAt(); ok {
		_spec.SetField(bazelinvocation.FieldEndedAt, field.TypeTime, value)
	}
	if biu.mutation.EndedAtCleared() {
		_spec.ClearField(bazelinvocation.FieldEndedAt, field.TypeTime)
	}
	if value, ok := biu.mutation.ChangeNumber(); ok {
		_spec.SetField(bazelinvocation.FieldChangeNumber, field.TypeInt, value)
	}
	if value, ok := biu.mutation.AddedChangeNumber(); ok {
		_spec.AddField(bazelinvocation.FieldChangeNumber, field.TypeInt, value)
	}
	if biu.mutation.ChangeNumberCleared() {
		_spec.ClearField(bazelinvocation.FieldChangeNumber, field.TypeInt)
	}
	if value, ok := biu.mutation.PatchsetNumber(); ok {
		_spec.SetField(bazelinvocation.FieldPatchsetNumber, field.TypeInt, value)
	}
	if value, ok := biu.mutation.AddedPatchsetNumber(); ok {
		_spec.AddField(bazelinvocation.FieldPatchsetNumber, field.TypeInt, value)
	}
	if biu.mutation.PatchsetNumberCleared() {
		_spec.ClearField(bazelinvocation.FieldPatchsetNumber, field.TypeInt)
	}
	if value, ok := biu.mutation.Summary(); ok {
		_spec.SetField(bazelinvocation.FieldSummary, field.TypeJSON, value)
	}
	if value, ok := biu.mutation.BepCompleted(); ok {
		_spec.SetField(bazelinvocation.FieldBepCompleted, field.TypeBool, value)
	}
	if biu.mutation.BepCompletedCleared() {
		_spec.ClearField(bazelinvocation.FieldBepCompleted, field.TypeBool)
	}
	if value, ok := biu.mutation.StepLabel(); ok {
		_spec.SetField(bazelinvocation.FieldStepLabel, field.TypeString, value)
	}
	if value, ok := biu.mutation.RelatedFiles(); ok {
		_spec.SetField(bazelinvocation.FieldRelatedFiles, field.TypeJSON, value)
	}
	if value, ok := biu.mutation.UserEmail(); ok {
		_spec.SetField(bazelinvocation.FieldUserEmail, field.TypeString, value)
	}
	if biu.mutation.UserEmailCleared() {
		_spec.ClearField(bazelinvocation.FieldUserEmail, field.TypeString)
	}
	if value, ok := biu.mutation.UserLdap(); ok {
		_spec.SetField(bazelinvocation.FieldUserLdap, field.TypeString, value)
	}
	if biu.mutation.UserLdapCleared() {
		_spec.ClearField(bazelinvocation.FieldUserLdap, field.TypeString)
	}
	if value, ok := biu.mutation.BuildLogs(); ok {
		_spec.SetField(bazelinvocation.FieldBuildLogs, field.TypeString, value)
	}
	if biu.mutation.BuildLogsCleared() {
		_spec.ClearField(bazelinvocation.FieldBuildLogs, field.TypeString)
	}
	if value, ok := biu.mutation.CPU(); ok {
		_spec.SetField(bazelinvocation.FieldCPU, field.TypeString, value)
	}
	if biu.mutation.CPUCleared() {
		_spec.ClearField(bazelinvocation.FieldCPU, field.TypeString)
	}
	if value, ok := biu.mutation.PlatformName(); ok {
		_spec.SetField(bazelinvocation.FieldPlatformName, field.TypeString, value)
	}
	if biu.mutation.PlatformNameCleared() {
		_spec.ClearField(bazelinvocation.FieldPlatformName, field.TypeString)
	}
	if value, ok := biu.mutation.Hostname(); ok {
		_spec.SetField(bazelinvocation.FieldHostname, field.TypeString, value)
	}
	if biu.mutation.HostnameCleared() {
		_spec.ClearField(bazelinvocation.FieldHostname, field.TypeString)
	}
	if value, ok := biu.mutation.IsCiWorker(); ok {
		_spec.SetField(bazelinvocation.FieldIsCiWorker, field.TypeBool, value)
	}
	if biu.mutation.IsCiWorkerCleared() {
		_spec.ClearField(bazelinvocation.FieldIsCiWorker, field.TypeBool)
	}
	if value, ok := biu.mutation.ConfigurationMnemonic(); ok {
		_spec.SetField(bazelinvocation.FieldConfigurationMnemonic, field.TypeString, value)
	}
	if biu.mutation.ConfigurationMnemonicCleared() {
		_spec.ClearField(bazelinvocation.FieldConfigurationMnemonic, field.TypeString)
	}
	if value, ok := biu.mutation.NumFetches(); ok {
		_spec.SetField(bazelinvocation.FieldNumFetches, field.TypeInt64, value)
	}
	if value, ok := biu.mutation.AddedNumFetches(); ok {
		_spec.AddField(bazelinvocation.FieldNumFetches, field.TypeInt64, value)
	}
	if biu.mutation.NumFetchesCleared() {
		_spec.ClearField(bazelinvocation.FieldNumFetches, field.TypeInt64)
	}
	if value, ok := biu.mutation.ProfileName(); ok {
		_spec.SetField(bazelinvocation.FieldProfileName, field.TypeString, value)
	}
	if value, ok := biu.mutation.InstanceName(); ok {
		_spec.SetField(bazelinvocation.FieldInstanceName, field.TypeString, value)
	}
	if biu.mutation.InstanceNameCleared() {
		_spec.ClearField(bazelinvocation.FieldInstanceName, field.TypeString)
	}
	if biu.mutation.EventFileCleared() {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2O,
			Inverse: true,
			Table:   bazelinvocation.EventFileTable,
			Columns: []string{bazelinvocation.EventFileColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(eventfile.FieldID, field.TypeInt),
			},
		}
		_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
	}
	if nodes := biu.mutation.EventFileIDs(); len(nodes) > 0 {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2O,
			Inverse: true,
			Table:   bazelinvocation.EventFileTable,
			Columns: []string{bazelinvocation.EventFileColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(eventfile.FieldID, field.TypeInt),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_spec.Edges.Add = append(_spec.Edges.Add, edge)
	}
	if biu.mutation.BuildCleared() {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.M2O,
			Inverse: true,
			Table:   bazelinvocation.BuildTable,
			Columns: []string{bazelinvocation.BuildColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(build.FieldID, field.TypeInt),
			},
		}
		_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
	}
	if nodes := biu.mutation.BuildIDs(); len(nodes) > 0 {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.M2O,
			Inverse: true,
			Table:   bazelinvocation.BuildTable,
			Columns: []string{bazelinvocation.BuildColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(build.FieldID, field.TypeInt),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_spec.Edges.Add = append(_spec.Edges.Add, edge)
	}
	if biu.mutation.ProblemsCleared() {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2M,
			Inverse: false,
			Table:   bazelinvocation.ProblemsTable,
			Columns: []string{bazelinvocation.ProblemsColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(bazelinvocationproblem.FieldID, field.TypeInt),
			},
		}
		_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
	}
	if nodes := biu.mutation.RemovedProblemsIDs(); len(nodes) > 0 && !biu.mutation.ProblemsCleared() {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2M,
			Inverse: false,
			Table:   bazelinvocation.ProblemsTable,
			Columns: []string{bazelinvocation.ProblemsColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(bazelinvocationproblem.FieldID, field.TypeInt),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
	}
	if nodes := biu.mutation.ProblemsIDs(); len(nodes) > 0 {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2M,
			Inverse: false,
			Table:   bazelinvocation.ProblemsTable,
			Columns: []string{bazelinvocation.ProblemsColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(bazelinvocationproblem.FieldID, field.TypeInt),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_spec.Edges.Add = append(_spec.Edges.Add, edge)
	}
	if biu.mutation.MetricsCleared() {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2O,
			Inverse: false,
			Table:   bazelinvocation.MetricsTable,
			Columns: []string{bazelinvocation.MetricsColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(metrics.FieldID, field.TypeInt),
			},
		}
		_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
	}
	if nodes := biu.mutation.MetricsIDs(); len(nodes) > 0 {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2O,
			Inverse: false,
			Table:   bazelinvocation.MetricsTable,
			Columns: []string{bazelinvocation.MetricsColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(metrics.FieldID, field.TypeInt),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_spec.Edges.Add = append(_spec.Edges.Add, edge)
	}
	if biu.mutation.TestCollectionCleared() {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2M,
			Inverse: false,
			Table:   bazelinvocation.TestCollectionTable,
			Columns: []string{bazelinvocation.TestCollectionColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(testcollection.FieldID, field.TypeInt),
			},
		}
		_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
	}
	if nodes := biu.mutation.RemovedTestCollectionIDs(); len(nodes) > 0 && !biu.mutation.TestCollectionCleared() {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2M,
			Inverse: false,
			Table:   bazelinvocation.TestCollectionTable,
			Columns: []string{bazelinvocation.TestCollectionColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(testcollection.FieldID, field.TypeInt),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
	}
	if nodes := biu.mutation.TestCollectionIDs(); len(nodes) > 0 {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2M,
			Inverse: false,
			Table:   bazelinvocation.TestCollectionTable,
			Columns: []string{bazelinvocation.TestCollectionColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(testcollection.FieldID, field.TypeInt),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_spec.Edges.Add = append(_spec.Edges.Add, edge)
	}
	if biu.mutation.TargetsCleared() {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2M,
			Inverse: false,
			Table:   bazelinvocation.TargetsTable,
			Columns: []string{bazelinvocation.TargetsColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(targetpair.FieldID, field.TypeInt),
			},
		}
		_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
	}
	if nodes := biu.mutation.RemovedTargetsIDs(); len(nodes) > 0 && !biu.mutation.TargetsCleared() {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2M,
			Inverse: false,
			Table:   bazelinvocation.TargetsTable,
			Columns: []string{bazelinvocation.TargetsColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(targetpair.FieldID, field.TypeInt),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
	}
	if nodes := biu.mutation.TargetsIDs(); len(nodes) > 0 {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2M,
			Inverse: false,
			Table:   bazelinvocation.TargetsTable,
			Columns: []string{bazelinvocation.TargetsColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(targetpair.FieldID, field.TypeInt),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_spec.Edges.Add = append(_spec.Edges.Add, edge)
	}
	if biu.mutation.SourceControlCleared() {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2O,
			Inverse: false,
			Table:   bazelinvocation.SourceControlTable,
			Columns: []string{bazelinvocation.SourceControlColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(sourcecontrol.FieldID, field.TypeInt),
			},
		}
		_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
	}
	if nodes := biu.mutation.SourceControlIDs(); len(nodes) > 0 {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2O,
			Inverse: false,
			Table:   bazelinvocation.SourceControlTable,
			Columns: []string{bazelinvocation.SourceControlColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(sourcecontrol.FieldID, field.TypeInt),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_spec.Edges.Add = append(_spec.Edges.Add, edge)
	}
	if n, err = sqlgraph.UpdateNodes(ctx, biu.driver, _spec); err != nil {
		if _, ok := err.(*sqlgraph.NotFoundError); ok {
			err = &NotFoundError{bazelinvocation.Label}
		} else if sqlgraph.IsConstraintError(err) {
			err = &ConstraintError{msg: err.Error(), wrap: err}
		}
		return 0, err
	}
	biu.mutation.done = true
	return n, nil
}

// BazelInvocationUpdateOne is the builder for updating a single BazelInvocation entity.
type BazelInvocationUpdateOne struct {
	config
	fields   []string
	hooks    []Hook
	mutation *BazelInvocationMutation
}

// SetStartedAt sets the "started_at" field.
func (biuo *BazelInvocationUpdateOne) SetStartedAt(t time.Time) *BazelInvocationUpdateOne {
	biuo.mutation.SetStartedAt(t)
	return biuo
}

// SetNillableStartedAt sets the "started_at" field if the given value is not nil.
func (biuo *BazelInvocationUpdateOne) SetNillableStartedAt(t *time.Time) *BazelInvocationUpdateOne {
	if t != nil {
		biuo.SetStartedAt(*t)
	}
	return biuo
}

// SetEndedAt sets the "ended_at" field.
func (biuo *BazelInvocationUpdateOne) SetEndedAt(t time.Time) *BazelInvocationUpdateOne {
	biuo.mutation.SetEndedAt(t)
	return biuo
}

// SetNillableEndedAt sets the "ended_at" field if the given value is not nil.
func (biuo *BazelInvocationUpdateOne) SetNillableEndedAt(t *time.Time) *BazelInvocationUpdateOne {
	if t != nil {
		biuo.SetEndedAt(*t)
	}
	return biuo
}

// ClearEndedAt clears the value of the "ended_at" field.
func (biuo *BazelInvocationUpdateOne) ClearEndedAt() *BazelInvocationUpdateOne {
	biuo.mutation.ClearEndedAt()
	return biuo
}

// SetChangeNumber sets the "change_number" field.
func (biuo *BazelInvocationUpdateOne) SetChangeNumber(i int) *BazelInvocationUpdateOne {
	biuo.mutation.ResetChangeNumber()
	biuo.mutation.SetChangeNumber(i)
	return biuo
}

// SetNillableChangeNumber sets the "change_number" field if the given value is not nil.
func (biuo *BazelInvocationUpdateOne) SetNillableChangeNumber(i *int) *BazelInvocationUpdateOne {
	if i != nil {
		biuo.SetChangeNumber(*i)
	}
	return biuo
}

// AddChangeNumber adds i to the "change_number" field.
func (biuo *BazelInvocationUpdateOne) AddChangeNumber(i int) *BazelInvocationUpdateOne {
	biuo.mutation.AddChangeNumber(i)
	return biuo
}

// ClearChangeNumber clears the value of the "change_number" field.
func (biuo *BazelInvocationUpdateOne) ClearChangeNumber() *BazelInvocationUpdateOne {
	biuo.mutation.ClearChangeNumber()
	return biuo
}

// SetPatchsetNumber sets the "patchset_number" field.
func (biuo *BazelInvocationUpdateOne) SetPatchsetNumber(i int) *BazelInvocationUpdateOne {
	biuo.mutation.ResetPatchsetNumber()
	biuo.mutation.SetPatchsetNumber(i)
	return biuo
}

// SetNillablePatchsetNumber sets the "patchset_number" field if the given value is not nil.
func (biuo *BazelInvocationUpdateOne) SetNillablePatchsetNumber(i *int) *BazelInvocationUpdateOne {
	if i != nil {
		biuo.SetPatchsetNumber(*i)
	}
	return biuo
}

// AddPatchsetNumber adds i to the "patchset_number" field.
func (biuo *BazelInvocationUpdateOne) AddPatchsetNumber(i int) *BazelInvocationUpdateOne {
	biuo.mutation.AddPatchsetNumber(i)
	return biuo
}

// ClearPatchsetNumber clears the value of the "patchset_number" field.
func (biuo *BazelInvocationUpdateOne) ClearPatchsetNumber() *BazelInvocationUpdateOne {
	biuo.mutation.ClearPatchsetNumber()
	return biuo
}

// SetSummary sets the "summary" field.
func (biuo *BazelInvocationUpdateOne) SetSummary(ss summary.InvocationSummary) *BazelInvocationUpdateOne {
	biuo.mutation.SetSummary(ss)
	return biuo
}

// SetNillableSummary sets the "summary" field if the given value is not nil.
func (biuo *BazelInvocationUpdateOne) SetNillableSummary(ss *summary.InvocationSummary) *BazelInvocationUpdateOne {
	if ss != nil {
		biuo.SetSummary(*ss)
	}
	return biuo
}

// SetBepCompleted sets the "bep_completed" field.
func (biuo *BazelInvocationUpdateOne) SetBepCompleted(b bool) *BazelInvocationUpdateOne {
	biuo.mutation.SetBepCompleted(b)
	return biuo
}

// SetNillableBepCompleted sets the "bep_completed" field if the given value is not nil.
func (biuo *BazelInvocationUpdateOne) SetNillableBepCompleted(b *bool) *BazelInvocationUpdateOne {
	if b != nil {
		biuo.SetBepCompleted(*b)
	}
	return biuo
}

// ClearBepCompleted clears the value of the "bep_completed" field.
func (biuo *BazelInvocationUpdateOne) ClearBepCompleted() *BazelInvocationUpdateOne {
	biuo.mutation.ClearBepCompleted()
	return biuo
}

// SetStepLabel sets the "step_label" field.
func (biuo *BazelInvocationUpdateOne) SetStepLabel(s string) *BazelInvocationUpdateOne {
	biuo.mutation.SetStepLabel(s)
	return biuo
}

// SetNillableStepLabel sets the "step_label" field if the given value is not nil.
func (biuo *BazelInvocationUpdateOne) SetNillableStepLabel(s *string) *BazelInvocationUpdateOne {
	if s != nil {
		biuo.SetStepLabel(*s)
	}
	return biuo
}

// SetRelatedFiles sets the "related_files" field.
func (biuo *BazelInvocationUpdateOne) SetRelatedFiles(m map[string]string) *BazelInvocationUpdateOne {
	biuo.mutation.SetRelatedFiles(m)
	return biuo
}

// SetUserEmail sets the "user_email" field.
func (biuo *BazelInvocationUpdateOne) SetUserEmail(s string) *BazelInvocationUpdateOne {
	biuo.mutation.SetUserEmail(s)
	return biuo
}

// SetNillableUserEmail sets the "user_email" field if the given value is not nil.
func (biuo *BazelInvocationUpdateOne) SetNillableUserEmail(s *string) *BazelInvocationUpdateOne {
	if s != nil {
		biuo.SetUserEmail(*s)
	}
	return biuo
}

// ClearUserEmail clears the value of the "user_email" field.
func (biuo *BazelInvocationUpdateOne) ClearUserEmail() *BazelInvocationUpdateOne {
	biuo.mutation.ClearUserEmail()
	return biuo
}

// SetUserLdap sets the "user_ldap" field.
func (biuo *BazelInvocationUpdateOne) SetUserLdap(s string) *BazelInvocationUpdateOne {
	biuo.mutation.SetUserLdap(s)
	return biuo
}

// SetNillableUserLdap sets the "user_ldap" field if the given value is not nil.
func (biuo *BazelInvocationUpdateOne) SetNillableUserLdap(s *string) *BazelInvocationUpdateOne {
	if s != nil {
		biuo.SetUserLdap(*s)
	}
	return biuo
}

// ClearUserLdap clears the value of the "user_ldap" field.
func (biuo *BazelInvocationUpdateOne) ClearUserLdap() *BazelInvocationUpdateOne {
	biuo.mutation.ClearUserLdap()
	return biuo
}

// SetBuildLogs sets the "build_logs" field.
func (biuo *BazelInvocationUpdateOne) SetBuildLogs(s string) *BazelInvocationUpdateOne {
	biuo.mutation.SetBuildLogs(s)
	return biuo
}

// SetNillableBuildLogs sets the "build_logs" field if the given value is not nil.
func (biuo *BazelInvocationUpdateOne) SetNillableBuildLogs(s *string) *BazelInvocationUpdateOne {
	if s != nil {
		biuo.SetBuildLogs(*s)
	}
	return biuo
}

// ClearBuildLogs clears the value of the "build_logs" field.
func (biuo *BazelInvocationUpdateOne) ClearBuildLogs() *BazelInvocationUpdateOne {
	biuo.mutation.ClearBuildLogs()
	return biuo
}

// SetCPU sets the "cpu" field.
func (biuo *BazelInvocationUpdateOne) SetCPU(s string) *BazelInvocationUpdateOne {
	biuo.mutation.SetCPU(s)
	return biuo
}

// SetNillableCPU sets the "cpu" field if the given value is not nil.
func (biuo *BazelInvocationUpdateOne) SetNillableCPU(s *string) *BazelInvocationUpdateOne {
	if s != nil {
		biuo.SetCPU(*s)
	}
	return biuo
}

// ClearCPU clears the value of the "cpu" field.
func (biuo *BazelInvocationUpdateOne) ClearCPU() *BazelInvocationUpdateOne {
	biuo.mutation.ClearCPU()
	return biuo
}

// SetPlatformName sets the "platform_name" field.
func (biuo *BazelInvocationUpdateOne) SetPlatformName(s string) *BazelInvocationUpdateOne {
	biuo.mutation.SetPlatformName(s)
	return biuo
}

// SetNillablePlatformName sets the "platform_name" field if the given value is not nil.
func (biuo *BazelInvocationUpdateOne) SetNillablePlatformName(s *string) *BazelInvocationUpdateOne {
	if s != nil {
		biuo.SetPlatformName(*s)
	}
	return biuo
}

// ClearPlatformName clears the value of the "platform_name" field.
func (biuo *BazelInvocationUpdateOne) ClearPlatformName() *BazelInvocationUpdateOne {
	biuo.mutation.ClearPlatformName()
	return biuo
}

// SetHostname sets the "hostname" field.
func (biuo *BazelInvocationUpdateOne) SetHostname(s string) *BazelInvocationUpdateOne {
	biuo.mutation.SetHostname(s)
	return biuo
}

// SetNillableHostname sets the "hostname" field if the given value is not nil.
func (biuo *BazelInvocationUpdateOne) SetNillableHostname(s *string) *BazelInvocationUpdateOne {
	if s != nil {
		biuo.SetHostname(*s)
	}
	return biuo
}

// ClearHostname clears the value of the "hostname" field.
func (biuo *BazelInvocationUpdateOne) ClearHostname() *BazelInvocationUpdateOne {
	biuo.mutation.ClearHostname()
	return biuo
}

// SetIsCiWorker sets the "is_ci_worker" field.
func (biuo *BazelInvocationUpdateOne) SetIsCiWorker(b bool) *BazelInvocationUpdateOne {
	biuo.mutation.SetIsCiWorker(b)
	return biuo
}

// SetNillableIsCiWorker sets the "is_ci_worker" field if the given value is not nil.
func (biuo *BazelInvocationUpdateOne) SetNillableIsCiWorker(b *bool) *BazelInvocationUpdateOne {
	if b != nil {
		biuo.SetIsCiWorker(*b)
	}
	return biuo
}

// ClearIsCiWorker clears the value of the "is_ci_worker" field.
func (biuo *BazelInvocationUpdateOne) ClearIsCiWorker() *BazelInvocationUpdateOne {
	biuo.mutation.ClearIsCiWorker()
	return biuo
}

// SetConfigurationMnemonic sets the "configuration_mnemonic" field.
func (biuo *BazelInvocationUpdateOne) SetConfigurationMnemonic(s string) *BazelInvocationUpdateOne {
	biuo.mutation.SetConfigurationMnemonic(s)
	return biuo
}

// SetNillableConfigurationMnemonic sets the "configuration_mnemonic" field if the given value is not nil.
func (biuo *BazelInvocationUpdateOne) SetNillableConfigurationMnemonic(s *string) *BazelInvocationUpdateOne {
	if s != nil {
		biuo.SetConfigurationMnemonic(*s)
	}
	return biuo
}

// ClearConfigurationMnemonic clears the value of the "configuration_mnemonic" field.
func (biuo *BazelInvocationUpdateOne) ClearConfigurationMnemonic() *BazelInvocationUpdateOne {
	biuo.mutation.ClearConfigurationMnemonic()
	return biuo
}

// SetNumFetches sets the "num_fetches" field.
func (biuo *BazelInvocationUpdateOne) SetNumFetches(i int64) *BazelInvocationUpdateOne {
	biuo.mutation.ResetNumFetches()
	biuo.mutation.SetNumFetches(i)
	return biuo
}

// SetNillableNumFetches sets the "num_fetches" field if the given value is not nil.
func (biuo *BazelInvocationUpdateOne) SetNillableNumFetches(i *int64) *BazelInvocationUpdateOne {
	if i != nil {
		biuo.SetNumFetches(*i)
	}
	return biuo
}

// AddNumFetches adds i to the "num_fetches" field.
func (biuo *BazelInvocationUpdateOne) AddNumFetches(i int64) *BazelInvocationUpdateOne {
	biuo.mutation.AddNumFetches(i)
	return biuo
}

// ClearNumFetches clears the value of the "num_fetches" field.
func (biuo *BazelInvocationUpdateOne) ClearNumFetches() *BazelInvocationUpdateOne {
	biuo.mutation.ClearNumFetches()
	return biuo
}

// SetProfileName sets the "profile_name" field.
func (biuo *BazelInvocationUpdateOne) SetProfileName(s string) *BazelInvocationUpdateOne {
	biuo.mutation.SetProfileName(s)
	return biuo
}

// SetNillableProfileName sets the "profile_name" field if the given value is not nil.
func (biuo *BazelInvocationUpdateOne) SetNillableProfileName(s *string) *BazelInvocationUpdateOne {
	if s != nil {
		biuo.SetProfileName(*s)
	}
	return biuo
}

// SetInstanceName sets the "instance_name" field.
func (biuo *BazelInvocationUpdateOne) SetInstanceName(s string) *BazelInvocationUpdateOne {
	biuo.mutation.SetInstanceName(s)
	return biuo
}

// SetNillableInstanceName sets the "instance_name" field if the given value is not nil.
func (biuo *BazelInvocationUpdateOne) SetNillableInstanceName(s *string) *BazelInvocationUpdateOne {
	if s != nil {
		biuo.SetInstanceName(*s)
	}
	return biuo
}

// ClearInstanceName clears the value of the "instance_name" field.
func (biuo *BazelInvocationUpdateOne) ClearInstanceName() *BazelInvocationUpdateOne {
	biuo.mutation.ClearInstanceName()
	return biuo
}

// SetEventFileID sets the "event_file" edge to the EventFile entity by ID.
func (biuo *BazelInvocationUpdateOne) SetEventFileID(id int) *BazelInvocationUpdateOne {
	biuo.mutation.SetEventFileID(id)
	return biuo
}

// SetEventFile sets the "event_file" edge to the EventFile entity.
func (biuo *BazelInvocationUpdateOne) SetEventFile(e *EventFile) *BazelInvocationUpdateOne {
	return biuo.SetEventFileID(e.ID)
}

// SetBuildID sets the "build" edge to the Build entity by ID.
func (biuo *BazelInvocationUpdateOne) SetBuildID(id int) *BazelInvocationUpdateOne {
	biuo.mutation.SetBuildID(id)
	return biuo
}

// SetNillableBuildID sets the "build" edge to the Build entity by ID if the given value is not nil.
func (biuo *BazelInvocationUpdateOne) SetNillableBuildID(id *int) *BazelInvocationUpdateOne {
	if id != nil {
		biuo = biuo.SetBuildID(*id)
	}
	return biuo
}

// SetBuild sets the "build" edge to the Build entity.
func (biuo *BazelInvocationUpdateOne) SetBuild(b *Build) *BazelInvocationUpdateOne {
	return biuo.SetBuildID(b.ID)
}

// AddProblemIDs adds the "problems" edge to the BazelInvocationProblem entity by IDs.
func (biuo *BazelInvocationUpdateOne) AddProblemIDs(ids ...int) *BazelInvocationUpdateOne {
	biuo.mutation.AddProblemIDs(ids...)
	return biuo
}

// AddProblems adds the "problems" edges to the BazelInvocationProblem entity.
func (biuo *BazelInvocationUpdateOne) AddProblems(b ...*BazelInvocationProblem) *BazelInvocationUpdateOne {
	ids := make([]int, len(b))
	for i := range b {
		ids[i] = b[i].ID
	}
	return biuo.AddProblemIDs(ids...)
}

// SetMetricsID sets the "metrics" edge to the Metrics entity by ID.
func (biuo *BazelInvocationUpdateOne) SetMetricsID(id int) *BazelInvocationUpdateOne {
	biuo.mutation.SetMetricsID(id)
	return biuo
}

// SetNillableMetricsID sets the "metrics" edge to the Metrics entity by ID if the given value is not nil.
func (biuo *BazelInvocationUpdateOne) SetNillableMetricsID(id *int) *BazelInvocationUpdateOne {
	if id != nil {
		biuo = biuo.SetMetricsID(*id)
	}
	return biuo
}

// SetMetrics sets the "metrics" edge to the Metrics entity.
func (biuo *BazelInvocationUpdateOne) SetMetrics(m *Metrics) *BazelInvocationUpdateOne {
	return biuo.SetMetricsID(m.ID)
}

// AddTestCollectionIDs adds the "test_collection" edge to the TestCollection entity by IDs.
func (biuo *BazelInvocationUpdateOne) AddTestCollectionIDs(ids ...int) *BazelInvocationUpdateOne {
	biuo.mutation.AddTestCollectionIDs(ids...)
	return biuo
}

// AddTestCollection adds the "test_collection" edges to the TestCollection entity.
func (biuo *BazelInvocationUpdateOne) AddTestCollection(t ...*TestCollection) *BazelInvocationUpdateOne {
	ids := make([]int, len(t))
	for i := range t {
		ids[i] = t[i].ID
	}
	return biuo.AddTestCollectionIDs(ids...)
}

// AddTargetIDs adds the "targets" edge to the TargetPair entity by IDs.
func (biuo *BazelInvocationUpdateOne) AddTargetIDs(ids ...int) *BazelInvocationUpdateOne {
	biuo.mutation.AddTargetIDs(ids...)
	return biuo
}

// AddTargets adds the "targets" edges to the TargetPair entity.
func (biuo *BazelInvocationUpdateOne) AddTargets(t ...*TargetPair) *BazelInvocationUpdateOne {
	ids := make([]int, len(t))
	for i := range t {
		ids[i] = t[i].ID
	}
	return biuo.AddTargetIDs(ids...)
}

// SetSourceControlID sets the "source_control" edge to the SourceControl entity by ID.
func (biuo *BazelInvocationUpdateOne) SetSourceControlID(id int) *BazelInvocationUpdateOne {
	biuo.mutation.SetSourceControlID(id)
	return biuo
}

// SetNillableSourceControlID sets the "source_control" edge to the SourceControl entity by ID if the given value is not nil.
func (biuo *BazelInvocationUpdateOne) SetNillableSourceControlID(id *int) *BazelInvocationUpdateOne {
	if id != nil {
		biuo = biuo.SetSourceControlID(*id)
	}
	return biuo
}

// SetSourceControl sets the "source_control" edge to the SourceControl entity.
func (biuo *BazelInvocationUpdateOne) SetSourceControl(s *SourceControl) *BazelInvocationUpdateOne {
	return biuo.SetSourceControlID(s.ID)
}

// Mutation returns the BazelInvocationMutation object of the builder.
func (biuo *BazelInvocationUpdateOne) Mutation() *BazelInvocationMutation {
	return biuo.mutation
}

// ClearEventFile clears the "event_file" edge to the EventFile entity.
func (biuo *BazelInvocationUpdateOne) ClearEventFile() *BazelInvocationUpdateOne {
	biuo.mutation.ClearEventFile()
	return biuo
}

// ClearBuild clears the "build" edge to the Build entity.
func (biuo *BazelInvocationUpdateOne) ClearBuild() *BazelInvocationUpdateOne {
	biuo.mutation.ClearBuild()
	return biuo
}

// ClearProblems clears all "problems" edges to the BazelInvocationProblem entity.
func (biuo *BazelInvocationUpdateOne) ClearProblems() *BazelInvocationUpdateOne {
	biuo.mutation.ClearProblems()
	return biuo
}

// RemoveProblemIDs removes the "problems" edge to BazelInvocationProblem entities by IDs.
func (biuo *BazelInvocationUpdateOne) RemoveProblemIDs(ids ...int) *BazelInvocationUpdateOne {
	biuo.mutation.RemoveProblemIDs(ids...)
	return biuo
}

// RemoveProblems removes "problems" edges to BazelInvocationProblem entities.
func (biuo *BazelInvocationUpdateOne) RemoveProblems(b ...*BazelInvocationProblem) *BazelInvocationUpdateOne {
	ids := make([]int, len(b))
	for i := range b {
		ids[i] = b[i].ID
	}
	return biuo.RemoveProblemIDs(ids...)
}

// ClearMetrics clears the "metrics" edge to the Metrics entity.
func (biuo *BazelInvocationUpdateOne) ClearMetrics() *BazelInvocationUpdateOne {
	biuo.mutation.ClearMetrics()
	return biuo
}

// ClearTestCollection clears all "test_collection" edges to the TestCollection entity.
func (biuo *BazelInvocationUpdateOne) ClearTestCollection() *BazelInvocationUpdateOne {
	biuo.mutation.ClearTestCollection()
	return biuo
}

// RemoveTestCollectionIDs removes the "test_collection" edge to TestCollection entities by IDs.
func (biuo *BazelInvocationUpdateOne) RemoveTestCollectionIDs(ids ...int) *BazelInvocationUpdateOne {
	biuo.mutation.RemoveTestCollectionIDs(ids...)
	return biuo
}

// RemoveTestCollection removes "test_collection" edges to TestCollection entities.
func (biuo *BazelInvocationUpdateOne) RemoveTestCollection(t ...*TestCollection) *BazelInvocationUpdateOne {
	ids := make([]int, len(t))
	for i := range t {
		ids[i] = t[i].ID
	}
	return biuo.RemoveTestCollectionIDs(ids...)
}

// ClearTargets clears all "targets" edges to the TargetPair entity.
func (biuo *BazelInvocationUpdateOne) ClearTargets() *BazelInvocationUpdateOne {
	biuo.mutation.ClearTargets()
	return biuo
}

// RemoveTargetIDs removes the "targets" edge to TargetPair entities by IDs.
func (biuo *BazelInvocationUpdateOne) RemoveTargetIDs(ids ...int) *BazelInvocationUpdateOne {
	biuo.mutation.RemoveTargetIDs(ids...)
	return biuo
}

// RemoveTargets removes "targets" edges to TargetPair entities.
func (biuo *BazelInvocationUpdateOne) RemoveTargets(t ...*TargetPair) *BazelInvocationUpdateOne {
	ids := make([]int, len(t))
	for i := range t {
		ids[i] = t[i].ID
	}
	return biuo.RemoveTargetIDs(ids...)
}

// ClearSourceControl clears the "source_control" edge to the SourceControl entity.
func (biuo *BazelInvocationUpdateOne) ClearSourceControl() *BazelInvocationUpdateOne {
	biuo.mutation.ClearSourceControl()
	return biuo
}

// Where appends a list predicates to the BazelInvocationUpdate builder.
func (biuo *BazelInvocationUpdateOne) Where(ps ...predicate.BazelInvocation) *BazelInvocationUpdateOne {
	biuo.mutation.Where(ps...)
	return biuo
}

// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
func (biuo *BazelInvocationUpdateOne) Select(field string, fields ...string) *BazelInvocationUpdateOne {
	biuo.fields = append([]string{field}, fields...)
	return biuo
}

// Save executes the query and returns the updated BazelInvocation entity.
func (biuo *BazelInvocationUpdateOne) Save(ctx context.Context) (*BazelInvocation, error) {
	return withHooks(ctx, biuo.sqlSave, biuo.mutation, biuo.hooks)
}

// SaveX is like Save, but panics if an error occurs.
func (biuo *BazelInvocationUpdateOne) SaveX(ctx context.Context) *BazelInvocation {
	node, err := biuo.Save(ctx)
	if err != nil {
		panic(err)
	}
	return node
}

// Exec executes the query on the entity.
func (biuo *BazelInvocationUpdateOne) Exec(ctx context.Context) error {
	_, err := biuo.Save(ctx)
	return err
}

// ExecX is like Exec, but panics if an error occurs.
func (biuo *BazelInvocationUpdateOne) ExecX(ctx context.Context) {
	if err := biuo.Exec(ctx); err != nil {
		panic(err)
	}
}

// check runs all checks and user-defined validators on the builder.
func (biuo *BazelInvocationUpdateOne) check() error {
	if biuo.mutation.EventFileCleared() && len(biuo.mutation.EventFileIDs()) > 0 {
		return errors.New(`ent: clearing a required unique edge "BazelInvocation.event_file"`)
	}
	return nil
}

func (biuo *BazelInvocationUpdateOne) sqlSave(ctx context.Context) (_node *BazelInvocation, err error) {
	if err := biuo.check(); err != nil {
		return _node, err
	}
	_spec := sqlgraph.NewUpdateSpec(bazelinvocation.Table, bazelinvocation.Columns, sqlgraph.NewFieldSpec(bazelinvocation.FieldID, field.TypeInt))
	id, ok := biuo.mutation.ID()
	if !ok {
		return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "BazelInvocation.id" for update`)}
	}
	_spec.Node.ID.Value = id
	if fields := biuo.fields; len(fields) > 0 {
		_spec.Node.Columns = make([]string, 0, len(fields))
		_spec.Node.Columns = append(_spec.Node.Columns, bazelinvocation.FieldID)
		for _, f := range fields {
			if !bazelinvocation.ValidColumn(f) {
				return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
			}
			if f != bazelinvocation.FieldID {
				_spec.Node.Columns = append(_spec.Node.Columns, f)
			}
		}
	}
	if ps := biuo.mutation.predicates; len(ps) > 0 {
		_spec.Predicate = func(selector *sql.Selector) {
			for i := range ps {
				ps[i](selector)
			}
		}
	}
	if value, ok := biuo.mutation.StartedAt(); ok {
		_spec.SetField(bazelinvocation.FieldStartedAt, field.TypeTime, value)
	}
	if value, ok := biuo.mutation.EndedAt(); ok {
		_spec.SetField(bazelinvocation.FieldEndedAt, field.TypeTime, value)
	}
	if biuo.mutation.EndedAtCleared() {
		_spec.ClearField(bazelinvocation.FieldEndedAt, field.TypeTime)
	}
	if value, ok := biuo.mutation.ChangeNumber(); ok {
		_spec.SetField(bazelinvocation.FieldChangeNumber, field.TypeInt, value)
	}
	if value, ok := biuo.mutation.AddedChangeNumber(); ok {
		_spec.AddField(bazelinvocation.FieldChangeNumber, field.TypeInt, value)
	}
	if biuo.mutation.ChangeNumberCleared() {
		_spec.ClearField(bazelinvocation.FieldChangeNumber, field.TypeInt)
	}
	if value, ok := biuo.mutation.PatchsetNumber(); ok {
		_spec.SetField(bazelinvocation.FieldPatchsetNumber, field.TypeInt, value)
	}
	if value, ok := biuo.mutation.AddedPatchsetNumber(); ok {
		_spec.AddField(bazelinvocation.FieldPatchsetNumber, field.TypeInt, value)
	}
	if biuo.mutation.PatchsetNumberCleared() {
		_spec.ClearField(bazelinvocation.FieldPatchsetNumber, field.TypeInt)
	}
	if value, ok := biuo.mutation.Summary(); ok {
		_spec.SetField(bazelinvocation.FieldSummary, field.TypeJSON, value)
	}
	if value, ok := biuo.mutation.BepCompleted(); ok {
		_spec.SetField(bazelinvocation.FieldBepCompleted, field.TypeBool, value)
	}
	if biuo.mutation.BepCompletedCleared() {
		_spec.ClearField(bazelinvocation.FieldBepCompleted, field.TypeBool)
	}
	if value, ok := biuo.mutation.StepLabel(); ok {
		_spec.SetField(bazelinvocation.FieldStepLabel, field.TypeString, value)
	}
	if value, ok := biuo.mutation.RelatedFiles(); ok {
		_spec.SetField(bazelinvocation.FieldRelatedFiles, field.TypeJSON, value)
	}
	if value, ok := biuo.mutation.UserEmail(); ok {
		_spec.SetField(bazelinvocation.FieldUserEmail, field.TypeString, value)
	}
	if biuo.mutation.UserEmailCleared() {
		_spec.ClearField(bazelinvocation.FieldUserEmail, field.TypeString)
	}
	if value, ok := biuo.mutation.UserLdap(); ok {
		_spec.SetField(bazelinvocation.FieldUserLdap, field.TypeString, value)
	}
	if biuo.mutation.UserLdapCleared() {
		_spec.ClearField(bazelinvocation.FieldUserLdap, field.TypeString)
	}
	if value, ok := biuo.mutation.BuildLogs(); ok {
		_spec.SetField(bazelinvocation.FieldBuildLogs, field.TypeString, value)
	}
	if biuo.mutation.BuildLogsCleared() {
		_spec.ClearField(bazelinvocation.FieldBuildLogs, field.TypeString)
	}
	if value, ok := biuo.mutation.CPU(); ok {
		_spec.SetField(bazelinvocation.FieldCPU, field.TypeString, value)
	}
	if biuo.mutation.CPUCleared() {
		_spec.ClearField(bazelinvocation.FieldCPU, field.TypeString)
	}
	if value, ok := biuo.mutation.PlatformName(); ok {
		_spec.SetField(bazelinvocation.FieldPlatformName, field.TypeString, value)
	}
	if biuo.mutation.PlatformNameCleared() {
		_spec.ClearField(bazelinvocation.FieldPlatformName, field.TypeString)
	}
	if value, ok := biuo.mutation.Hostname(); ok {
		_spec.SetField(bazelinvocation.FieldHostname, field.TypeString, value)
	}
	if biuo.mutation.HostnameCleared() {
		_spec.ClearField(bazelinvocation.FieldHostname, field.TypeString)
	}
	if value, ok := biuo.mutation.IsCiWorker(); ok {
		_spec.SetField(bazelinvocation.FieldIsCiWorker, field.TypeBool, value)
	}
	if biuo.mutation.IsCiWorkerCleared() {
		_spec.ClearField(bazelinvocation.FieldIsCiWorker, field.TypeBool)
	}
	if value, ok := biuo.mutation.ConfigurationMnemonic(); ok {
		_spec.SetField(bazelinvocation.FieldConfigurationMnemonic, field.TypeString, value)
	}
	if biuo.mutation.ConfigurationMnemonicCleared() {
		_spec.ClearField(bazelinvocation.FieldConfigurationMnemonic, field.TypeString)
	}
	if value, ok := biuo.mutation.NumFetches(); ok {
		_spec.SetField(bazelinvocation.FieldNumFetches, field.TypeInt64, value)
	}
	if value, ok := biuo.mutation.AddedNumFetches(); ok {
		_spec.AddField(bazelinvocation.FieldNumFetches, field.TypeInt64, value)
	}
	if biuo.mutation.NumFetchesCleared() {
		_spec.ClearField(bazelinvocation.FieldNumFetches, field.TypeInt64)
	}
	if value, ok := biuo.mutation.ProfileName(); ok {
		_spec.SetField(bazelinvocation.FieldProfileName, field.TypeString, value)
	}
	if value, ok := biuo.mutation.InstanceName(); ok {
		_spec.SetField(bazelinvocation.FieldInstanceName, field.TypeString, value)
	}
	if biuo.mutation.InstanceNameCleared() {
		_spec.ClearField(bazelinvocation.FieldInstanceName, field.TypeString)
	}
	if biuo.mutation.EventFileCleared() {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2O,
			Inverse: true,
			Table:   bazelinvocation.EventFileTable,
			Columns: []string{bazelinvocation.EventFileColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(eventfile.FieldID, field.TypeInt),
			},
		}
		_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
	}
	if nodes := biuo.mutation.EventFileIDs(); len(nodes) > 0 {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2O,
			Inverse: true,
			Table:   bazelinvocation.EventFileTable,
			Columns: []string{bazelinvocation.EventFileColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(eventfile.FieldID, field.TypeInt),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_spec.Edges.Add = append(_spec.Edges.Add, edge)
	}
	if biuo.mutation.BuildCleared() {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.M2O,
			Inverse: true,
			Table:   bazelinvocation.BuildTable,
			Columns: []string{bazelinvocation.BuildColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(build.FieldID, field.TypeInt),
			},
		}
		_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
	}
	if nodes := biuo.mutation.BuildIDs(); len(nodes) > 0 {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.M2O,
			Inverse: true,
			Table:   bazelinvocation.BuildTable,
			Columns: []string{bazelinvocation.BuildColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(build.FieldID, field.TypeInt),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_spec.Edges.Add = append(_spec.Edges.Add, edge)
	}
	if biuo.mutation.ProblemsCleared() {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2M,
			Inverse: false,
			Table:   bazelinvocation.ProblemsTable,
			Columns: []string{bazelinvocation.ProblemsColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(bazelinvocationproblem.FieldID, field.TypeInt),
			},
		}
		_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
	}
	if nodes := biuo.mutation.RemovedProblemsIDs(); len(nodes) > 0 && !biuo.mutation.ProblemsCleared() {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2M,
			Inverse: false,
			Table:   bazelinvocation.ProblemsTable,
			Columns: []string{bazelinvocation.ProblemsColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(bazelinvocationproblem.FieldID, field.TypeInt),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
	}
	if nodes := biuo.mutation.ProblemsIDs(); len(nodes) > 0 {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2M,
			Inverse: false,
			Table:   bazelinvocation.ProblemsTable,
			Columns: []string{bazelinvocation.ProblemsColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(bazelinvocationproblem.FieldID, field.TypeInt),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_spec.Edges.Add = append(_spec.Edges.Add, edge)
	}
	if biuo.mutation.MetricsCleared() {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2O,
			Inverse: false,
			Table:   bazelinvocation.MetricsTable,
			Columns: []string{bazelinvocation.MetricsColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(metrics.FieldID, field.TypeInt),
			},
		}
		_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
	}
	if nodes := biuo.mutation.MetricsIDs(); len(nodes) > 0 {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2O,
			Inverse: false,
			Table:   bazelinvocation.MetricsTable,
			Columns: []string{bazelinvocation.MetricsColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(metrics.FieldID, field.TypeInt),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_spec.Edges.Add = append(_spec.Edges.Add, edge)
	}
	if biuo.mutation.TestCollectionCleared() {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2M,
			Inverse: false,
			Table:   bazelinvocation.TestCollectionTable,
			Columns: []string{bazelinvocation.TestCollectionColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(testcollection.FieldID, field.TypeInt),
			},
		}
		_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
	}
	if nodes := biuo.mutation.RemovedTestCollectionIDs(); len(nodes) > 0 && !biuo.mutation.TestCollectionCleared() {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2M,
			Inverse: false,
			Table:   bazelinvocation.TestCollectionTable,
			Columns: []string{bazelinvocation.TestCollectionColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(testcollection.FieldID, field.TypeInt),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
	}
	if nodes := biuo.mutation.TestCollectionIDs(); len(nodes) > 0 {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2M,
			Inverse: false,
			Table:   bazelinvocation.TestCollectionTable,
			Columns: []string{bazelinvocation.TestCollectionColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(testcollection.FieldID, field.TypeInt),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_spec.Edges.Add = append(_spec.Edges.Add, edge)
	}
	if biuo.mutation.TargetsCleared() {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2M,
			Inverse: false,
			Table:   bazelinvocation.TargetsTable,
			Columns: []string{bazelinvocation.TargetsColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(targetpair.FieldID, field.TypeInt),
			},
		}
		_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
	}
	if nodes := biuo.mutation.RemovedTargetsIDs(); len(nodes) > 0 && !biuo.mutation.TargetsCleared() {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2M,
			Inverse: false,
			Table:   bazelinvocation.TargetsTable,
			Columns: []string{bazelinvocation.TargetsColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(targetpair.FieldID, field.TypeInt),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
	}
	if nodes := biuo.mutation.TargetsIDs(); len(nodes) > 0 {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2M,
			Inverse: false,
			Table:   bazelinvocation.TargetsTable,
			Columns: []string{bazelinvocation.TargetsColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(targetpair.FieldID, field.TypeInt),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_spec.Edges.Add = append(_spec.Edges.Add, edge)
	}
	if biuo.mutation.SourceControlCleared() {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2O,
			Inverse: false,
			Table:   bazelinvocation.SourceControlTable,
			Columns: []string{bazelinvocation.SourceControlColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(sourcecontrol.FieldID, field.TypeInt),
			},
		}
		_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
	}
	if nodes := biuo.mutation.SourceControlIDs(); len(nodes) > 0 {
		edge := &sqlgraph.EdgeSpec{
			Rel:     sqlgraph.O2O,
			Inverse: false,
			Table:   bazelinvocation.SourceControlTable,
			Columns: []string{bazelinvocation.SourceControlColumn},
			Bidi:    false,
			Target: &sqlgraph.EdgeTarget{
				IDSpec: sqlgraph.NewFieldSpec(sourcecontrol.FieldID, field.TypeInt),
			},
		}
		for _, k := range nodes {
			edge.Target.Nodes = append(edge.Target.Nodes, k)
		}
		_spec.Edges.Add = append(_spec.Edges.Add, edge)
	}
	_node = &BazelInvocation{config: biuo.config}
	_spec.Assign = _node.assignValues
	_spec.ScanValues = _node.scanValues
	if err = sqlgraph.UpdateNode(ctx, biuo.driver, _spec); err != nil {
		if _, ok := err.(*sqlgraph.NotFoundError); ok {
			err = &NotFoundError{bazelinvocation.Label}
		} else if sqlgraph.IsConstraintError(err) {
			err = &ConstraintError{msg: err.Error(), wrap: err}
		}
		return nil, err
	}
	biuo.mutation.done = true
	return _node, nil
}
