123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660 |
- // Code generated by ent, DO NOT EDIT.
- package ent
- import (
- "context"
- "errors"
- "fmt"
- "time"
- "wechat-api/ent/payrecharge"
- "wechat-api/ent/predicate"
- "entgo.io/ent/dialect/sql"
- "entgo.io/ent/dialect/sql/sqlgraph"
- "entgo.io/ent/schema/field"
- )
- // PayRechargeUpdate is the builder for updating PayRecharge entities.
- type PayRechargeUpdate struct {
- config
- hooks []Hook
- mutation *PayRechargeMutation
- }
- // Where appends a list predicates to the PayRechargeUpdate builder.
- func (pru *PayRechargeUpdate) Where(ps ...predicate.PayRecharge) *PayRechargeUpdate {
- pru.mutation.Where(ps...)
- return pru
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (pru *PayRechargeUpdate) SetUpdatedAt(t time.Time) *PayRechargeUpdate {
- pru.mutation.SetUpdatedAt(t)
- return pru
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (pru *PayRechargeUpdate) SetDeletedAt(t time.Time) *PayRechargeUpdate {
- pru.mutation.SetDeletedAt(t)
- return pru
- }
- // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
- func (pru *PayRechargeUpdate) SetNillableDeletedAt(t *time.Time) *PayRechargeUpdate {
- if t != nil {
- pru.SetDeletedAt(*t)
- }
- return pru
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (pru *PayRechargeUpdate) ClearDeletedAt() *PayRechargeUpdate {
- pru.mutation.ClearDeletedAt()
- return pru
- }
- // SetUserID sets the "user_id" field.
- func (pru *PayRechargeUpdate) SetUserID(s string) *PayRechargeUpdate {
- pru.mutation.SetUserID(s)
- return pru
- }
- // SetNillableUserID sets the "user_id" field if the given value is not nil.
- func (pru *PayRechargeUpdate) SetNillableUserID(s *string) *PayRechargeUpdate {
- if s != nil {
- pru.SetUserID(*s)
- }
- return pru
- }
- // SetNumber sets the "number" field.
- func (pru *PayRechargeUpdate) SetNumber(f float32) *PayRechargeUpdate {
- pru.mutation.ResetNumber()
- pru.mutation.SetNumber(f)
- return pru
- }
- // SetNillableNumber sets the "number" field if the given value is not nil.
- func (pru *PayRechargeUpdate) SetNillableNumber(f *float32) *PayRechargeUpdate {
- if f != nil {
- pru.SetNumber(*f)
- }
- return pru
- }
- // AddNumber adds f to the "number" field.
- func (pru *PayRechargeUpdate) AddNumber(f float32) *PayRechargeUpdate {
- pru.mutation.AddNumber(f)
- return pru
- }
- // SetStatus sets the "status" field.
- func (pru *PayRechargeUpdate) SetStatus(i int) *PayRechargeUpdate {
- pru.mutation.ResetStatus()
- pru.mutation.SetStatus(i)
- return pru
- }
- // SetNillableStatus sets the "status" field if the given value is not nil.
- func (pru *PayRechargeUpdate) SetNillableStatus(i *int) *PayRechargeUpdate {
- if i != nil {
- pru.SetStatus(*i)
- }
- return pru
- }
- // AddStatus adds i to the "status" field.
- func (pru *PayRechargeUpdate) AddStatus(i int) *PayRechargeUpdate {
- pru.mutation.AddStatus(i)
- return pru
- }
- // ClearStatus clears the value of the "status" field.
- func (pru *PayRechargeUpdate) ClearStatus() *PayRechargeUpdate {
- pru.mutation.ClearStatus()
- return pru
- }
- // SetMoney sets the "money" field.
- func (pru *PayRechargeUpdate) SetMoney(f float32) *PayRechargeUpdate {
- pru.mutation.ResetMoney()
- pru.mutation.SetMoney(f)
- return pru
- }
- // SetNillableMoney sets the "money" field if the given value is not nil.
- func (pru *PayRechargeUpdate) SetNillableMoney(f *float32) *PayRechargeUpdate {
- if f != nil {
- pru.SetMoney(*f)
- }
- return pru
- }
- // AddMoney adds f to the "money" field.
- func (pru *PayRechargeUpdate) AddMoney(f float32) *PayRechargeUpdate {
- pru.mutation.AddMoney(f)
- return pru
- }
- // ClearMoney clears the value of the "money" field.
- func (pru *PayRechargeUpdate) ClearMoney() *PayRechargeUpdate {
- pru.mutation.ClearMoney()
- return pru
- }
- // SetOutTradeNo sets the "out_trade_no" field.
- func (pru *PayRechargeUpdate) SetOutTradeNo(s string) *PayRechargeUpdate {
- pru.mutation.SetOutTradeNo(s)
- return pru
- }
- // SetNillableOutTradeNo sets the "out_trade_no" field if the given value is not nil.
- func (pru *PayRechargeUpdate) SetNillableOutTradeNo(s *string) *PayRechargeUpdate {
- if s != nil {
- pru.SetOutTradeNo(*s)
- }
- return pru
- }
- // ClearOutTradeNo clears the value of the "out_trade_no" field.
- func (pru *PayRechargeUpdate) ClearOutTradeNo() *PayRechargeUpdate {
- pru.mutation.ClearOutTradeNo()
- return pru
- }
- // SetOrganizationID sets the "organization_id" field.
- func (pru *PayRechargeUpdate) SetOrganizationID(u uint64) *PayRechargeUpdate {
- pru.mutation.ResetOrganizationID()
- pru.mutation.SetOrganizationID(u)
- return pru
- }
- // SetNillableOrganizationID sets the "organization_id" field if the given value is not nil.
- func (pru *PayRechargeUpdate) SetNillableOrganizationID(u *uint64) *PayRechargeUpdate {
- if u != nil {
- pru.SetOrganizationID(*u)
- }
- return pru
- }
- // AddOrganizationID adds u to the "organization_id" field.
- func (pru *PayRechargeUpdate) AddOrganizationID(u int64) *PayRechargeUpdate {
- pru.mutation.AddOrganizationID(u)
- return pru
- }
- // Mutation returns the PayRechargeMutation object of the builder.
- func (pru *PayRechargeUpdate) Mutation() *PayRechargeMutation {
- return pru.mutation
- }
- // Save executes the query and returns the number of nodes affected by the update operation.
- func (pru *PayRechargeUpdate) Save(ctx context.Context) (int, error) {
- if err := pru.defaults(); err != nil {
- return 0, err
- }
- return withHooks(ctx, pru.sqlSave, pru.mutation, pru.hooks)
- }
- // SaveX is like Save, but panics if an error occurs.
- func (pru *PayRechargeUpdate) SaveX(ctx context.Context) int {
- affected, err := pru.Save(ctx)
- if err != nil {
- panic(err)
- }
- return affected
- }
- // Exec executes the query.
- func (pru *PayRechargeUpdate) Exec(ctx context.Context) error {
- _, err := pru.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (pru *PayRechargeUpdate) ExecX(ctx context.Context) {
- if err := pru.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // defaults sets the default values of the builder before save.
- func (pru *PayRechargeUpdate) defaults() error {
- if _, ok := pru.mutation.UpdatedAt(); !ok {
- if payrecharge.UpdateDefaultUpdatedAt == nil {
- return fmt.Errorf("ent: uninitialized payrecharge.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
- }
- v := payrecharge.UpdateDefaultUpdatedAt()
- pru.mutation.SetUpdatedAt(v)
- }
- return nil
- }
- // check runs all checks and user-defined validators on the builder.
- func (pru *PayRechargeUpdate) check() error {
- if v, ok := pru.mutation.UserID(); ok {
- if err := payrecharge.UserIDValidator(v); err != nil {
- return &ValidationError{Name: "user_id", err: fmt.Errorf(`ent: validator failed for field "PayRecharge.user_id": %w`, err)}
- }
- }
- if v, ok := pru.mutation.Status(); ok {
- if err := payrecharge.StatusValidator(v); err != nil {
- return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "PayRecharge.status": %w`, err)}
- }
- }
- if v, ok := pru.mutation.OrganizationID(); ok {
- if err := payrecharge.OrganizationIDValidator(v); err != nil {
- return &ValidationError{Name: "organization_id", err: fmt.Errorf(`ent: validator failed for field "PayRecharge.organization_id": %w`, err)}
- }
- }
- return nil
- }
- func (pru *PayRechargeUpdate) sqlSave(ctx context.Context) (n int, err error) {
- if err := pru.check(); err != nil {
- return n, err
- }
- _spec := sqlgraph.NewUpdateSpec(payrecharge.Table, payrecharge.Columns, sqlgraph.NewFieldSpec(payrecharge.FieldID, field.TypeUint64))
- if ps := pru.mutation.predicates; len(ps) > 0 {
- _spec.Predicate = func(selector *sql.Selector) {
- for i := range ps {
- ps[i](selector)
- }
- }
- }
- if value, ok := pru.mutation.UpdatedAt(); ok {
- _spec.SetField(payrecharge.FieldUpdatedAt, field.TypeTime, value)
- }
- if value, ok := pru.mutation.DeletedAt(); ok {
- _spec.SetField(payrecharge.FieldDeletedAt, field.TypeTime, value)
- }
- if pru.mutation.DeletedAtCleared() {
- _spec.ClearField(payrecharge.FieldDeletedAt, field.TypeTime)
- }
- if value, ok := pru.mutation.UserID(); ok {
- _spec.SetField(payrecharge.FieldUserID, field.TypeString, value)
- }
- if value, ok := pru.mutation.Number(); ok {
- _spec.SetField(payrecharge.FieldNumber, field.TypeFloat32, value)
- }
- if value, ok := pru.mutation.AddedNumber(); ok {
- _spec.AddField(payrecharge.FieldNumber, field.TypeFloat32, value)
- }
- if value, ok := pru.mutation.Status(); ok {
- _spec.SetField(payrecharge.FieldStatus, field.TypeInt, value)
- }
- if value, ok := pru.mutation.AddedStatus(); ok {
- _spec.AddField(payrecharge.FieldStatus, field.TypeInt, value)
- }
- if pru.mutation.StatusCleared() {
- _spec.ClearField(payrecharge.FieldStatus, field.TypeInt)
- }
- if value, ok := pru.mutation.Money(); ok {
- _spec.SetField(payrecharge.FieldMoney, field.TypeFloat32, value)
- }
- if value, ok := pru.mutation.AddedMoney(); ok {
- _spec.AddField(payrecharge.FieldMoney, field.TypeFloat32, value)
- }
- if pru.mutation.MoneyCleared() {
- _spec.ClearField(payrecharge.FieldMoney, field.TypeFloat32)
- }
- if value, ok := pru.mutation.OutTradeNo(); ok {
- _spec.SetField(payrecharge.FieldOutTradeNo, field.TypeString, value)
- }
- if pru.mutation.OutTradeNoCleared() {
- _spec.ClearField(payrecharge.FieldOutTradeNo, field.TypeString)
- }
- if value, ok := pru.mutation.OrganizationID(); ok {
- _spec.SetField(payrecharge.FieldOrganizationID, field.TypeUint64, value)
- }
- if value, ok := pru.mutation.AddedOrganizationID(); ok {
- _spec.AddField(payrecharge.FieldOrganizationID, field.TypeUint64, value)
- }
- if n, err = sqlgraph.UpdateNodes(ctx, pru.driver, _spec); err != nil {
- if _, ok := err.(*sqlgraph.NotFoundError); ok {
- err = &NotFoundError{payrecharge.Label}
- } else if sqlgraph.IsConstraintError(err) {
- err = &ConstraintError{msg: err.Error(), wrap: err}
- }
- return 0, err
- }
- pru.mutation.done = true
- return n, nil
- }
- // PayRechargeUpdateOne is the builder for updating a single PayRecharge entity.
- type PayRechargeUpdateOne struct {
- config
- fields []string
- hooks []Hook
- mutation *PayRechargeMutation
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (pruo *PayRechargeUpdateOne) SetUpdatedAt(t time.Time) *PayRechargeUpdateOne {
- pruo.mutation.SetUpdatedAt(t)
- return pruo
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (pruo *PayRechargeUpdateOne) SetDeletedAt(t time.Time) *PayRechargeUpdateOne {
- pruo.mutation.SetDeletedAt(t)
- return pruo
- }
- // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
- func (pruo *PayRechargeUpdateOne) SetNillableDeletedAt(t *time.Time) *PayRechargeUpdateOne {
- if t != nil {
- pruo.SetDeletedAt(*t)
- }
- return pruo
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (pruo *PayRechargeUpdateOne) ClearDeletedAt() *PayRechargeUpdateOne {
- pruo.mutation.ClearDeletedAt()
- return pruo
- }
- // SetUserID sets the "user_id" field.
- func (pruo *PayRechargeUpdateOne) SetUserID(s string) *PayRechargeUpdateOne {
- pruo.mutation.SetUserID(s)
- return pruo
- }
- // SetNillableUserID sets the "user_id" field if the given value is not nil.
- func (pruo *PayRechargeUpdateOne) SetNillableUserID(s *string) *PayRechargeUpdateOne {
- if s != nil {
- pruo.SetUserID(*s)
- }
- return pruo
- }
- // SetNumber sets the "number" field.
- func (pruo *PayRechargeUpdateOne) SetNumber(f float32) *PayRechargeUpdateOne {
- pruo.mutation.ResetNumber()
- pruo.mutation.SetNumber(f)
- return pruo
- }
- // SetNillableNumber sets the "number" field if the given value is not nil.
- func (pruo *PayRechargeUpdateOne) SetNillableNumber(f *float32) *PayRechargeUpdateOne {
- if f != nil {
- pruo.SetNumber(*f)
- }
- return pruo
- }
- // AddNumber adds f to the "number" field.
- func (pruo *PayRechargeUpdateOne) AddNumber(f float32) *PayRechargeUpdateOne {
- pruo.mutation.AddNumber(f)
- return pruo
- }
- // SetStatus sets the "status" field.
- func (pruo *PayRechargeUpdateOne) SetStatus(i int) *PayRechargeUpdateOne {
- pruo.mutation.ResetStatus()
- pruo.mutation.SetStatus(i)
- return pruo
- }
- // SetNillableStatus sets the "status" field if the given value is not nil.
- func (pruo *PayRechargeUpdateOne) SetNillableStatus(i *int) *PayRechargeUpdateOne {
- if i != nil {
- pruo.SetStatus(*i)
- }
- return pruo
- }
- // AddStatus adds i to the "status" field.
- func (pruo *PayRechargeUpdateOne) AddStatus(i int) *PayRechargeUpdateOne {
- pruo.mutation.AddStatus(i)
- return pruo
- }
- // ClearStatus clears the value of the "status" field.
- func (pruo *PayRechargeUpdateOne) ClearStatus() *PayRechargeUpdateOne {
- pruo.mutation.ClearStatus()
- return pruo
- }
- // SetMoney sets the "money" field.
- func (pruo *PayRechargeUpdateOne) SetMoney(f float32) *PayRechargeUpdateOne {
- pruo.mutation.ResetMoney()
- pruo.mutation.SetMoney(f)
- return pruo
- }
- // SetNillableMoney sets the "money" field if the given value is not nil.
- func (pruo *PayRechargeUpdateOne) SetNillableMoney(f *float32) *PayRechargeUpdateOne {
- if f != nil {
- pruo.SetMoney(*f)
- }
- return pruo
- }
- // AddMoney adds f to the "money" field.
- func (pruo *PayRechargeUpdateOne) AddMoney(f float32) *PayRechargeUpdateOne {
- pruo.mutation.AddMoney(f)
- return pruo
- }
- // ClearMoney clears the value of the "money" field.
- func (pruo *PayRechargeUpdateOne) ClearMoney() *PayRechargeUpdateOne {
- pruo.mutation.ClearMoney()
- return pruo
- }
- // SetOutTradeNo sets the "out_trade_no" field.
- func (pruo *PayRechargeUpdateOne) SetOutTradeNo(s string) *PayRechargeUpdateOne {
- pruo.mutation.SetOutTradeNo(s)
- return pruo
- }
- // SetNillableOutTradeNo sets the "out_trade_no" field if the given value is not nil.
- func (pruo *PayRechargeUpdateOne) SetNillableOutTradeNo(s *string) *PayRechargeUpdateOne {
- if s != nil {
- pruo.SetOutTradeNo(*s)
- }
- return pruo
- }
- // ClearOutTradeNo clears the value of the "out_trade_no" field.
- func (pruo *PayRechargeUpdateOne) ClearOutTradeNo() *PayRechargeUpdateOne {
- pruo.mutation.ClearOutTradeNo()
- return pruo
- }
- // SetOrganizationID sets the "organization_id" field.
- func (pruo *PayRechargeUpdateOne) SetOrganizationID(u uint64) *PayRechargeUpdateOne {
- pruo.mutation.ResetOrganizationID()
- pruo.mutation.SetOrganizationID(u)
- return pruo
- }
- // SetNillableOrganizationID sets the "organization_id" field if the given value is not nil.
- func (pruo *PayRechargeUpdateOne) SetNillableOrganizationID(u *uint64) *PayRechargeUpdateOne {
- if u != nil {
- pruo.SetOrganizationID(*u)
- }
- return pruo
- }
- // AddOrganizationID adds u to the "organization_id" field.
- func (pruo *PayRechargeUpdateOne) AddOrganizationID(u int64) *PayRechargeUpdateOne {
- pruo.mutation.AddOrganizationID(u)
- return pruo
- }
- // Mutation returns the PayRechargeMutation object of the builder.
- func (pruo *PayRechargeUpdateOne) Mutation() *PayRechargeMutation {
- return pruo.mutation
- }
- // Where appends a list predicates to the PayRechargeUpdate builder.
- func (pruo *PayRechargeUpdateOne) Where(ps ...predicate.PayRecharge) *PayRechargeUpdateOne {
- pruo.mutation.Where(ps...)
- return pruo
- }
- // Select allows selecting one or more fields (columns) of the returned entity.
- // The default is selecting all fields defined in the entity schema.
- func (pruo *PayRechargeUpdateOne) Select(field string, fields ...string) *PayRechargeUpdateOne {
- pruo.fields = append([]string{field}, fields...)
- return pruo
- }
- // Save executes the query and returns the updated PayRecharge entity.
- func (pruo *PayRechargeUpdateOne) Save(ctx context.Context) (*PayRecharge, error) {
- if err := pruo.defaults(); err != nil {
- return nil, err
- }
- return withHooks(ctx, pruo.sqlSave, pruo.mutation, pruo.hooks)
- }
- // SaveX is like Save, but panics if an error occurs.
- func (pruo *PayRechargeUpdateOne) SaveX(ctx context.Context) *PayRecharge {
- node, err := pruo.Save(ctx)
- if err != nil {
- panic(err)
- }
- return node
- }
- // Exec executes the query on the entity.
- func (pruo *PayRechargeUpdateOne) Exec(ctx context.Context) error {
- _, err := pruo.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (pruo *PayRechargeUpdateOne) ExecX(ctx context.Context) {
- if err := pruo.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // defaults sets the default values of the builder before save.
- func (pruo *PayRechargeUpdateOne) defaults() error {
- if _, ok := pruo.mutation.UpdatedAt(); !ok {
- if payrecharge.UpdateDefaultUpdatedAt == nil {
- return fmt.Errorf("ent: uninitialized payrecharge.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
- }
- v := payrecharge.UpdateDefaultUpdatedAt()
- pruo.mutation.SetUpdatedAt(v)
- }
- return nil
- }
- // check runs all checks and user-defined validators on the builder.
- func (pruo *PayRechargeUpdateOne) check() error {
- if v, ok := pruo.mutation.UserID(); ok {
- if err := payrecharge.UserIDValidator(v); err != nil {
- return &ValidationError{Name: "user_id", err: fmt.Errorf(`ent: validator failed for field "PayRecharge.user_id": %w`, err)}
- }
- }
- if v, ok := pruo.mutation.Status(); ok {
- if err := payrecharge.StatusValidator(v); err != nil {
- return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "PayRecharge.status": %w`, err)}
- }
- }
- if v, ok := pruo.mutation.OrganizationID(); ok {
- if err := payrecharge.OrganizationIDValidator(v); err != nil {
- return &ValidationError{Name: "organization_id", err: fmt.Errorf(`ent: validator failed for field "PayRecharge.organization_id": %w`, err)}
- }
- }
- return nil
- }
- func (pruo *PayRechargeUpdateOne) sqlSave(ctx context.Context) (_node *PayRecharge, err error) {
- if err := pruo.check(); err != nil {
- return _node, err
- }
- _spec := sqlgraph.NewUpdateSpec(payrecharge.Table, payrecharge.Columns, sqlgraph.NewFieldSpec(payrecharge.FieldID, field.TypeUint64))
- id, ok := pruo.mutation.ID()
- if !ok {
- return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "PayRecharge.id" for update`)}
- }
- _spec.Node.ID.Value = id
- if fields := pruo.fields; len(fields) > 0 {
- _spec.Node.Columns = make([]string, 0, len(fields))
- _spec.Node.Columns = append(_spec.Node.Columns, payrecharge.FieldID)
- for _, f := range fields {
- if !payrecharge.ValidColumn(f) {
- return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
- }
- if f != payrecharge.FieldID {
- _spec.Node.Columns = append(_spec.Node.Columns, f)
- }
- }
- }
- if ps := pruo.mutation.predicates; len(ps) > 0 {
- _spec.Predicate = func(selector *sql.Selector) {
- for i := range ps {
- ps[i](selector)
- }
- }
- }
- if value, ok := pruo.mutation.UpdatedAt(); ok {
- _spec.SetField(payrecharge.FieldUpdatedAt, field.TypeTime, value)
- }
- if value, ok := pruo.mutation.DeletedAt(); ok {
- _spec.SetField(payrecharge.FieldDeletedAt, field.TypeTime, value)
- }
- if pruo.mutation.DeletedAtCleared() {
- _spec.ClearField(payrecharge.FieldDeletedAt, field.TypeTime)
- }
- if value, ok := pruo.mutation.UserID(); ok {
- _spec.SetField(payrecharge.FieldUserID, field.TypeString, value)
- }
- if value, ok := pruo.mutation.Number(); ok {
- _spec.SetField(payrecharge.FieldNumber, field.TypeFloat32, value)
- }
- if value, ok := pruo.mutation.AddedNumber(); ok {
- _spec.AddField(payrecharge.FieldNumber, field.TypeFloat32, value)
- }
- if value, ok := pruo.mutation.Status(); ok {
- _spec.SetField(payrecharge.FieldStatus, field.TypeInt, value)
- }
- if value, ok := pruo.mutation.AddedStatus(); ok {
- _spec.AddField(payrecharge.FieldStatus, field.TypeInt, value)
- }
- if pruo.mutation.StatusCleared() {
- _spec.ClearField(payrecharge.FieldStatus, field.TypeInt)
- }
- if value, ok := pruo.mutation.Money(); ok {
- _spec.SetField(payrecharge.FieldMoney, field.TypeFloat32, value)
- }
- if value, ok := pruo.mutation.AddedMoney(); ok {
- _spec.AddField(payrecharge.FieldMoney, field.TypeFloat32, value)
- }
- if pruo.mutation.MoneyCleared() {
- _spec.ClearField(payrecharge.FieldMoney, field.TypeFloat32)
- }
- if value, ok := pruo.mutation.OutTradeNo(); ok {
- _spec.SetField(payrecharge.FieldOutTradeNo, field.TypeString, value)
- }
- if pruo.mutation.OutTradeNoCleared() {
- _spec.ClearField(payrecharge.FieldOutTradeNo, field.TypeString)
- }
- if value, ok := pruo.mutation.OrganizationID(); ok {
- _spec.SetField(payrecharge.FieldOrganizationID, field.TypeUint64, value)
- }
- if value, ok := pruo.mutation.AddedOrganizationID(); ok {
- _spec.AddField(payrecharge.FieldOrganizationID, field.TypeUint64, value)
- }
- _node = &PayRecharge{config: pruo.config}
- _spec.Assign = _node.assignValues
- _spec.ScanValues = _node.scanValues
- if err = sqlgraph.UpdateNode(ctx, pruo.driver, _spec); err != nil {
- if _, ok := err.(*sqlgraph.NotFoundError); ok {
- err = &NotFoundError{payrecharge.Label}
- } else if sqlgraph.IsConstraintError(err) {
- err = &ConstraintError{msg: err.Error(), wrap: err}
- }
- return nil, err
- }
- pruo.mutation.done = true
- return _node, nil
- }
|