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