github.com/NpoolPlatform/chain-middleware@v0.0.0-20240228100535-eb1bcf896eb9/pkg/db/ent/appcoin_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 10 "entgo.io/ent/dialect/sql" 11 "entgo.io/ent/dialect/sql/sqlgraph" 12 "entgo.io/ent/schema/field" 13 "github.com/NpoolPlatform/chain-middleware/pkg/db/ent/appcoin" 14 "github.com/NpoolPlatform/chain-middleware/pkg/db/ent/predicate" 15 "github.com/google/uuid" 16 "github.com/shopspring/decimal" 17 ) 18 19 // AppCoinUpdate is the builder for updating AppCoin entities. 20 type AppCoinUpdate struct { 21 config 22 hooks []Hook 23 mutation *AppCoinMutation 24 modifiers []func(*sql.UpdateBuilder) 25 } 26 27 // Where appends a list predicates to the AppCoinUpdate builder. 28 func (acu *AppCoinUpdate) Where(ps ...predicate.AppCoin) *AppCoinUpdate { 29 acu.mutation.Where(ps...) 30 return acu 31 } 32 33 // SetCreatedAt sets the "created_at" field. 34 func (acu *AppCoinUpdate) SetCreatedAt(u uint32) *AppCoinUpdate { 35 acu.mutation.ResetCreatedAt() 36 acu.mutation.SetCreatedAt(u) 37 return acu 38 } 39 40 // SetNillableCreatedAt sets the "created_at" field if the given value is not nil. 41 func (acu *AppCoinUpdate) SetNillableCreatedAt(u *uint32) *AppCoinUpdate { 42 if u != nil { 43 acu.SetCreatedAt(*u) 44 } 45 return acu 46 } 47 48 // AddCreatedAt adds u to the "created_at" field. 49 func (acu *AppCoinUpdate) AddCreatedAt(u int32) *AppCoinUpdate { 50 acu.mutation.AddCreatedAt(u) 51 return acu 52 } 53 54 // SetUpdatedAt sets the "updated_at" field. 55 func (acu *AppCoinUpdate) SetUpdatedAt(u uint32) *AppCoinUpdate { 56 acu.mutation.ResetUpdatedAt() 57 acu.mutation.SetUpdatedAt(u) 58 return acu 59 } 60 61 // AddUpdatedAt adds u to the "updated_at" field. 62 func (acu *AppCoinUpdate) AddUpdatedAt(u int32) *AppCoinUpdate { 63 acu.mutation.AddUpdatedAt(u) 64 return acu 65 } 66 67 // SetDeletedAt sets the "deleted_at" field. 68 func (acu *AppCoinUpdate) SetDeletedAt(u uint32) *AppCoinUpdate { 69 acu.mutation.ResetDeletedAt() 70 acu.mutation.SetDeletedAt(u) 71 return acu 72 } 73 74 // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil. 75 func (acu *AppCoinUpdate) SetNillableDeletedAt(u *uint32) *AppCoinUpdate { 76 if u != nil { 77 acu.SetDeletedAt(*u) 78 } 79 return acu 80 } 81 82 // AddDeletedAt adds u to the "deleted_at" field. 83 func (acu *AppCoinUpdate) AddDeletedAt(u int32) *AppCoinUpdate { 84 acu.mutation.AddDeletedAt(u) 85 return acu 86 } 87 88 // SetEntID sets the "ent_id" field. 89 func (acu *AppCoinUpdate) SetEntID(u uuid.UUID) *AppCoinUpdate { 90 acu.mutation.SetEntID(u) 91 return acu 92 } 93 94 // SetNillableEntID sets the "ent_id" field if the given value is not nil. 95 func (acu *AppCoinUpdate) SetNillableEntID(u *uuid.UUID) *AppCoinUpdate { 96 if u != nil { 97 acu.SetEntID(*u) 98 } 99 return acu 100 } 101 102 // SetAppID sets the "app_id" field. 103 func (acu *AppCoinUpdate) SetAppID(u uuid.UUID) *AppCoinUpdate { 104 acu.mutation.SetAppID(u) 105 return acu 106 } 107 108 // SetNillableAppID sets the "app_id" field if the given value is not nil. 109 func (acu *AppCoinUpdate) SetNillableAppID(u *uuid.UUID) *AppCoinUpdate { 110 if u != nil { 111 acu.SetAppID(*u) 112 } 113 return acu 114 } 115 116 // ClearAppID clears the value of the "app_id" field. 117 func (acu *AppCoinUpdate) ClearAppID() *AppCoinUpdate { 118 acu.mutation.ClearAppID() 119 return acu 120 } 121 122 // SetCoinTypeID sets the "coin_type_id" field. 123 func (acu *AppCoinUpdate) SetCoinTypeID(u uuid.UUID) *AppCoinUpdate { 124 acu.mutation.SetCoinTypeID(u) 125 return acu 126 } 127 128 // SetNillableCoinTypeID sets the "coin_type_id" field if the given value is not nil. 129 func (acu *AppCoinUpdate) SetNillableCoinTypeID(u *uuid.UUID) *AppCoinUpdate { 130 if u != nil { 131 acu.SetCoinTypeID(*u) 132 } 133 return acu 134 } 135 136 // ClearCoinTypeID clears the value of the "coin_type_id" field. 137 func (acu *AppCoinUpdate) ClearCoinTypeID() *AppCoinUpdate { 138 acu.mutation.ClearCoinTypeID() 139 return acu 140 } 141 142 // SetName sets the "name" field. 143 func (acu *AppCoinUpdate) SetName(s string) *AppCoinUpdate { 144 acu.mutation.SetName(s) 145 return acu 146 } 147 148 // SetNillableName sets the "name" field if the given value is not nil. 149 func (acu *AppCoinUpdate) SetNillableName(s *string) *AppCoinUpdate { 150 if s != nil { 151 acu.SetName(*s) 152 } 153 return acu 154 } 155 156 // ClearName clears the value of the "name" field. 157 func (acu *AppCoinUpdate) ClearName() *AppCoinUpdate { 158 acu.mutation.ClearName() 159 return acu 160 } 161 162 // SetDisplayNames sets the "display_names" field. 163 func (acu *AppCoinUpdate) SetDisplayNames(s []string) *AppCoinUpdate { 164 acu.mutation.SetDisplayNames(s) 165 return acu 166 } 167 168 // ClearDisplayNames clears the value of the "display_names" field. 169 func (acu *AppCoinUpdate) ClearDisplayNames() *AppCoinUpdate { 170 acu.mutation.ClearDisplayNames() 171 return acu 172 } 173 174 // SetLogo sets the "logo" field. 175 func (acu *AppCoinUpdate) SetLogo(s string) *AppCoinUpdate { 176 acu.mutation.SetLogo(s) 177 return acu 178 } 179 180 // SetNillableLogo sets the "logo" field if the given value is not nil. 181 func (acu *AppCoinUpdate) SetNillableLogo(s *string) *AppCoinUpdate { 182 if s != nil { 183 acu.SetLogo(*s) 184 } 185 return acu 186 } 187 188 // ClearLogo clears the value of the "logo" field. 189 func (acu *AppCoinUpdate) ClearLogo() *AppCoinUpdate { 190 acu.mutation.ClearLogo() 191 return acu 192 } 193 194 // SetForPay sets the "for_pay" field. 195 func (acu *AppCoinUpdate) SetForPay(b bool) *AppCoinUpdate { 196 acu.mutation.SetForPay(b) 197 return acu 198 } 199 200 // SetNillableForPay sets the "for_pay" field if the given value is not nil. 201 func (acu *AppCoinUpdate) SetNillableForPay(b *bool) *AppCoinUpdate { 202 if b != nil { 203 acu.SetForPay(*b) 204 } 205 return acu 206 } 207 208 // ClearForPay clears the value of the "for_pay" field. 209 func (acu *AppCoinUpdate) ClearForPay() *AppCoinUpdate { 210 acu.mutation.ClearForPay() 211 return acu 212 } 213 214 // SetWithdrawAutoReviewAmount sets the "withdraw_auto_review_amount" field. 215 func (acu *AppCoinUpdate) SetWithdrawAutoReviewAmount(d decimal.Decimal) *AppCoinUpdate { 216 acu.mutation.SetWithdrawAutoReviewAmount(d) 217 return acu 218 } 219 220 // SetNillableWithdrawAutoReviewAmount sets the "withdraw_auto_review_amount" field if the given value is not nil. 221 func (acu *AppCoinUpdate) SetNillableWithdrawAutoReviewAmount(d *decimal.Decimal) *AppCoinUpdate { 222 if d != nil { 223 acu.SetWithdrawAutoReviewAmount(*d) 224 } 225 return acu 226 } 227 228 // ClearWithdrawAutoReviewAmount clears the value of the "withdraw_auto_review_amount" field. 229 func (acu *AppCoinUpdate) ClearWithdrawAutoReviewAmount() *AppCoinUpdate { 230 acu.mutation.ClearWithdrawAutoReviewAmount() 231 return acu 232 } 233 234 // SetProductPage sets the "product_page" field. 235 func (acu *AppCoinUpdate) SetProductPage(s string) *AppCoinUpdate { 236 acu.mutation.SetProductPage(s) 237 return acu 238 } 239 240 // SetNillableProductPage sets the "product_page" field if the given value is not nil. 241 func (acu *AppCoinUpdate) SetNillableProductPage(s *string) *AppCoinUpdate { 242 if s != nil { 243 acu.SetProductPage(*s) 244 } 245 return acu 246 } 247 248 // ClearProductPage clears the value of the "product_page" field. 249 func (acu *AppCoinUpdate) ClearProductPage() *AppCoinUpdate { 250 acu.mutation.ClearProductPage() 251 return acu 252 } 253 254 // SetDisabled sets the "disabled" field. 255 func (acu *AppCoinUpdate) SetDisabled(b bool) *AppCoinUpdate { 256 acu.mutation.SetDisabled(b) 257 return acu 258 } 259 260 // SetNillableDisabled sets the "disabled" field if the given value is not nil. 261 func (acu *AppCoinUpdate) SetNillableDisabled(b *bool) *AppCoinUpdate { 262 if b != nil { 263 acu.SetDisabled(*b) 264 } 265 return acu 266 } 267 268 // ClearDisabled clears the value of the "disabled" field. 269 func (acu *AppCoinUpdate) ClearDisabled() *AppCoinUpdate { 270 acu.mutation.ClearDisabled() 271 return acu 272 } 273 274 // SetDailyRewardAmount sets the "daily_reward_amount" field. 275 func (acu *AppCoinUpdate) SetDailyRewardAmount(d decimal.Decimal) *AppCoinUpdate { 276 acu.mutation.SetDailyRewardAmount(d) 277 return acu 278 } 279 280 // SetNillableDailyRewardAmount sets the "daily_reward_amount" field if the given value is not nil. 281 func (acu *AppCoinUpdate) SetNillableDailyRewardAmount(d *decimal.Decimal) *AppCoinUpdate { 282 if d != nil { 283 acu.SetDailyRewardAmount(*d) 284 } 285 return acu 286 } 287 288 // ClearDailyRewardAmount clears the value of the "daily_reward_amount" field. 289 func (acu *AppCoinUpdate) ClearDailyRewardAmount() *AppCoinUpdate { 290 acu.mutation.ClearDailyRewardAmount() 291 return acu 292 } 293 294 // SetDisplay sets the "display" field. 295 func (acu *AppCoinUpdate) SetDisplay(b bool) *AppCoinUpdate { 296 acu.mutation.SetDisplay(b) 297 return acu 298 } 299 300 // SetNillableDisplay sets the "display" field if the given value is not nil. 301 func (acu *AppCoinUpdate) SetNillableDisplay(b *bool) *AppCoinUpdate { 302 if b != nil { 303 acu.SetDisplay(*b) 304 } 305 return acu 306 } 307 308 // ClearDisplay clears the value of the "display" field. 309 func (acu *AppCoinUpdate) ClearDisplay() *AppCoinUpdate { 310 acu.mutation.ClearDisplay() 311 return acu 312 } 313 314 // SetDisplayIndex sets the "display_index" field. 315 func (acu *AppCoinUpdate) SetDisplayIndex(u uint32) *AppCoinUpdate { 316 acu.mutation.ResetDisplayIndex() 317 acu.mutation.SetDisplayIndex(u) 318 return acu 319 } 320 321 // SetNillableDisplayIndex sets the "display_index" field if the given value is not nil. 322 func (acu *AppCoinUpdate) SetNillableDisplayIndex(u *uint32) *AppCoinUpdate { 323 if u != nil { 324 acu.SetDisplayIndex(*u) 325 } 326 return acu 327 } 328 329 // AddDisplayIndex adds u to the "display_index" field. 330 func (acu *AppCoinUpdate) AddDisplayIndex(u int32) *AppCoinUpdate { 331 acu.mutation.AddDisplayIndex(u) 332 return acu 333 } 334 335 // ClearDisplayIndex clears the value of the "display_index" field. 336 func (acu *AppCoinUpdate) ClearDisplayIndex() *AppCoinUpdate { 337 acu.mutation.ClearDisplayIndex() 338 return acu 339 } 340 341 // SetMaxAmountPerWithdraw sets the "max_amount_per_withdraw" field. 342 func (acu *AppCoinUpdate) SetMaxAmountPerWithdraw(d decimal.Decimal) *AppCoinUpdate { 343 acu.mutation.SetMaxAmountPerWithdraw(d) 344 return acu 345 } 346 347 // SetNillableMaxAmountPerWithdraw sets the "max_amount_per_withdraw" field if the given value is not nil. 348 func (acu *AppCoinUpdate) SetNillableMaxAmountPerWithdraw(d *decimal.Decimal) *AppCoinUpdate { 349 if d != nil { 350 acu.SetMaxAmountPerWithdraw(*d) 351 } 352 return acu 353 } 354 355 // ClearMaxAmountPerWithdraw clears the value of the "max_amount_per_withdraw" field. 356 func (acu *AppCoinUpdate) ClearMaxAmountPerWithdraw() *AppCoinUpdate { 357 acu.mutation.ClearMaxAmountPerWithdraw() 358 return acu 359 } 360 361 // Mutation returns the AppCoinMutation object of the builder. 362 func (acu *AppCoinUpdate) Mutation() *AppCoinMutation { 363 return acu.mutation 364 } 365 366 // Save executes the query and returns the number of nodes affected by the update operation. 367 func (acu *AppCoinUpdate) Save(ctx context.Context) (int, error) { 368 var ( 369 err error 370 affected int 371 ) 372 if err := acu.defaults(); err != nil { 373 return 0, err 374 } 375 if len(acu.hooks) == 0 { 376 affected, err = acu.sqlSave(ctx) 377 } else { 378 var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { 379 mutation, ok := m.(*AppCoinMutation) 380 if !ok { 381 return nil, fmt.Errorf("unexpected mutation type %T", m) 382 } 383 acu.mutation = mutation 384 affected, err = acu.sqlSave(ctx) 385 mutation.done = true 386 return affected, err 387 }) 388 for i := len(acu.hooks) - 1; i >= 0; i-- { 389 if acu.hooks[i] == nil { 390 return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") 391 } 392 mut = acu.hooks[i](mut) 393 } 394 if _, err := mut.Mutate(ctx, acu.mutation); err != nil { 395 return 0, err 396 } 397 } 398 return affected, err 399 } 400 401 // SaveX is like Save, but panics if an error occurs. 402 func (acu *AppCoinUpdate) SaveX(ctx context.Context) int { 403 affected, err := acu.Save(ctx) 404 if err != nil { 405 panic(err) 406 } 407 return affected 408 } 409 410 // Exec executes the query. 411 func (acu *AppCoinUpdate) Exec(ctx context.Context) error { 412 _, err := acu.Save(ctx) 413 return err 414 } 415 416 // ExecX is like Exec, but panics if an error occurs. 417 func (acu *AppCoinUpdate) ExecX(ctx context.Context) { 418 if err := acu.Exec(ctx); err != nil { 419 panic(err) 420 } 421 } 422 423 // defaults sets the default values of the builder before save. 424 func (acu *AppCoinUpdate) defaults() error { 425 if _, ok := acu.mutation.UpdatedAt(); !ok { 426 if appcoin.UpdateDefaultUpdatedAt == nil { 427 return fmt.Errorf("ent: uninitialized appcoin.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)") 428 } 429 v := appcoin.UpdateDefaultUpdatedAt() 430 acu.mutation.SetUpdatedAt(v) 431 } 432 return nil 433 } 434 435 // Modify adds a statement modifier for attaching custom logic to the UPDATE statement. 436 func (acu *AppCoinUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *AppCoinUpdate { 437 acu.modifiers = append(acu.modifiers, modifiers...) 438 return acu 439 } 440 441 func (acu *AppCoinUpdate) sqlSave(ctx context.Context) (n int, err error) { 442 _spec := &sqlgraph.UpdateSpec{ 443 Node: &sqlgraph.NodeSpec{ 444 Table: appcoin.Table, 445 Columns: appcoin.Columns, 446 ID: &sqlgraph.FieldSpec{ 447 Type: field.TypeUint32, 448 Column: appcoin.FieldID, 449 }, 450 }, 451 } 452 if ps := acu.mutation.predicates; len(ps) > 0 { 453 _spec.Predicate = func(selector *sql.Selector) { 454 for i := range ps { 455 ps[i](selector) 456 } 457 } 458 } 459 if value, ok := acu.mutation.CreatedAt(); ok { 460 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 461 Type: field.TypeUint32, 462 Value: value, 463 Column: appcoin.FieldCreatedAt, 464 }) 465 } 466 if value, ok := acu.mutation.AddedCreatedAt(); ok { 467 _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ 468 Type: field.TypeUint32, 469 Value: value, 470 Column: appcoin.FieldCreatedAt, 471 }) 472 } 473 if value, ok := acu.mutation.UpdatedAt(); ok { 474 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 475 Type: field.TypeUint32, 476 Value: value, 477 Column: appcoin.FieldUpdatedAt, 478 }) 479 } 480 if value, ok := acu.mutation.AddedUpdatedAt(); ok { 481 _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ 482 Type: field.TypeUint32, 483 Value: value, 484 Column: appcoin.FieldUpdatedAt, 485 }) 486 } 487 if value, ok := acu.mutation.DeletedAt(); ok { 488 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 489 Type: field.TypeUint32, 490 Value: value, 491 Column: appcoin.FieldDeletedAt, 492 }) 493 } 494 if value, ok := acu.mutation.AddedDeletedAt(); ok { 495 _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ 496 Type: field.TypeUint32, 497 Value: value, 498 Column: appcoin.FieldDeletedAt, 499 }) 500 } 501 if value, ok := acu.mutation.EntID(); ok { 502 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 503 Type: field.TypeUUID, 504 Value: value, 505 Column: appcoin.FieldEntID, 506 }) 507 } 508 if value, ok := acu.mutation.AppID(); ok { 509 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 510 Type: field.TypeUUID, 511 Value: value, 512 Column: appcoin.FieldAppID, 513 }) 514 } 515 if acu.mutation.AppIDCleared() { 516 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 517 Type: field.TypeUUID, 518 Column: appcoin.FieldAppID, 519 }) 520 } 521 if value, ok := acu.mutation.CoinTypeID(); ok { 522 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 523 Type: field.TypeUUID, 524 Value: value, 525 Column: appcoin.FieldCoinTypeID, 526 }) 527 } 528 if acu.mutation.CoinTypeIDCleared() { 529 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 530 Type: field.TypeUUID, 531 Column: appcoin.FieldCoinTypeID, 532 }) 533 } 534 if value, ok := acu.mutation.Name(); ok { 535 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 536 Type: field.TypeString, 537 Value: value, 538 Column: appcoin.FieldName, 539 }) 540 } 541 if acu.mutation.NameCleared() { 542 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 543 Type: field.TypeString, 544 Column: appcoin.FieldName, 545 }) 546 } 547 if value, ok := acu.mutation.DisplayNames(); ok { 548 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 549 Type: field.TypeJSON, 550 Value: value, 551 Column: appcoin.FieldDisplayNames, 552 }) 553 } 554 if acu.mutation.DisplayNamesCleared() { 555 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 556 Type: field.TypeJSON, 557 Column: appcoin.FieldDisplayNames, 558 }) 559 } 560 if value, ok := acu.mutation.Logo(); ok { 561 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 562 Type: field.TypeString, 563 Value: value, 564 Column: appcoin.FieldLogo, 565 }) 566 } 567 if acu.mutation.LogoCleared() { 568 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 569 Type: field.TypeString, 570 Column: appcoin.FieldLogo, 571 }) 572 } 573 if value, ok := acu.mutation.ForPay(); ok { 574 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 575 Type: field.TypeBool, 576 Value: value, 577 Column: appcoin.FieldForPay, 578 }) 579 } 580 if acu.mutation.ForPayCleared() { 581 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 582 Type: field.TypeBool, 583 Column: appcoin.FieldForPay, 584 }) 585 } 586 if value, ok := acu.mutation.WithdrawAutoReviewAmount(); ok { 587 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 588 Type: field.TypeOther, 589 Value: value, 590 Column: appcoin.FieldWithdrawAutoReviewAmount, 591 }) 592 } 593 if acu.mutation.WithdrawAutoReviewAmountCleared() { 594 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 595 Type: field.TypeOther, 596 Column: appcoin.FieldWithdrawAutoReviewAmount, 597 }) 598 } 599 if value, ok := acu.mutation.ProductPage(); ok { 600 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 601 Type: field.TypeString, 602 Value: value, 603 Column: appcoin.FieldProductPage, 604 }) 605 } 606 if acu.mutation.ProductPageCleared() { 607 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 608 Type: field.TypeString, 609 Column: appcoin.FieldProductPage, 610 }) 611 } 612 if value, ok := acu.mutation.Disabled(); ok { 613 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 614 Type: field.TypeBool, 615 Value: value, 616 Column: appcoin.FieldDisabled, 617 }) 618 } 619 if acu.mutation.DisabledCleared() { 620 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 621 Type: field.TypeBool, 622 Column: appcoin.FieldDisabled, 623 }) 624 } 625 if value, ok := acu.mutation.DailyRewardAmount(); ok { 626 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 627 Type: field.TypeOther, 628 Value: value, 629 Column: appcoin.FieldDailyRewardAmount, 630 }) 631 } 632 if acu.mutation.DailyRewardAmountCleared() { 633 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 634 Type: field.TypeOther, 635 Column: appcoin.FieldDailyRewardAmount, 636 }) 637 } 638 if value, ok := acu.mutation.Display(); ok { 639 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 640 Type: field.TypeBool, 641 Value: value, 642 Column: appcoin.FieldDisplay, 643 }) 644 } 645 if acu.mutation.DisplayCleared() { 646 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 647 Type: field.TypeBool, 648 Column: appcoin.FieldDisplay, 649 }) 650 } 651 if value, ok := acu.mutation.DisplayIndex(); ok { 652 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 653 Type: field.TypeUint32, 654 Value: value, 655 Column: appcoin.FieldDisplayIndex, 656 }) 657 } 658 if value, ok := acu.mutation.AddedDisplayIndex(); ok { 659 _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ 660 Type: field.TypeUint32, 661 Value: value, 662 Column: appcoin.FieldDisplayIndex, 663 }) 664 } 665 if acu.mutation.DisplayIndexCleared() { 666 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 667 Type: field.TypeUint32, 668 Column: appcoin.FieldDisplayIndex, 669 }) 670 } 671 if value, ok := acu.mutation.MaxAmountPerWithdraw(); ok { 672 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 673 Type: field.TypeOther, 674 Value: value, 675 Column: appcoin.FieldMaxAmountPerWithdraw, 676 }) 677 } 678 if acu.mutation.MaxAmountPerWithdrawCleared() { 679 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 680 Type: field.TypeOther, 681 Column: appcoin.FieldMaxAmountPerWithdraw, 682 }) 683 } 684 _spec.Modifiers = acu.modifiers 685 if n, err = sqlgraph.UpdateNodes(ctx, acu.driver, _spec); err != nil { 686 if _, ok := err.(*sqlgraph.NotFoundError); ok { 687 err = &NotFoundError{appcoin.Label} 688 } else if sqlgraph.IsConstraintError(err) { 689 err = &ConstraintError{msg: err.Error(), wrap: err} 690 } 691 return 0, err 692 } 693 return n, nil 694 } 695 696 // AppCoinUpdateOne is the builder for updating a single AppCoin entity. 697 type AppCoinUpdateOne struct { 698 config 699 fields []string 700 hooks []Hook 701 mutation *AppCoinMutation 702 modifiers []func(*sql.UpdateBuilder) 703 } 704 705 // SetCreatedAt sets the "created_at" field. 706 func (acuo *AppCoinUpdateOne) SetCreatedAt(u uint32) *AppCoinUpdateOne { 707 acuo.mutation.ResetCreatedAt() 708 acuo.mutation.SetCreatedAt(u) 709 return acuo 710 } 711 712 // SetNillableCreatedAt sets the "created_at" field if the given value is not nil. 713 func (acuo *AppCoinUpdateOne) SetNillableCreatedAt(u *uint32) *AppCoinUpdateOne { 714 if u != nil { 715 acuo.SetCreatedAt(*u) 716 } 717 return acuo 718 } 719 720 // AddCreatedAt adds u to the "created_at" field. 721 func (acuo *AppCoinUpdateOne) AddCreatedAt(u int32) *AppCoinUpdateOne { 722 acuo.mutation.AddCreatedAt(u) 723 return acuo 724 } 725 726 // SetUpdatedAt sets the "updated_at" field. 727 func (acuo *AppCoinUpdateOne) SetUpdatedAt(u uint32) *AppCoinUpdateOne { 728 acuo.mutation.ResetUpdatedAt() 729 acuo.mutation.SetUpdatedAt(u) 730 return acuo 731 } 732 733 // AddUpdatedAt adds u to the "updated_at" field. 734 func (acuo *AppCoinUpdateOne) AddUpdatedAt(u int32) *AppCoinUpdateOne { 735 acuo.mutation.AddUpdatedAt(u) 736 return acuo 737 } 738 739 // SetDeletedAt sets the "deleted_at" field. 740 func (acuo *AppCoinUpdateOne) SetDeletedAt(u uint32) *AppCoinUpdateOne { 741 acuo.mutation.ResetDeletedAt() 742 acuo.mutation.SetDeletedAt(u) 743 return acuo 744 } 745 746 // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil. 747 func (acuo *AppCoinUpdateOne) SetNillableDeletedAt(u *uint32) *AppCoinUpdateOne { 748 if u != nil { 749 acuo.SetDeletedAt(*u) 750 } 751 return acuo 752 } 753 754 // AddDeletedAt adds u to the "deleted_at" field. 755 func (acuo *AppCoinUpdateOne) AddDeletedAt(u int32) *AppCoinUpdateOne { 756 acuo.mutation.AddDeletedAt(u) 757 return acuo 758 } 759 760 // SetEntID sets the "ent_id" field. 761 func (acuo *AppCoinUpdateOne) SetEntID(u uuid.UUID) *AppCoinUpdateOne { 762 acuo.mutation.SetEntID(u) 763 return acuo 764 } 765 766 // SetNillableEntID sets the "ent_id" field if the given value is not nil. 767 func (acuo *AppCoinUpdateOne) SetNillableEntID(u *uuid.UUID) *AppCoinUpdateOne { 768 if u != nil { 769 acuo.SetEntID(*u) 770 } 771 return acuo 772 } 773 774 // SetAppID sets the "app_id" field. 775 func (acuo *AppCoinUpdateOne) SetAppID(u uuid.UUID) *AppCoinUpdateOne { 776 acuo.mutation.SetAppID(u) 777 return acuo 778 } 779 780 // SetNillableAppID sets the "app_id" field if the given value is not nil. 781 func (acuo *AppCoinUpdateOne) SetNillableAppID(u *uuid.UUID) *AppCoinUpdateOne { 782 if u != nil { 783 acuo.SetAppID(*u) 784 } 785 return acuo 786 } 787 788 // ClearAppID clears the value of the "app_id" field. 789 func (acuo *AppCoinUpdateOne) ClearAppID() *AppCoinUpdateOne { 790 acuo.mutation.ClearAppID() 791 return acuo 792 } 793 794 // SetCoinTypeID sets the "coin_type_id" field. 795 func (acuo *AppCoinUpdateOne) SetCoinTypeID(u uuid.UUID) *AppCoinUpdateOne { 796 acuo.mutation.SetCoinTypeID(u) 797 return acuo 798 } 799 800 // SetNillableCoinTypeID sets the "coin_type_id" field if the given value is not nil. 801 func (acuo *AppCoinUpdateOne) SetNillableCoinTypeID(u *uuid.UUID) *AppCoinUpdateOne { 802 if u != nil { 803 acuo.SetCoinTypeID(*u) 804 } 805 return acuo 806 } 807 808 // ClearCoinTypeID clears the value of the "coin_type_id" field. 809 func (acuo *AppCoinUpdateOne) ClearCoinTypeID() *AppCoinUpdateOne { 810 acuo.mutation.ClearCoinTypeID() 811 return acuo 812 } 813 814 // SetName sets the "name" field. 815 func (acuo *AppCoinUpdateOne) SetName(s string) *AppCoinUpdateOne { 816 acuo.mutation.SetName(s) 817 return acuo 818 } 819 820 // SetNillableName sets the "name" field if the given value is not nil. 821 func (acuo *AppCoinUpdateOne) SetNillableName(s *string) *AppCoinUpdateOne { 822 if s != nil { 823 acuo.SetName(*s) 824 } 825 return acuo 826 } 827 828 // ClearName clears the value of the "name" field. 829 func (acuo *AppCoinUpdateOne) ClearName() *AppCoinUpdateOne { 830 acuo.mutation.ClearName() 831 return acuo 832 } 833 834 // SetDisplayNames sets the "display_names" field. 835 func (acuo *AppCoinUpdateOne) SetDisplayNames(s []string) *AppCoinUpdateOne { 836 acuo.mutation.SetDisplayNames(s) 837 return acuo 838 } 839 840 // ClearDisplayNames clears the value of the "display_names" field. 841 func (acuo *AppCoinUpdateOne) ClearDisplayNames() *AppCoinUpdateOne { 842 acuo.mutation.ClearDisplayNames() 843 return acuo 844 } 845 846 // SetLogo sets the "logo" field. 847 func (acuo *AppCoinUpdateOne) SetLogo(s string) *AppCoinUpdateOne { 848 acuo.mutation.SetLogo(s) 849 return acuo 850 } 851 852 // SetNillableLogo sets the "logo" field if the given value is not nil. 853 func (acuo *AppCoinUpdateOne) SetNillableLogo(s *string) *AppCoinUpdateOne { 854 if s != nil { 855 acuo.SetLogo(*s) 856 } 857 return acuo 858 } 859 860 // ClearLogo clears the value of the "logo" field. 861 func (acuo *AppCoinUpdateOne) ClearLogo() *AppCoinUpdateOne { 862 acuo.mutation.ClearLogo() 863 return acuo 864 } 865 866 // SetForPay sets the "for_pay" field. 867 func (acuo *AppCoinUpdateOne) SetForPay(b bool) *AppCoinUpdateOne { 868 acuo.mutation.SetForPay(b) 869 return acuo 870 } 871 872 // SetNillableForPay sets the "for_pay" field if the given value is not nil. 873 func (acuo *AppCoinUpdateOne) SetNillableForPay(b *bool) *AppCoinUpdateOne { 874 if b != nil { 875 acuo.SetForPay(*b) 876 } 877 return acuo 878 } 879 880 // ClearForPay clears the value of the "for_pay" field. 881 func (acuo *AppCoinUpdateOne) ClearForPay() *AppCoinUpdateOne { 882 acuo.mutation.ClearForPay() 883 return acuo 884 } 885 886 // SetWithdrawAutoReviewAmount sets the "withdraw_auto_review_amount" field. 887 func (acuo *AppCoinUpdateOne) SetWithdrawAutoReviewAmount(d decimal.Decimal) *AppCoinUpdateOne { 888 acuo.mutation.SetWithdrawAutoReviewAmount(d) 889 return acuo 890 } 891 892 // SetNillableWithdrawAutoReviewAmount sets the "withdraw_auto_review_amount" field if the given value is not nil. 893 func (acuo *AppCoinUpdateOne) SetNillableWithdrawAutoReviewAmount(d *decimal.Decimal) *AppCoinUpdateOne { 894 if d != nil { 895 acuo.SetWithdrawAutoReviewAmount(*d) 896 } 897 return acuo 898 } 899 900 // ClearWithdrawAutoReviewAmount clears the value of the "withdraw_auto_review_amount" field. 901 func (acuo *AppCoinUpdateOne) ClearWithdrawAutoReviewAmount() *AppCoinUpdateOne { 902 acuo.mutation.ClearWithdrawAutoReviewAmount() 903 return acuo 904 } 905 906 // SetProductPage sets the "product_page" field. 907 func (acuo *AppCoinUpdateOne) SetProductPage(s string) *AppCoinUpdateOne { 908 acuo.mutation.SetProductPage(s) 909 return acuo 910 } 911 912 // SetNillableProductPage sets the "product_page" field if the given value is not nil. 913 func (acuo *AppCoinUpdateOne) SetNillableProductPage(s *string) *AppCoinUpdateOne { 914 if s != nil { 915 acuo.SetProductPage(*s) 916 } 917 return acuo 918 } 919 920 // ClearProductPage clears the value of the "product_page" field. 921 func (acuo *AppCoinUpdateOne) ClearProductPage() *AppCoinUpdateOne { 922 acuo.mutation.ClearProductPage() 923 return acuo 924 } 925 926 // SetDisabled sets the "disabled" field. 927 func (acuo *AppCoinUpdateOne) SetDisabled(b bool) *AppCoinUpdateOne { 928 acuo.mutation.SetDisabled(b) 929 return acuo 930 } 931 932 // SetNillableDisabled sets the "disabled" field if the given value is not nil. 933 func (acuo *AppCoinUpdateOne) SetNillableDisabled(b *bool) *AppCoinUpdateOne { 934 if b != nil { 935 acuo.SetDisabled(*b) 936 } 937 return acuo 938 } 939 940 // ClearDisabled clears the value of the "disabled" field. 941 func (acuo *AppCoinUpdateOne) ClearDisabled() *AppCoinUpdateOne { 942 acuo.mutation.ClearDisabled() 943 return acuo 944 } 945 946 // SetDailyRewardAmount sets the "daily_reward_amount" field. 947 func (acuo *AppCoinUpdateOne) SetDailyRewardAmount(d decimal.Decimal) *AppCoinUpdateOne { 948 acuo.mutation.SetDailyRewardAmount(d) 949 return acuo 950 } 951 952 // SetNillableDailyRewardAmount sets the "daily_reward_amount" field if the given value is not nil. 953 func (acuo *AppCoinUpdateOne) SetNillableDailyRewardAmount(d *decimal.Decimal) *AppCoinUpdateOne { 954 if d != nil { 955 acuo.SetDailyRewardAmount(*d) 956 } 957 return acuo 958 } 959 960 // ClearDailyRewardAmount clears the value of the "daily_reward_amount" field. 961 func (acuo *AppCoinUpdateOne) ClearDailyRewardAmount() *AppCoinUpdateOne { 962 acuo.mutation.ClearDailyRewardAmount() 963 return acuo 964 } 965 966 // SetDisplay sets the "display" field. 967 func (acuo *AppCoinUpdateOne) SetDisplay(b bool) *AppCoinUpdateOne { 968 acuo.mutation.SetDisplay(b) 969 return acuo 970 } 971 972 // SetNillableDisplay sets the "display" field if the given value is not nil. 973 func (acuo *AppCoinUpdateOne) SetNillableDisplay(b *bool) *AppCoinUpdateOne { 974 if b != nil { 975 acuo.SetDisplay(*b) 976 } 977 return acuo 978 } 979 980 // ClearDisplay clears the value of the "display" field. 981 func (acuo *AppCoinUpdateOne) ClearDisplay() *AppCoinUpdateOne { 982 acuo.mutation.ClearDisplay() 983 return acuo 984 } 985 986 // SetDisplayIndex sets the "display_index" field. 987 func (acuo *AppCoinUpdateOne) SetDisplayIndex(u uint32) *AppCoinUpdateOne { 988 acuo.mutation.ResetDisplayIndex() 989 acuo.mutation.SetDisplayIndex(u) 990 return acuo 991 } 992 993 // SetNillableDisplayIndex sets the "display_index" field if the given value is not nil. 994 func (acuo *AppCoinUpdateOne) SetNillableDisplayIndex(u *uint32) *AppCoinUpdateOne { 995 if u != nil { 996 acuo.SetDisplayIndex(*u) 997 } 998 return acuo 999 } 1000 1001 // AddDisplayIndex adds u to the "display_index" field. 1002 func (acuo *AppCoinUpdateOne) AddDisplayIndex(u int32) *AppCoinUpdateOne { 1003 acuo.mutation.AddDisplayIndex(u) 1004 return acuo 1005 } 1006 1007 // ClearDisplayIndex clears the value of the "display_index" field. 1008 func (acuo *AppCoinUpdateOne) ClearDisplayIndex() *AppCoinUpdateOne { 1009 acuo.mutation.ClearDisplayIndex() 1010 return acuo 1011 } 1012 1013 // SetMaxAmountPerWithdraw sets the "max_amount_per_withdraw" field. 1014 func (acuo *AppCoinUpdateOne) SetMaxAmountPerWithdraw(d decimal.Decimal) *AppCoinUpdateOne { 1015 acuo.mutation.SetMaxAmountPerWithdraw(d) 1016 return acuo 1017 } 1018 1019 // SetNillableMaxAmountPerWithdraw sets the "max_amount_per_withdraw" field if the given value is not nil. 1020 func (acuo *AppCoinUpdateOne) SetNillableMaxAmountPerWithdraw(d *decimal.Decimal) *AppCoinUpdateOne { 1021 if d != nil { 1022 acuo.SetMaxAmountPerWithdraw(*d) 1023 } 1024 return acuo 1025 } 1026 1027 // ClearMaxAmountPerWithdraw clears the value of the "max_amount_per_withdraw" field. 1028 func (acuo *AppCoinUpdateOne) ClearMaxAmountPerWithdraw() *AppCoinUpdateOne { 1029 acuo.mutation.ClearMaxAmountPerWithdraw() 1030 return acuo 1031 } 1032 1033 // Mutation returns the AppCoinMutation object of the builder. 1034 func (acuo *AppCoinUpdateOne) Mutation() *AppCoinMutation { 1035 return acuo.mutation 1036 } 1037 1038 // Select allows selecting one or more fields (columns) of the returned entity. 1039 // The default is selecting all fields defined in the entity schema. 1040 func (acuo *AppCoinUpdateOne) Select(field string, fields ...string) *AppCoinUpdateOne { 1041 acuo.fields = append([]string{field}, fields...) 1042 return acuo 1043 } 1044 1045 // Save executes the query and returns the updated AppCoin entity. 1046 func (acuo *AppCoinUpdateOne) Save(ctx context.Context) (*AppCoin, error) { 1047 var ( 1048 err error 1049 node *AppCoin 1050 ) 1051 if err := acuo.defaults(); err != nil { 1052 return nil, err 1053 } 1054 if len(acuo.hooks) == 0 { 1055 node, err = acuo.sqlSave(ctx) 1056 } else { 1057 var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { 1058 mutation, ok := m.(*AppCoinMutation) 1059 if !ok { 1060 return nil, fmt.Errorf("unexpected mutation type %T", m) 1061 } 1062 acuo.mutation = mutation 1063 node, err = acuo.sqlSave(ctx) 1064 mutation.done = true 1065 return node, err 1066 }) 1067 for i := len(acuo.hooks) - 1; i >= 0; i-- { 1068 if acuo.hooks[i] == nil { 1069 return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") 1070 } 1071 mut = acuo.hooks[i](mut) 1072 } 1073 v, err := mut.Mutate(ctx, acuo.mutation) 1074 if err != nil { 1075 return nil, err 1076 } 1077 nv, ok := v.(*AppCoin) 1078 if !ok { 1079 return nil, fmt.Errorf("unexpected node type %T returned from AppCoinMutation", v) 1080 } 1081 node = nv 1082 } 1083 return node, err 1084 } 1085 1086 // SaveX is like Save, but panics if an error occurs. 1087 func (acuo *AppCoinUpdateOne) SaveX(ctx context.Context) *AppCoin { 1088 node, err := acuo.Save(ctx) 1089 if err != nil { 1090 panic(err) 1091 } 1092 return node 1093 } 1094 1095 // Exec executes the query on the entity. 1096 func (acuo *AppCoinUpdateOne) Exec(ctx context.Context) error { 1097 _, err := acuo.Save(ctx) 1098 return err 1099 } 1100 1101 // ExecX is like Exec, but panics if an error occurs. 1102 func (acuo *AppCoinUpdateOne) ExecX(ctx context.Context) { 1103 if err := acuo.Exec(ctx); err != nil { 1104 panic(err) 1105 } 1106 } 1107 1108 // defaults sets the default values of the builder before save. 1109 func (acuo *AppCoinUpdateOne) defaults() error { 1110 if _, ok := acuo.mutation.UpdatedAt(); !ok { 1111 if appcoin.UpdateDefaultUpdatedAt == nil { 1112 return fmt.Errorf("ent: uninitialized appcoin.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)") 1113 } 1114 v := appcoin.UpdateDefaultUpdatedAt() 1115 acuo.mutation.SetUpdatedAt(v) 1116 } 1117 return nil 1118 } 1119 1120 // Modify adds a statement modifier for attaching custom logic to the UPDATE statement. 1121 func (acuo *AppCoinUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *AppCoinUpdateOne { 1122 acuo.modifiers = append(acuo.modifiers, modifiers...) 1123 return acuo 1124 } 1125 1126 func (acuo *AppCoinUpdateOne) sqlSave(ctx context.Context) (_node *AppCoin, err error) { 1127 _spec := &sqlgraph.UpdateSpec{ 1128 Node: &sqlgraph.NodeSpec{ 1129 Table: appcoin.Table, 1130 Columns: appcoin.Columns, 1131 ID: &sqlgraph.FieldSpec{ 1132 Type: field.TypeUint32, 1133 Column: appcoin.FieldID, 1134 }, 1135 }, 1136 } 1137 id, ok := acuo.mutation.ID() 1138 if !ok { 1139 return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "AppCoin.id" for update`)} 1140 } 1141 _spec.Node.ID.Value = id 1142 if fields := acuo.fields; len(fields) > 0 { 1143 _spec.Node.Columns = make([]string, 0, len(fields)) 1144 _spec.Node.Columns = append(_spec.Node.Columns, appcoin.FieldID) 1145 for _, f := range fields { 1146 if !appcoin.ValidColumn(f) { 1147 return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} 1148 } 1149 if f != appcoin.FieldID { 1150 _spec.Node.Columns = append(_spec.Node.Columns, f) 1151 } 1152 } 1153 } 1154 if ps := acuo.mutation.predicates; len(ps) > 0 { 1155 _spec.Predicate = func(selector *sql.Selector) { 1156 for i := range ps { 1157 ps[i](selector) 1158 } 1159 } 1160 } 1161 if value, ok := acuo.mutation.CreatedAt(); ok { 1162 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 1163 Type: field.TypeUint32, 1164 Value: value, 1165 Column: appcoin.FieldCreatedAt, 1166 }) 1167 } 1168 if value, ok := acuo.mutation.AddedCreatedAt(); ok { 1169 _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ 1170 Type: field.TypeUint32, 1171 Value: value, 1172 Column: appcoin.FieldCreatedAt, 1173 }) 1174 } 1175 if value, ok := acuo.mutation.UpdatedAt(); ok { 1176 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 1177 Type: field.TypeUint32, 1178 Value: value, 1179 Column: appcoin.FieldUpdatedAt, 1180 }) 1181 } 1182 if value, ok := acuo.mutation.AddedUpdatedAt(); ok { 1183 _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ 1184 Type: field.TypeUint32, 1185 Value: value, 1186 Column: appcoin.FieldUpdatedAt, 1187 }) 1188 } 1189 if value, ok := acuo.mutation.DeletedAt(); ok { 1190 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 1191 Type: field.TypeUint32, 1192 Value: value, 1193 Column: appcoin.FieldDeletedAt, 1194 }) 1195 } 1196 if value, ok := acuo.mutation.AddedDeletedAt(); ok { 1197 _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ 1198 Type: field.TypeUint32, 1199 Value: value, 1200 Column: appcoin.FieldDeletedAt, 1201 }) 1202 } 1203 if value, ok := acuo.mutation.EntID(); ok { 1204 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 1205 Type: field.TypeUUID, 1206 Value: value, 1207 Column: appcoin.FieldEntID, 1208 }) 1209 } 1210 if value, ok := acuo.mutation.AppID(); ok { 1211 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 1212 Type: field.TypeUUID, 1213 Value: value, 1214 Column: appcoin.FieldAppID, 1215 }) 1216 } 1217 if acuo.mutation.AppIDCleared() { 1218 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 1219 Type: field.TypeUUID, 1220 Column: appcoin.FieldAppID, 1221 }) 1222 } 1223 if value, ok := acuo.mutation.CoinTypeID(); ok { 1224 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 1225 Type: field.TypeUUID, 1226 Value: value, 1227 Column: appcoin.FieldCoinTypeID, 1228 }) 1229 } 1230 if acuo.mutation.CoinTypeIDCleared() { 1231 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 1232 Type: field.TypeUUID, 1233 Column: appcoin.FieldCoinTypeID, 1234 }) 1235 } 1236 if value, ok := acuo.mutation.Name(); ok { 1237 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 1238 Type: field.TypeString, 1239 Value: value, 1240 Column: appcoin.FieldName, 1241 }) 1242 } 1243 if acuo.mutation.NameCleared() { 1244 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 1245 Type: field.TypeString, 1246 Column: appcoin.FieldName, 1247 }) 1248 } 1249 if value, ok := acuo.mutation.DisplayNames(); ok { 1250 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 1251 Type: field.TypeJSON, 1252 Value: value, 1253 Column: appcoin.FieldDisplayNames, 1254 }) 1255 } 1256 if acuo.mutation.DisplayNamesCleared() { 1257 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 1258 Type: field.TypeJSON, 1259 Column: appcoin.FieldDisplayNames, 1260 }) 1261 } 1262 if value, ok := acuo.mutation.Logo(); ok { 1263 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 1264 Type: field.TypeString, 1265 Value: value, 1266 Column: appcoin.FieldLogo, 1267 }) 1268 } 1269 if acuo.mutation.LogoCleared() { 1270 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 1271 Type: field.TypeString, 1272 Column: appcoin.FieldLogo, 1273 }) 1274 } 1275 if value, ok := acuo.mutation.ForPay(); ok { 1276 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 1277 Type: field.TypeBool, 1278 Value: value, 1279 Column: appcoin.FieldForPay, 1280 }) 1281 } 1282 if acuo.mutation.ForPayCleared() { 1283 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 1284 Type: field.TypeBool, 1285 Column: appcoin.FieldForPay, 1286 }) 1287 } 1288 if value, ok := acuo.mutation.WithdrawAutoReviewAmount(); ok { 1289 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 1290 Type: field.TypeOther, 1291 Value: value, 1292 Column: appcoin.FieldWithdrawAutoReviewAmount, 1293 }) 1294 } 1295 if acuo.mutation.WithdrawAutoReviewAmountCleared() { 1296 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 1297 Type: field.TypeOther, 1298 Column: appcoin.FieldWithdrawAutoReviewAmount, 1299 }) 1300 } 1301 if value, ok := acuo.mutation.ProductPage(); ok { 1302 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 1303 Type: field.TypeString, 1304 Value: value, 1305 Column: appcoin.FieldProductPage, 1306 }) 1307 } 1308 if acuo.mutation.ProductPageCleared() { 1309 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 1310 Type: field.TypeString, 1311 Column: appcoin.FieldProductPage, 1312 }) 1313 } 1314 if value, ok := acuo.mutation.Disabled(); ok { 1315 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 1316 Type: field.TypeBool, 1317 Value: value, 1318 Column: appcoin.FieldDisabled, 1319 }) 1320 } 1321 if acuo.mutation.DisabledCleared() { 1322 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 1323 Type: field.TypeBool, 1324 Column: appcoin.FieldDisabled, 1325 }) 1326 } 1327 if value, ok := acuo.mutation.DailyRewardAmount(); ok { 1328 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 1329 Type: field.TypeOther, 1330 Value: value, 1331 Column: appcoin.FieldDailyRewardAmount, 1332 }) 1333 } 1334 if acuo.mutation.DailyRewardAmountCleared() { 1335 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 1336 Type: field.TypeOther, 1337 Column: appcoin.FieldDailyRewardAmount, 1338 }) 1339 } 1340 if value, ok := acuo.mutation.Display(); ok { 1341 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 1342 Type: field.TypeBool, 1343 Value: value, 1344 Column: appcoin.FieldDisplay, 1345 }) 1346 } 1347 if acuo.mutation.DisplayCleared() { 1348 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 1349 Type: field.TypeBool, 1350 Column: appcoin.FieldDisplay, 1351 }) 1352 } 1353 if value, ok := acuo.mutation.DisplayIndex(); ok { 1354 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 1355 Type: field.TypeUint32, 1356 Value: value, 1357 Column: appcoin.FieldDisplayIndex, 1358 }) 1359 } 1360 if value, ok := acuo.mutation.AddedDisplayIndex(); ok { 1361 _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ 1362 Type: field.TypeUint32, 1363 Value: value, 1364 Column: appcoin.FieldDisplayIndex, 1365 }) 1366 } 1367 if acuo.mutation.DisplayIndexCleared() { 1368 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 1369 Type: field.TypeUint32, 1370 Column: appcoin.FieldDisplayIndex, 1371 }) 1372 } 1373 if value, ok := acuo.mutation.MaxAmountPerWithdraw(); ok { 1374 _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ 1375 Type: field.TypeOther, 1376 Value: value, 1377 Column: appcoin.FieldMaxAmountPerWithdraw, 1378 }) 1379 } 1380 if acuo.mutation.MaxAmountPerWithdrawCleared() { 1381 _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ 1382 Type: field.TypeOther, 1383 Column: appcoin.FieldMaxAmountPerWithdraw, 1384 }) 1385 } 1386 _spec.Modifiers = acuo.modifiers 1387 _node = &AppCoin{config: acuo.config} 1388 _spec.Assign = _node.assignValues 1389 _spec.ScanValues = _node.scanValues 1390 if err = sqlgraph.UpdateNode(ctx, acuo.driver, _spec); err != nil { 1391 if _, ok := err.(*sqlgraph.NotFoundError); ok { 1392 err = &NotFoundError{appcoin.Label} 1393 } else if sqlgraph.IsConstraintError(err) { 1394 err = &ConstraintError{msg: err.Error(), wrap: err} 1395 } 1396 return nil, err 1397 } 1398 return _node, nil 1399 }