github.com/iasthc/atlas/cmd/atlas@v0.0.0-20230523071841-73246df3f88d/internal/migrate/ent/revision_update.go (about)

     1  // Copyright 2021-present The Atlas Authors. All rights reserved.
     2  // This source code is licensed under the Apache 2.0 license found
     3  // in the LICENSE file in the root directory of this source tree.
     4  
     5  // Code generated by entc, DO NOT EDIT.
     6  
     7  package ent
     8  
     9  import (
    10  	"context"
    11  	"errors"
    12  	"fmt"
    13  	"time"
    14  
    15  	"github.com/iasthc/atlas/cmd/atlas/internal/migrate/ent/internal"
    16  	"github.com/iasthc/atlas/cmd/atlas/internal/migrate/ent/predicate"
    17  	"github.com/iasthc/atlas/cmd/atlas/internal/migrate/ent/revision"
    18  	"github.com/iasthc/atlas/sql/migrate"
    19  	"entgo.io/ent/dialect/sql"
    20  	"entgo.io/ent/dialect/sql/sqlgraph"
    21  	"entgo.io/ent/dialect/sql/sqljson"
    22  	"entgo.io/ent/schema/field"
    23  )
    24  
    25  // RevisionUpdate is the builder for updating Revision entities.
    26  type RevisionUpdate struct {
    27  	config
    28  	hooks    []Hook
    29  	mutation *RevisionMutation
    30  }
    31  
    32  // Where appends a list predicates to the RevisionUpdate builder.
    33  func (ru *RevisionUpdate) Where(ps ...predicate.Revision) *RevisionUpdate {
    34  	ru.mutation.Where(ps...)
    35  	return ru
    36  }
    37  
    38  // SetType sets the "type" field.
    39  func (ru *RevisionUpdate) SetType(mt migrate.RevisionType) *RevisionUpdate {
    40  	ru.mutation.ResetType()
    41  	ru.mutation.SetType(mt)
    42  	return ru
    43  }
    44  
    45  // SetNillableType sets the "type" field if the given value is not nil.
    46  func (ru *RevisionUpdate) SetNillableType(mt *migrate.RevisionType) *RevisionUpdate {
    47  	if mt != nil {
    48  		ru.SetType(*mt)
    49  	}
    50  	return ru
    51  }
    52  
    53  // AddType adds mt to the "type" field.
    54  func (ru *RevisionUpdate) AddType(mt migrate.RevisionType) *RevisionUpdate {
    55  	ru.mutation.AddType(mt)
    56  	return ru
    57  }
    58  
    59  // SetApplied sets the "applied" field.
    60  func (ru *RevisionUpdate) SetApplied(i int) *RevisionUpdate {
    61  	ru.mutation.ResetApplied()
    62  	ru.mutation.SetApplied(i)
    63  	return ru
    64  }
    65  
    66  // SetNillableApplied sets the "applied" field if the given value is not nil.
    67  func (ru *RevisionUpdate) SetNillableApplied(i *int) *RevisionUpdate {
    68  	if i != nil {
    69  		ru.SetApplied(*i)
    70  	}
    71  	return ru
    72  }
    73  
    74  // AddApplied adds i to the "applied" field.
    75  func (ru *RevisionUpdate) AddApplied(i int) *RevisionUpdate {
    76  	ru.mutation.AddApplied(i)
    77  	return ru
    78  }
    79  
    80  // SetTotal sets the "total" field.
    81  func (ru *RevisionUpdate) SetTotal(i int) *RevisionUpdate {
    82  	ru.mutation.ResetTotal()
    83  	ru.mutation.SetTotal(i)
    84  	return ru
    85  }
    86  
    87  // SetNillableTotal sets the "total" field if the given value is not nil.
    88  func (ru *RevisionUpdate) SetNillableTotal(i *int) *RevisionUpdate {
    89  	if i != nil {
    90  		ru.SetTotal(*i)
    91  	}
    92  	return ru
    93  }
    94  
    95  // AddTotal adds i to the "total" field.
    96  func (ru *RevisionUpdate) AddTotal(i int) *RevisionUpdate {
    97  	ru.mutation.AddTotal(i)
    98  	return ru
    99  }
   100  
   101  // SetExecutionTime sets the "execution_time" field.
   102  func (ru *RevisionUpdate) SetExecutionTime(t time.Duration) *RevisionUpdate {
   103  	ru.mutation.ResetExecutionTime()
   104  	ru.mutation.SetExecutionTime(t)
   105  	return ru
   106  }
   107  
   108  // AddExecutionTime adds t to the "execution_time" field.
   109  func (ru *RevisionUpdate) AddExecutionTime(t time.Duration) *RevisionUpdate {
   110  	ru.mutation.AddExecutionTime(t)
   111  	return ru
   112  }
   113  
   114  // SetError sets the "error" field.
   115  func (ru *RevisionUpdate) SetError(s string) *RevisionUpdate {
   116  	ru.mutation.SetError(s)
   117  	return ru
   118  }
   119  
   120  // SetNillableError sets the "error" field if the given value is not nil.
   121  func (ru *RevisionUpdate) SetNillableError(s *string) *RevisionUpdate {
   122  	if s != nil {
   123  		ru.SetError(*s)
   124  	}
   125  	return ru
   126  }
   127  
   128  // ClearError clears the value of the "error" field.
   129  func (ru *RevisionUpdate) ClearError() *RevisionUpdate {
   130  	ru.mutation.ClearError()
   131  	return ru
   132  }
   133  
   134  // SetErrorStmt sets the "error_stmt" field.
   135  func (ru *RevisionUpdate) SetErrorStmt(s string) *RevisionUpdate {
   136  	ru.mutation.SetErrorStmt(s)
   137  	return ru
   138  }
   139  
   140  // SetNillableErrorStmt sets the "error_stmt" field if the given value is not nil.
   141  func (ru *RevisionUpdate) SetNillableErrorStmt(s *string) *RevisionUpdate {
   142  	if s != nil {
   143  		ru.SetErrorStmt(*s)
   144  	}
   145  	return ru
   146  }
   147  
   148  // ClearErrorStmt clears the value of the "error_stmt" field.
   149  func (ru *RevisionUpdate) ClearErrorStmt() *RevisionUpdate {
   150  	ru.mutation.ClearErrorStmt()
   151  	return ru
   152  }
   153  
   154  // SetHash sets the "hash" field.
   155  func (ru *RevisionUpdate) SetHash(s string) *RevisionUpdate {
   156  	ru.mutation.SetHash(s)
   157  	return ru
   158  }
   159  
   160  // SetPartialHashes sets the "partial_hashes" field.
   161  func (ru *RevisionUpdate) SetPartialHashes(s []string) *RevisionUpdate {
   162  	ru.mutation.SetPartialHashes(s)
   163  	return ru
   164  }
   165  
   166  // AppendPartialHashes appends s to the "partial_hashes" field.
   167  func (ru *RevisionUpdate) AppendPartialHashes(s []string) *RevisionUpdate {
   168  	ru.mutation.AppendPartialHashes(s)
   169  	return ru
   170  }
   171  
   172  // ClearPartialHashes clears the value of the "partial_hashes" field.
   173  func (ru *RevisionUpdate) ClearPartialHashes() *RevisionUpdate {
   174  	ru.mutation.ClearPartialHashes()
   175  	return ru
   176  }
   177  
   178  // SetOperatorVersion sets the "operator_version" field.
   179  func (ru *RevisionUpdate) SetOperatorVersion(s string) *RevisionUpdate {
   180  	ru.mutation.SetOperatorVersion(s)
   181  	return ru
   182  }
   183  
   184  // Mutation returns the RevisionMutation object of the builder.
   185  func (ru *RevisionUpdate) Mutation() *RevisionMutation {
   186  	return ru.mutation
   187  }
   188  
   189  // Save executes the query and returns the number of nodes affected by the update operation.
   190  func (ru *RevisionUpdate) Save(ctx context.Context) (int, error) {
   191  	return withHooks(ctx, ru.sqlSave, ru.mutation, ru.hooks)
   192  }
   193  
   194  // SaveX is like Save, but panics if an error occurs.
   195  func (ru *RevisionUpdate) SaveX(ctx context.Context) int {
   196  	affected, err := ru.Save(ctx)
   197  	if err != nil {
   198  		panic(err)
   199  	}
   200  	return affected
   201  }
   202  
   203  // Exec executes the query.
   204  func (ru *RevisionUpdate) Exec(ctx context.Context) error {
   205  	_, err := ru.Save(ctx)
   206  	return err
   207  }
   208  
   209  // ExecX is like Exec, but panics if an error occurs.
   210  func (ru *RevisionUpdate) ExecX(ctx context.Context) {
   211  	if err := ru.Exec(ctx); err != nil {
   212  		panic(err)
   213  	}
   214  }
   215  
   216  // check runs all checks and user-defined validators on the builder.
   217  func (ru *RevisionUpdate) check() error {
   218  	if v, ok := ru.mutation.Applied(); ok {
   219  		if err := revision.AppliedValidator(v); err != nil {
   220  			return &ValidationError{Name: "applied", err: fmt.Errorf(`ent: validator failed for field "Revision.applied": %w`, err)}
   221  		}
   222  	}
   223  	if v, ok := ru.mutation.Total(); ok {
   224  		if err := revision.TotalValidator(v); err != nil {
   225  			return &ValidationError{Name: "total", err: fmt.Errorf(`ent: validator failed for field "Revision.total": %w`, err)}
   226  		}
   227  	}
   228  	return nil
   229  }
   230  
   231  func (ru *RevisionUpdate) sqlSave(ctx context.Context) (n int, err error) {
   232  	if err := ru.check(); err != nil {
   233  		return n, err
   234  	}
   235  	_spec := sqlgraph.NewUpdateSpec(revision.Table, revision.Columns, sqlgraph.NewFieldSpec(revision.FieldID, field.TypeString))
   236  	if ps := ru.mutation.predicates; len(ps) > 0 {
   237  		_spec.Predicate = func(selector *sql.Selector) {
   238  			for i := range ps {
   239  				ps[i](selector)
   240  			}
   241  		}
   242  	}
   243  	if value, ok := ru.mutation.GetType(); ok {
   244  		_spec.SetField(revision.FieldType, field.TypeUint, value)
   245  	}
   246  	if value, ok := ru.mutation.AddedType(); ok {
   247  		_spec.AddField(revision.FieldType, field.TypeUint, value)
   248  	}
   249  	if value, ok := ru.mutation.Applied(); ok {
   250  		_spec.SetField(revision.FieldApplied, field.TypeInt, value)
   251  	}
   252  	if value, ok := ru.mutation.AddedApplied(); ok {
   253  		_spec.AddField(revision.FieldApplied, field.TypeInt, value)
   254  	}
   255  	if value, ok := ru.mutation.Total(); ok {
   256  		_spec.SetField(revision.FieldTotal, field.TypeInt, value)
   257  	}
   258  	if value, ok := ru.mutation.AddedTotal(); ok {
   259  		_spec.AddField(revision.FieldTotal, field.TypeInt, value)
   260  	}
   261  	if value, ok := ru.mutation.ExecutionTime(); ok {
   262  		_spec.SetField(revision.FieldExecutionTime, field.TypeInt64, value)
   263  	}
   264  	if value, ok := ru.mutation.AddedExecutionTime(); ok {
   265  		_spec.AddField(revision.FieldExecutionTime, field.TypeInt64, value)
   266  	}
   267  	if value, ok := ru.mutation.Error(); ok {
   268  		_spec.SetField(revision.FieldError, field.TypeString, value)
   269  	}
   270  	if ru.mutation.ErrorCleared() {
   271  		_spec.ClearField(revision.FieldError, field.TypeString)
   272  	}
   273  	if value, ok := ru.mutation.ErrorStmt(); ok {
   274  		_spec.SetField(revision.FieldErrorStmt, field.TypeString, value)
   275  	}
   276  	if ru.mutation.ErrorStmtCleared() {
   277  		_spec.ClearField(revision.FieldErrorStmt, field.TypeString)
   278  	}
   279  	if value, ok := ru.mutation.Hash(); ok {
   280  		_spec.SetField(revision.FieldHash, field.TypeString, value)
   281  	}
   282  	if value, ok := ru.mutation.PartialHashes(); ok {
   283  		_spec.SetField(revision.FieldPartialHashes, field.TypeJSON, value)
   284  	}
   285  	if value, ok := ru.mutation.AppendedPartialHashes(); ok {
   286  		_spec.AddModifier(func(u *sql.UpdateBuilder) {
   287  			sqljson.Append(u, revision.FieldPartialHashes, value)
   288  		})
   289  	}
   290  	if ru.mutation.PartialHashesCleared() {
   291  		_spec.ClearField(revision.FieldPartialHashes, field.TypeJSON)
   292  	}
   293  	if value, ok := ru.mutation.OperatorVersion(); ok {
   294  		_spec.SetField(revision.FieldOperatorVersion, field.TypeString, value)
   295  	}
   296  	_spec.Node.Schema = ru.schemaConfig.Revision
   297  	ctx = internal.NewSchemaConfigContext(ctx, ru.schemaConfig)
   298  	if n, err = sqlgraph.UpdateNodes(ctx, ru.driver, _spec); err != nil {
   299  		if _, ok := err.(*sqlgraph.NotFoundError); ok {
   300  			err = &NotFoundError{revision.Label}
   301  		} else if sqlgraph.IsConstraintError(err) {
   302  			err = &ConstraintError{msg: err.Error(), wrap: err}
   303  		}
   304  		return 0, err
   305  	}
   306  	ru.mutation.done = true
   307  	return n, nil
   308  }
   309  
   310  // RevisionUpdateOne is the builder for updating a single Revision entity.
   311  type RevisionUpdateOne struct {
   312  	config
   313  	fields   []string
   314  	hooks    []Hook
   315  	mutation *RevisionMutation
   316  }
   317  
   318  // SetType sets the "type" field.
   319  func (ruo *RevisionUpdateOne) SetType(mt migrate.RevisionType) *RevisionUpdateOne {
   320  	ruo.mutation.ResetType()
   321  	ruo.mutation.SetType(mt)
   322  	return ruo
   323  }
   324  
   325  // SetNillableType sets the "type" field if the given value is not nil.
   326  func (ruo *RevisionUpdateOne) SetNillableType(mt *migrate.RevisionType) *RevisionUpdateOne {
   327  	if mt != nil {
   328  		ruo.SetType(*mt)
   329  	}
   330  	return ruo
   331  }
   332  
   333  // AddType adds mt to the "type" field.
   334  func (ruo *RevisionUpdateOne) AddType(mt migrate.RevisionType) *RevisionUpdateOne {
   335  	ruo.mutation.AddType(mt)
   336  	return ruo
   337  }
   338  
   339  // SetApplied sets the "applied" field.
   340  func (ruo *RevisionUpdateOne) SetApplied(i int) *RevisionUpdateOne {
   341  	ruo.mutation.ResetApplied()
   342  	ruo.mutation.SetApplied(i)
   343  	return ruo
   344  }
   345  
   346  // SetNillableApplied sets the "applied" field if the given value is not nil.
   347  func (ruo *RevisionUpdateOne) SetNillableApplied(i *int) *RevisionUpdateOne {
   348  	if i != nil {
   349  		ruo.SetApplied(*i)
   350  	}
   351  	return ruo
   352  }
   353  
   354  // AddApplied adds i to the "applied" field.
   355  func (ruo *RevisionUpdateOne) AddApplied(i int) *RevisionUpdateOne {
   356  	ruo.mutation.AddApplied(i)
   357  	return ruo
   358  }
   359  
   360  // SetTotal sets the "total" field.
   361  func (ruo *RevisionUpdateOne) SetTotal(i int) *RevisionUpdateOne {
   362  	ruo.mutation.ResetTotal()
   363  	ruo.mutation.SetTotal(i)
   364  	return ruo
   365  }
   366  
   367  // SetNillableTotal sets the "total" field if the given value is not nil.
   368  func (ruo *RevisionUpdateOne) SetNillableTotal(i *int) *RevisionUpdateOne {
   369  	if i != nil {
   370  		ruo.SetTotal(*i)
   371  	}
   372  	return ruo
   373  }
   374  
   375  // AddTotal adds i to the "total" field.
   376  func (ruo *RevisionUpdateOne) AddTotal(i int) *RevisionUpdateOne {
   377  	ruo.mutation.AddTotal(i)
   378  	return ruo
   379  }
   380  
   381  // SetExecutionTime sets the "execution_time" field.
   382  func (ruo *RevisionUpdateOne) SetExecutionTime(t time.Duration) *RevisionUpdateOne {
   383  	ruo.mutation.ResetExecutionTime()
   384  	ruo.mutation.SetExecutionTime(t)
   385  	return ruo
   386  }
   387  
   388  // AddExecutionTime adds t to the "execution_time" field.
   389  func (ruo *RevisionUpdateOne) AddExecutionTime(t time.Duration) *RevisionUpdateOne {
   390  	ruo.mutation.AddExecutionTime(t)
   391  	return ruo
   392  }
   393  
   394  // SetError sets the "error" field.
   395  func (ruo *RevisionUpdateOne) SetError(s string) *RevisionUpdateOne {
   396  	ruo.mutation.SetError(s)
   397  	return ruo
   398  }
   399  
   400  // SetNillableError sets the "error" field if the given value is not nil.
   401  func (ruo *RevisionUpdateOne) SetNillableError(s *string) *RevisionUpdateOne {
   402  	if s != nil {
   403  		ruo.SetError(*s)
   404  	}
   405  	return ruo
   406  }
   407  
   408  // ClearError clears the value of the "error" field.
   409  func (ruo *RevisionUpdateOne) ClearError() *RevisionUpdateOne {
   410  	ruo.mutation.ClearError()
   411  	return ruo
   412  }
   413  
   414  // SetErrorStmt sets the "error_stmt" field.
   415  func (ruo *RevisionUpdateOne) SetErrorStmt(s string) *RevisionUpdateOne {
   416  	ruo.mutation.SetErrorStmt(s)
   417  	return ruo
   418  }
   419  
   420  // SetNillableErrorStmt sets the "error_stmt" field if the given value is not nil.
   421  func (ruo *RevisionUpdateOne) SetNillableErrorStmt(s *string) *RevisionUpdateOne {
   422  	if s != nil {
   423  		ruo.SetErrorStmt(*s)
   424  	}
   425  	return ruo
   426  }
   427  
   428  // ClearErrorStmt clears the value of the "error_stmt" field.
   429  func (ruo *RevisionUpdateOne) ClearErrorStmt() *RevisionUpdateOne {
   430  	ruo.mutation.ClearErrorStmt()
   431  	return ruo
   432  }
   433  
   434  // SetHash sets the "hash" field.
   435  func (ruo *RevisionUpdateOne) SetHash(s string) *RevisionUpdateOne {
   436  	ruo.mutation.SetHash(s)
   437  	return ruo
   438  }
   439  
   440  // SetPartialHashes sets the "partial_hashes" field.
   441  func (ruo *RevisionUpdateOne) SetPartialHashes(s []string) *RevisionUpdateOne {
   442  	ruo.mutation.SetPartialHashes(s)
   443  	return ruo
   444  }
   445  
   446  // AppendPartialHashes appends s to the "partial_hashes" field.
   447  func (ruo *RevisionUpdateOne) AppendPartialHashes(s []string) *RevisionUpdateOne {
   448  	ruo.mutation.AppendPartialHashes(s)
   449  	return ruo
   450  }
   451  
   452  // ClearPartialHashes clears the value of the "partial_hashes" field.
   453  func (ruo *RevisionUpdateOne) ClearPartialHashes() *RevisionUpdateOne {
   454  	ruo.mutation.ClearPartialHashes()
   455  	return ruo
   456  }
   457  
   458  // SetOperatorVersion sets the "operator_version" field.
   459  func (ruo *RevisionUpdateOne) SetOperatorVersion(s string) *RevisionUpdateOne {
   460  	ruo.mutation.SetOperatorVersion(s)
   461  	return ruo
   462  }
   463  
   464  // Mutation returns the RevisionMutation object of the builder.
   465  func (ruo *RevisionUpdateOne) Mutation() *RevisionMutation {
   466  	return ruo.mutation
   467  }
   468  
   469  // Where appends a list predicates to the RevisionUpdate builder.
   470  func (ruo *RevisionUpdateOne) Where(ps ...predicate.Revision) *RevisionUpdateOne {
   471  	ruo.mutation.Where(ps...)
   472  	return ruo
   473  }
   474  
   475  // Select allows selecting one or more fields (columns) of the returned entity.
   476  // The default is selecting all fields defined in the entity schema.
   477  func (ruo *RevisionUpdateOne) Select(field string, fields ...string) *RevisionUpdateOne {
   478  	ruo.fields = append([]string{field}, fields...)
   479  	return ruo
   480  }
   481  
   482  // Save executes the query and returns the updated Revision entity.
   483  func (ruo *RevisionUpdateOne) Save(ctx context.Context) (*Revision, error) {
   484  	return withHooks(ctx, ruo.sqlSave, ruo.mutation, ruo.hooks)
   485  }
   486  
   487  // SaveX is like Save, but panics if an error occurs.
   488  func (ruo *RevisionUpdateOne) SaveX(ctx context.Context) *Revision {
   489  	node, err := ruo.Save(ctx)
   490  	if err != nil {
   491  		panic(err)
   492  	}
   493  	return node
   494  }
   495  
   496  // Exec executes the query on the entity.
   497  func (ruo *RevisionUpdateOne) Exec(ctx context.Context) error {
   498  	_, err := ruo.Save(ctx)
   499  	return err
   500  }
   501  
   502  // ExecX is like Exec, but panics if an error occurs.
   503  func (ruo *RevisionUpdateOne) ExecX(ctx context.Context) {
   504  	if err := ruo.Exec(ctx); err != nil {
   505  		panic(err)
   506  	}
   507  }
   508  
   509  // check runs all checks and user-defined validators on the builder.
   510  func (ruo *RevisionUpdateOne) check() error {
   511  	if v, ok := ruo.mutation.Applied(); ok {
   512  		if err := revision.AppliedValidator(v); err != nil {
   513  			return &ValidationError{Name: "applied", err: fmt.Errorf(`ent: validator failed for field "Revision.applied": %w`, err)}
   514  		}
   515  	}
   516  	if v, ok := ruo.mutation.Total(); ok {
   517  		if err := revision.TotalValidator(v); err != nil {
   518  			return &ValidationError{Name: "total", err: fmt.Errorf(`ent: validator failed for field "Revision.total": %w`, err)}
   519  		}
   520  	}
   521  	return nil
   522  }
   523  
   524  func (ruo *RevisionUpdateOne) sqlSave(ctx context.Context) (_node *Revision, err error) {
   525  	if err := ruo.check(); err != nil {
   526  		return _node, err
   527  	}
   528  	_spec := sqlgraph.NewUpdateSpec(revision.Table, revision.Columns, sqlgraph.NewFieldSpec(revision.FieldID, field.TypeString))
   529  	id, ok := ruo.mutation.ID()
   530  	if !ok {
   531  		return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Revision.id" for update`)}
   532  	}
   533  	_spec.Node.ID.Value = id
   534  	if fields := ruo.fields; len(fields) > 0 {
   535  		_spec.Node.Columns = make([]string, 0, len(fields))
   536  		_spec.Node.Columns = append(_spec.Node.Columns, revision.FieldID)
   537  		for _, f := range fields {
   538  			if !revision.ValidColumn(f) {
   539  				return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
   540  			}
   541  			if f != revision.FieldID {
   542  				_spec.Node.Columns = append(_spec.Node.Columns, f)
   543  			}
   544  		}
   545  	}
   546  	if ps := ruo.mutation.predicates; len(ps) > 0 {
   547  		_spec.Predicate = func(selector *sql.Selector) {
   548  			for i := range ps {
   549  				ps[i](selector)
   550  			}
   551  		}
   552  	}
   553  	if value, ok := ruo.mutation.GetType(); ok {
   554  		_spec.SetField(revision.FieldType, field.TypeUint, value)
   555  	}
   556  	if value, ok := ruo.mutation.AddedType(); ok {
   557  		_spec.AddField(revision.FieldType, field.TypeUint, value)
   558  	}
   559  	if value, ok := ruo.mutation.Applied(); ok {
   560  		_spec.SetField(revision.FieldApplied, field.TypeInt, value)
   561  	}
   562  	if value, ok := ruo.mutation.AddedApplied(); ok {
   563  		_spec.AddField(revision.FieldApplied, field.TypeInt, value)
   564  	}
   565  	if value, ok := ruo.mutation.Total(); ok {
   566  		_spec.SetField(revision.FieldTotal, field.TypeInt, value)
   567  	}
   568  	if value, ok := ruo.mutation.AddedTotal(); ok {
   569  		_spec.AddField(revision.FieldTotal, field.TypeInt, value)
   570  	}
   571  	if value, ok := ruo.mutation.ExecutionTime(); ok {
   572  		_spec.SetField(revision.FieldExecutionTime, field.TypeInt64, value)
   573  	}
   574  	if value, ok := ruo.mutation.AddedExecutionTime(); ok {
   575  		_spec.AddField(revision.FieldExecutionTime, field.TypeInt64, value)
   576  	}
   577  	if value, ok := ruo.mutation.Error(); ok {
   578  		_spec.SetField(revision.FieldError, field.TypeString, value)
   579  	}
   580  	if ruo.mutation.ErrorCleared() {
   581  		_spec.ClearField(revision.FieldError, field.TypeString)
   582  	}
   583  	if value, ok := ruo.mutation.ErrorStmt(); ok {
   584  		_spec.SetField(revision.FieldErrorStmt, field.TypeString, value)
   585  	}
   586  	if ruo.mutation.ErrorStmtCleared() {
   587  		_spec.ClearField(revision.FieldErrorStmt, field.TypeString)
   588  	}
   589  	if value, ok := ruo.mutation.Hash(); ok {
   590  		_spec.SetField(revision.FieldHash, field.TypeString, value)
   591  	}
   592  	if value, ok := ruo.mutation.PartialHashes(); ok {
   593  		_spec.SetField(revision.FieldPartialHashes, field.TypeJSON, value)
   594  	}
   595  	if value, ok := ruo.mutation.AppendedPartialHashes(); ok {
   596  		_spec.AddModifier(func(u *sql.UpdateBuilder) {
   597  			sqljson.Append(u, revision.FieldPartialHashes, value)
   598  		})
   599  	}
   600  	if ruo.mutation.PartialHashesCleared() {
   601  		_spec.ClearField(revision.FieldPartialHashes, field.TypeJSON)
   602  	}
   603  	if value, ok := ruo.mutation.OperatorVersion(); ok {
   604  		_spec.SetField(revision.FieldOperatorVersion, field.TypeString, value)
   605  	}
   606  	_spec.Node.Schema = ruo.schemaConfig.Revision
   607  	ctx = internal.NewSchemaConfigContext(ctx, ruo.schemaConfig)
   608  	_node = &Revision{config: ruo.config}
   609  	_spec.Assign = _node.assignValues
   610  	_spec.ScanValues = _node.scanValues
   611  	if err = sqlgraph.UpdateNode(ctx, ruo.driver, _spec); err != nil {
   612  		if _, ok := err.(*sqlgraph.NotFoundError); ok {
   613  			err = &NotFoundError{revision.Label}
   614  		} else if sqlgraph.IsConstraintError(err) {
   615  			err = &ConstraintError{msg: err.Error(), wrap: err}
   616  		}
   617  		return nil, err
   618  	}
   619  	ruo.mutation.done = true
   620  	return _node, nil
   621  }