bitbucket.org/Aishee/synsec@v0.0.0-20210414005726-236fc01a153d/pkg/database/ent/bouncer_update.go (about)

     1  // Code generated by entc, DO NOT EDIT.
     2  
     3  package ent
     4  
     5  import (
     6  	"context"
     7  	"fmt"
     8  	"time"
     9  
    10  	"entgo.io/ent/dialect/sql"
    11  	"entgo.io/ent/dialect/sql/sqlgraph"
    12  	"entgo.io/ent/schema/field"
    13  	"bitbucket.org/Aishee/synsec/pkg/database/ent/bouncer"
    14  	"bitbucket.org/Aishee/synsec/pkg/database/ent/predicate"
    15  )
    16  
    17  // BouncerUpdate is the builder for updating Bouncer entities.
    18  type BouncerUpdate struct {
    19  	config
    20  	hooks    []Hook
    21  	mutation *BouncerMutation
    22  }
    23  
    24  // Where adds a new predicate for the BouncerUpdate builder.
    25  func (bu *BouncerUpdate) Where(ps ...predicate.Bouncer) *BouncerUpdate {
    26  	bu.mutation.predicates = append(bu.mutation.predicates, ps...)
    27  	return bu
    28  }
    29  
    30  // SetCreatedAt sets the "created_at" field.
    31  func (bu *BouncerUpdate) SetCreatedAt(t time.Time) *BouncerUpdate {
    32  	bu.mutation.SetCreatedAt(t)
    33  	return bu
    34  }
    35  
    36  // SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
    37  func (bu *BouncerUpdate) SetNillableCreatedAt(t *time.Time) *BouncerUpdate {
    38  	if t != nil {
    39  		bu.SetCreatedAt(*t)
    40  	}
    41  	return bu
    42  }
    43  
    44  // SetUpdatedAt sets the "updated_at" field.
    45  func (bu *BouncerUpdate) SetUpdatedAt(t time.Time) *BouncerUpdate {
    46  	bu.mutation.SetUpdatedAt(t)
    47  	return bu
    48  }
    49  
    50  // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
    51  func (bu *BouncerUpdate) SetNillableUpdatedAt(t *time.Time) *BouncerUpdate {
    52  	if t != nil {
    53  		bu.SetUpdatedAt(*t)
    54  	}
    55  	return bu
    56  }
    57  
    58  // SetName sets the "name" field.
    59  func (bu *BouncerUpdate) SetName(s string) *BouncerUpdate {
    60  	bu.mutation.SetName(s)
    61  	return bu
    62  }
    63  
    64  // SetAPIKey sets the "api_key" field.
    65  func (bu *BouncerUpdate) SetAPIKey(s string) *BouncerUpdate {
    66  	bu.mutation.SetAPIKey(s)
    67  	return bu
    68  }
    69  
    70  // SetRevoked sets the "revoked" field.
    71  func (bu *BouncerUpdate) SetRevoked(b bool) *BouncerUpdate {
    72  	bu.mutation.SetRevoked(b)
    73  	return bu
    74  }
    75  
    76  // SetIPAddress sets the "ip_address" field.
    77  func (bu *BouncerUpdate) SetIPAddress(s string) *BouncerUpdate {
    78  	bu.mutation.SetIPAddress(s)
    79  	return bu
    80  }
    81  
    82  // SetNillableIPAddress sets the "ip_address" field if the given value is not nil.
    83  func (bu *BouncerUpdate) SetNillableIPAddress(s *string) *BouncerUpdate {
    84  	if s != nil {
    85  		bu.SetIPAddress(*s)
    86  	}
    87  	return bu
    88  }
    89  
    90  // ClearIPAddress clears the value of the "ip_address" field.
    91  func (bu *BouncerUpdate) ClearIPAddress() *BouncerUpdate {
    92  	bu.mutation.ClearIPAddress()
    93  	return bu
    94  }
    95  
    96  // SetType sets the "type" field.
    97  func (bu *BouncerUpdate) SetType(s string) *BouncerUpdate {
    98  	bu.mutation.SetType(s)
    99  	return bu
   100  }
   101  
   102  // SetNillableType sets the "type" field if the given value is not nil.
   103  func (bu *BouncerUpdate) SetNillableType(s *string) *BouncerUpdate {
   104  	if s != nil {
   105  		bu.SetType(*s)
   106  	}
   107  	return bu
   108  }
   109  
   110  // ClearType clears the value of the "type" field.
   111  func (bu *BouncerUpdate) ClearType() *BouncerUpdate {
   112  	bu.mutation.ClearType()
   113  	return bu
   114  }
   115  
   116  // SetVersion sets the "version" field.
   117  func (bu *BouncerUpdate) SetVersion(s string) *BouncerUpdate {
   118  	bu.mutation.SetVersion(s)
   119  	return bu
   120  }
   121  
   122  // SetNillableVersion sets the "version" field if the given value is not nil.
   123  func (bu *BouncerUpdate) SetNillableVersion(s *string) *BouncerUpdate {
   124  	if s != nil {
   125  		bu.SetVersion(*s)
   126  	}
   127  	return bu
   128  }
   129  
   130  // ClearVersion clears the value of the "version" field.
   131  func (bu *BouncerUpdate) ClearVersion() *BouncerUpdate {
   132  	bu.mutation.ClearVersion()
   133  	return bu
   134  }
   135  
   136  // SetUntil sets the "until" field.
   137  func (bu *BouncerUpdate) SetUntil(t time.Time) *BouncerUpdate {
   138  	bu.mutation.SetUntil(t)
   139  	return bu
   140  }
   141  
   142  // SetNillableUntil sets the "until" field if the given value is not nil.
   143  func (bu *BouncerUpdate) SetNillableUntil(t *time.Time) *BouncerUpdate {
   144  	if t != nil {
   145  		bu.SetUntil(*t)
   146  	}
   147  	return bu
   148  }
   149  
   150  // ClearUntil clears the value of the "until" field.
   151  func (bu *BouncerUpdate) ClearUntil() *BouncerUpdate {
   152  	bu.mutation.ClearUntil()
   153  	return bu
   154  }
   155  
   156  // SetLastPull sets the "last_pull" field.
   157  func (bu *BouncerUpdate) SetLastPull(t time.Time) *BouncerUpdate {
   158  	bu.mutation.SetLastPull(t)
   159  	return bu
   160  }
   161  
   162  // SetNillableLastPull sets the "last_pull" field if the given value is not nil.
   163  func (bu *BouncerUpdate) SetNillableLastPull(t *time.Time) *BouncerUpdate {
   164  	if t != nil {
   165  		bu.SetLastPull(*t)
   166  	}
   167  	return bu
   168  }
   169  
   170  // Mutation returns the BouncerMutation object of the builder.
   171  func (bu *BouncerUpdate) Mutation() *BouncerMutation {
   172  	return bu.mutation
   173  }
   174  
   175  // Save executes the query and returns the number of nodes affected by the update operation.
   176  func (bu *BouncerUpdate) Save(ctx context.Context) (int, error) {
   177  	var (
   178  		err      error
   179  		affected int
   180  	)
   181  	if len(bu.hooks) == 0 {
   182  		affected, err = bu.sqlSave(ctx)
   183  	} else {
   184  		var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
   185  			mutation, ok := m.(*BouncerMutation)
   186  			if !ok {
   187  				return nil, fmt.Errorf("unexpected mutation type %T", m)
   188  			}
   189  			bu.mutation = mutation
   190  			affected, err = bu.sqlSave(ctx)
   191  			mutation.done = true
   192  			return affected, err
   193  		})
   194  		for i := len(bu.hooks) - 1; i >= 0; i-- {
   195  			mut = bu.hooks[i](mut)
   196  		}
   197  		if _, err := mut.Mutate(ctx, bu.mutation); err != nil {
   198  			return 0, err
   199  		}
   200  	}
   201  	return affected, err
   202  }
   203  
   204  // SaveX is like Save, but panics if an error occurs.
   205  func (bu *BouncerUpdate) SaveX(ctx context.Context) int {
   206  	affected, err := bu.Save(ctx)
   207  	if err != nil {
   208  		panic(err)
   209  	}
   210  	return affected
   211  }
   212  
   213  // Exec executes the query.
   214  func (bu *BouncerUpdate) Exec(ctx context.Context) error {
   215  	_, err := bu.Save(ctx)
   216  	return err
   217  }
   218  
   219  // ExecX is like Exec, but panics if an error occurs.
   220  func (bu *BouncerUpdate) ExecX(ctx context.Context) {
   221  	if err := bu.Exec(ctx); err != nil {
   222  		panic(err)
   223  	}
   224  }
   225  
   226  func (bu *BouncerUpdate) sqlSave(ctx context.Context) (n int, err error) {
   227  	_spec := &sqlgraph.UpdateSpec{
   228  		Node: &sqlgraph.NodeSpec{
   229  			Table:   bouncer.Table,
   230  			Columns: bouncer.Columns,
   231  			ID: &sqlgraph.FieldSpec{
   232  				Type:   field.TypeInt,
   233  				Column: bouncer.FieldID,
   234  			},
   235  		},
   236  	}
   237  	if ps := bu.mutation.predicates; len(ps) > 0 {
   238  		_spec.Predicate = func(selector *sql.Selector) {
   239  			for i := range ps {
   240  				ps[i](selector)
   241  			}
   242  		}
   243  	}
   244  	if value, ok := bu.mutation.CreatedAt(); ok {
   245  		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
   246  			Type:   field.TypeTime,
   247  			Value:  value,
   248  			Column: bouncer.FieldCreatedAt,
   249  		})
   250  	}
   251  	if value, ok := bu.mutation.UpdatedAt(); ok {
   252  		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
   253  			Type:   field.TypeTime,
   254  			Value:  value,
   255  			Column: bouncer.FieldUpdatedAt,
   256  		})
   257  	}
   258  	if value, ok := bu.mutation.Name(); ok {
   259  		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
   260  			Type:   field.TypeString,
   261  			Value:  value,
   262  			Column: bouncer.FieldName,
   263  		})
   264  	}
   265  	if value, ok := bu.mutation.APIKey(); ok {
   266  		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
   267  			Type:   field.TypeString,
   268  			Value:  value,
   269  			Column: bouncer.FieldAPIKey,
   270  		})
   271  	}
   272  	if value, ok := bu.mutation.Revoked(); ok {
   273  		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
   274  			Type:   field.TypeBool,
   275  			Value:  value,
   276  			Column: bouncer.FieldRevoked,
   277  		})
   278  	}
   279  	if value, ok := bu.mutation.IPAddress(); ok {
   280  		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
   281  			Type:   field.TypeString,
   282  			Value:  value,
   283  			Column: bouncer.FieldIPAddress,
   284  		})
   285  	}
   286  	if bu.mutation.IPAddressCleared() {
   287  		_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
   288  			Type:   field.TypeString,
   289  			Column: bouncer.FieldIPAddress,
   290  		})
   291  	}
   292  	if value, ok := bu.mutation.GetType(); ok {
   293  		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
   294  			Type:   field.TypeString,
   295  			Value:  value,
   296  			Column: bouncer.FieldType,
   297  		})
   298  	}
   299  	if bu.mutation.TypeCleared() {
   300  		_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
   301  			Type:   field.TypeString,
   302  			Column: bouncer.FieldType,
   303  		})
   304  	}
   305  	if value, ok := bu.mutation.Version(); ok {
   306  		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
   307  			Type:   field.TypeString,
   308  			Value:  value,
   309  			Column: bouncer.FieldVersion,
   310  		})
   311  	}
   312  	if bu.mutation.VersionCleared() {
   313  		_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
   314  			Type:   field.TypeString,
   315  			Column: bouncer.FieldVersion,
   316  		})
   317  	}
   318  	if value, ok := bu.mutation.Until(); ok {
   319  		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
   320  			Type:   field.TypeTime,
   321  			Value:  value,
   322  			Column: bouncer.FieldUntil,
   323  		})
   324  	}
   325  	if bu.mutation.UntilCleared() {
   326  		_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
   327  			Type:   field.TypeTime,
   328  			Column: bouncer.FieldUntil,
   329  		})
   330  	}
   331  	if value, ok := bu.mutation.LastPull(); ok {
   332  		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
   333  			Type:   field.TypeTime,
   334  			Value:  value,
   335  			Column: bouncer.FieldLastPull,
   336  		})
   337  	}
   338  	if n, err = sqlgraph.UpdateNodes(ctx, bu.driver, _spec); err != nil {
   339  		if _, ok := err.(*sqlgraph.NotFoundError); ok {
   340  			err = &NotFoundError{bouncer.Label}
   341  		} else if cerr, ok := isSQLConstraintError(err); ok {
   342  			err = cerr
   343  		}
   344  		return 0, err
   345  	}
   346  	return n, nil
   347  }
   348  
   349  // BouncerUpdateOne is the builder for updating a single Bouncer entity.
   350  type BouncerUpdateOne struct {
   351  	config
   352  	hooks    []Hook
   353  	mutation *BouncerMutation
   354  }
   355  
   356  // SetCreatedAt sets the "created_at" field.
   357  func (buo *BouncerUpdateOne) SetCreatedAt(t time.Time) *BouncerUpdateOne {
   358  	buo.mutation.SetCreatedAt(t)
   359  	return buo
   360  }
   361  
   362  // SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
   363  func (buo *BouncerUpdateOne) SetNillableCreatedAt(t *time.Time) *BouncerUpdateOne {
   364  	if t != nil {
   365  		buo.SetCreatedAt(*t)
   366  	}
   367  	return buo
   368  }
   369  
   370  // SetUpdatedAt sets the "updated_at" field.
   371  func (buo *BouncerUpdateOne) SetUpdatedAt(t time.Time) *BouncerUpdateOne {
   372  	buo.mutation.SetUpdatedAt(t)
   373  	return buo
   374  }
   375  
   376  // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
   377  func (buo *BouncerUpdateOne) SetNillableUpdatedAt(t *time.Time) *BouncerUpdateOne {
   378  	if t != nil {
   379  		buo.SetUpdatedAt(*t)
   380  	}
   381  	return buo
   382  }
   383  
   384  // SetName sets the "name" field.
   385  func (buo *BouncerUpdateOne) SetName(s string) *BouncerUpdateOne {
   386  	buo.mutation.SetName(s)
   387  	return buo
   388  }
   389  
   390  // SetAPIKey sets the "api_key" field.
   391  func (buo *BouncerUpdateOne) SetAPIKey(s string) *BouncerUpdateOne {
   392  	buo.mutation.SetAPIKey(s)
   393  	return buo
   394  }
   395  
   396  // SetRevoked sets the "revoked" field.
   397  func (buo *BouncerUpdateOne) SetRevoked(b bool) *BouncerUpdateOne {
   398  	buo.mutation.SetRevoked(b)
   399  	return buo
   400  }
   401  
   402  // SetIPAddress sets the "ip_address" field.
   403  func (buo *BouncerUpdateOne) SetIPAddress(s string) *BouncerUpdateOne {
   404  	buo.mutation.SetIPAddress(s)
   405  	return buo
   406  }
   407  
   408  // SetNillableIPAddress sets the "ip_address" field if the given value is not nil.
   409  func (buo *BouncerUpdateOne) SetNillableIPAddress(s *string) *BouncerUpdateOne {
   410  	if s != nil {
   411  		buo.SetIPAddress(*s)
   412  	}
   413  	return buo
   414  }
   415  
   416  // ClearIPAddress clears the value of the "ip_address" field.
   417  func (buo *BouncerUpdateOne) ClearIPAddress() *BouncerUpdateOne {
   418  	buo.mutation.ClearIPAddress()
   419  	return buo
   420  }
   421  
   422  // SetType sets the "type" field.
   423  func (buo *BouncerUpdateOne) SetType(s string) *BouncerUpdateOne {
   424  	buo.mutation.SetType(s)
   425  	return buo
   426  }
   427  
   428  // SetNillableType sets the "type" field if the given value is not nil.
   429  func (buo *BouncerUpdateOne) SetNillableType(s *string) *BouncerUpdateOne {
   430  	if s != nil {
   431  		buo.SetType(*s)
   432  	}
   433  	return buo
   434  }
   435  
   436  // ClearType clears the value of the "type" field.
   437  func (buo *BouncerUpdateOne) ClearType() *BouncerUpdateOne {
   438  	buo.mutation.ClearType()
   439  	return buo
   440  }
   441  
   442  // SetVersion sets the "version" field.
   443  func (buo *BouncerUpdateOne) SetVersion(s string) *BouncerUpdateOne {
   444  	buo.mutation.SetVersion(s)
   445  	return buo
   446  }
   447  
   448  // SetNillableVersion sets the "version" field if the given value is not nil.
   449  func (buo *BouncerUpdateOne) SetNillableVersion(s *string) *BouncerUpdateOne {
   450  	if s != nil {
   451  		buo.SetVersion(*s)
   452  	}
   453  	return buo
   454  }
   455  
   456  // ClearVersion clears the value of the "version" field.
   457  func (buo *BouncerUpdateOne) ClearVersion() *BouncerUpdateOne {
   458  	buo.mutation.ClearVersion()
   459  	return buo
   460  }
   461  
   462  // SetUntil sets the "until" field.
   463  func (buo *BouncerUpdateOne) SetUntil(t time.Time) *BouncerUpdateOne {
   464  	buo.mutation.SetUntil(t)
   465  	return buo
   466  }
   467  
   468  // SetNillableUntil sets the "until" field if the given value is not nil.
   469  func (buo *BouncerUpdateOne) SetNillableUntil(t *time.Time) *BouncerUpdateOne {
   470  	if t != nil {
   471  		buo.SetUntil(*t)
   472  	}
   473  	return buo
   474  }
   475  
   476  // ClearUntil clears the value of the "until" field.
   477  func (buo *BouncerUpdateOne) ClearUntil() *BouncerUpdateOne {
   478  	buo.mutation.ClearUntil()
   479  	return buo
   480  }
   481  
   482  // SetLastPull sets the "last_pull" field.
   483  func (buo *BouncerUpdateOne) SetLastPull(t time.Time) *BouncerUpdateOne {
   484  	buo.mutation.SetLastPull(t)
   485  	return buo
   486  }
   487  
   488  // SetNillableLastPull sets the "last_pull" field if the given value is not nil.
   489  func (buo *BouncerUpdateOne) SetNillableLastPull(t *time.Time) *BouncerUpdateOne {
   490  	if t != nil {
   491  		buo.SetLastPull(*t)
   492  	}
   493  	return buo
   494  }
   495  
   496  // Mutation returns the BouncerMutation object of the builder.
   497  func (buo *BouncerUpdateOne) Mutation() *BouncerMutation {
   498  	return buo.mutation
   499  }
   500  
   501  // Save executes the query and returns the updated Bouncer entity.
   502  func (buo *BouncerUpdateOne) Save(ctx context.Context) (*Bouncer, error) {
   503  	var (
   504  		err  error
   505  		node *Bouncer
   506  	)
   507  	if len(buo.hooks) == 0 {
   508  		node, err = buo.sqlSave(ctx)
   509  	} else {
   510  		var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
   511  			mutation, ok := m.(*BouncerMutation)
   512  			if !ok {
   513  				return nil, fmt.Errorf("unexpected mutation type %T", m)
   514  			}
   515  			buo.mutation = mutation
   516  			node, err = buo.sqlSave(ctx)
   517  			mutation.done = true
   518  			return node, err
   519  		})
   520  		for i := len(buo.hooks) - 1; i >= 0; i-- {
   521  			mut = buo.hooks[i](mut)
   522  		}
   523  		if _, err := mut.Mutate(ctx, buo.mutation); err != nil {
   524  			return nil, err
   525  		}
   526  	}
   527  	return node, err
   528  }
   529  
   530  // SaveX is like Save, but panics if an error occurs.
   531  func (buo *BouncerUpdateOne) SaveX(ctx context.Context) *Bouncer {
   532  	node, err := buo.Save(ctx)
   533  	if err != nil {
   534  		panic(err)
   535  	}
   536  	return node
   537  }
   538  
   539  // Exec executes the query on the entity.
   540  func (buo *BouncerUpdateOne) Exec(ctx context.Context) error {
   541  	_, err := buo.Save(ctx)
   542  	return err
   543  }
   544  
   545  // ExecX is like Exec, but panics if an error occurs.
   546  func (buo *BouncerUpdateOne) ExecX(ctx context.Context) {
   547  	if err := buo.Exec(ctx); err != nil {
   548  		panic(err)
   549  	}
   550  }
   551  
   552  func (buo *BouncerUpdateOne) sqlSave(ctx context.Context) (_node *Bouncer, err error) {
   553  	_spec := &sqlgraph.UpdateSpec{
   554  		Node: &sqlgraph.NodeSpec{
   555  			Table:   bouncer.Table,
   556  			Columns: bouncer.Columns,
   557  			ID: &sqlgraph.FieldSpec{
   558  				Type:   field.TypeInt,
   559  				Column: bouncer.FieldID,
   560  			},
   561  		},
   562  	}
   563  	id, ok := buo.mutation.ID()
   564  	if !ok {
   565  		return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Bouncer.ID for update")}
   566  	}
   567  	_spec.Node.ID.Value = id
   568  	if ps := buo.mutation.predicates; len(ps) > 0 {
   569  		_spec.Predicate = func(selector *sql.Selector) {
   570  			for i := range ps {
   571  				ps[i](selector)
   572  			}
   573  		}
   574  	}
   575  	if value, ok := buo.mutation.CreatedAt(); ok {
   576  		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
   577  			Type:   field.TypeTime,
   578  			Value:  value,
   579  			Column: bouncer.FieldCreatedAt,
   580  		})
   581  	}
   582  	if value, ok := buo.mutation.UpdatedAt(); ok {
   583  		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
   584  			Type:   field.TypeTime,
   585  			Value:  value,
   586  			Column: bouncer.FieldUpdatedAt,
   587  		})
   588  	}
   589  	if value, ok := buo.mutation.Name(); ok {
   590  		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
   591  			Type:   field.TypeString,
   592  			Value:  value,
   593  			Column: bouncer.FieldName,
   594  		})
   595  	}
   596  	if value, ok := buo.mutation.APIKey(); ok {
   597  		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
   598  			Type:   field.TypeString,
   599  			Value:  value,
   600  			Column: bouncer.FieldAPIKey,
   601  		})
   602  	}
   603  	if value, ok := buo.mutation.Revoked(); ok {
   604  		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
   605  			Type:   field.TypeBool,
   606  			Value:  value,
   607  			Column: bouncer.FieldRevoked,
   608  		})
   609  	}
   610  	if value, ok := buo.mutation.IPAddress(); ok {
   611  		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
   612  			Type:   field.TypeString,
   613  			Value:  value,
   614  			Column: bouncer.FieldIPAddress,
   615  		})
   616  	}
   617  	if buo.mutation.IPAddressCleared() {
   618  		_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
   619  			Type:   field.TypeString,
   620  			Column: bouncer.FieldIPAddress,
   621  		})
   622  	}
   623  	if value, ok := buo.mutation.GetType(); ok {
   624  		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
   625  			Type:   field.TypeString,
   626  			Value:  value,
   627  			Column: bouncer.FieldType,
   628  		})
   629  	}
   630  	if buo.mutation.TypeCleared() {
   631  		_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
   632  			Type:   field.TypeString,
   633  			Column: bouncer.FieldType,
   634  		})
   635  	}
   636  	if value, ok := buo.mutation.Version(); ok {
   637  		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
   638  			Type:   field.TypeString,
   639  			Value:  value,
   640  			Column: bouncer.FieldVersion,
   641  		})
   642  	}
   643  	if buo.mutation.VersionCleared() {
   644  		_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
   645  			Type:   field.TypeString,
   646  			Column: bouncer.FieldVersion,
   647  		})
   648  	}
   649  	if value, ok := buo.mutation.Until(); ok {
   650  		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
   651  			Type:   field.TypeTime,
   652  			Value:  value,
   653  			Column: bouncer.FieldUntil,
   654  		})
   655  	}
   656  	if buo.mutation.UntilCleared() {
   657  		_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
   658  			Type:   field.TypeTime,
   659  			Column: bouncer.FieldUntil,
   660  		})
   661  	}
   662  	if value, ok := buo.mutation.LastPull(); ok {
   663  		_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
   664  			Type:   field.TypeTime,
   665  			Value:  value,
   666  			Column: bouncer.FieldLastPull,
   667  		})
   668  	}
   669  	_node = &Bouncer{config: buo.config}
   670  	_spec.Assign = _node.assignValues
   671  	_spec.ScanValues = _node.scanValues
   672  	if err = sqlgraph.UpdateNode(ctx, buo.driver, _spec); err != nil {
   673  		if _, ok := err.(*sqlgraph.NotFoundError); ok {
   674  			err = &NotFoundError{bouncer.Label}
   675  		} else if cerr, ok := isSQLConstraintError(err); ok {
   676  			err = cerr
   677  		}
   678  		return nil, err
   679  	}
   680  	return _node, nil
   681  }