123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640 |
- // Code generated by ent, DO NOT EDIT.
- package ent
- import (
- "context"
- "errors"
- "fmt"
- "time"
- "wechat-api/ent/aliyunavatar"
- "wechat-api/ent/predicate"
- "entgo.io/ent/dialect/sql"
- "entgo.io/ent/dialect/sql/sqlgraph"
- "entgo.io/ent/schema/field"
- )
- // AliyunAvatarUpdate is the builder for updating AliyunAvatar entities.
- type AliyunAvatarUpdate struct {
- config
- hooks []Hook
- mutation *AliyunAvatarMutation
- }
- // Where appends a list predicates to the AliyunAvatarUpdate builder.
- func (aau *AliyunAvatarUpdate) Where(ps ...predicate.AliyunAvatar) *AliyunAvatarUpdate {
- aau.mutation.Where(ps...)
- return aau
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (aau *AliyunAvatarUpdate) SetUpdatedAt(t time.Time) *AliyunAvatarUpdate {
- aau.mutation.SetUpdatedAt(t)
- return aau
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (aau *AliyunAvatarUpdate) SetDeletedAt(t time.Time) *AliyunAvatarUpdate {
- aau.mutation.SetDeletedAt(t)
- return aau
- }
- // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
- func (aau *AliyunAvatarUpdate) SetNillableDeletedAt(t *time.Time) *AliyunAvatarUpdate {
- if t != nil {
- aau.SetDeletedAt(*t)
- }
- return aau
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (aau *AliyunAvatarUpdate) ClearDeletedAt() *AliyunAvatarUpdate {
- aau.mutation.ClearDeletedAt()
- return aau
- }
- // SetUserID sets the "user_id" field.
- func (aau *AliyunAvatarUpdate) SetUserID(u uint64) *AliyunAvatarUpdate {
- aau.mutation.ResetUserID()
- aau.mutation.SetUserID(u)
- return aau
- }
- // SetNillableUserID sets the "user_id" field if the given value is not nil.
- func (aau *AliyunAvatarUpdate) SetNillableUserID(u *uint64) *AliyunAvatarUpdate {
- if u != nil {
- aau.SetUserID(*u)
- }
- return aau
- }
- // AddUserID adds u to the "user_id" field.
- func (aau *AliyunAvatarUpdate) AddUserID(u int64) *AliyunAvatarUpdate {
- aau.mutation.AddUserID(u)
- return aau
- }
- // SetBizID sets the "biz_id" field.
- func (aau *AliyunAvatarUpdate) SetBizID(s string) *AliyunAvatarUpdate {
- aau.mutation.SetBizID(s)
- return aau
- }
- // SetNillableBizID sets the "biz_id" field if the given value is not nil.
- func (aau *AliyunAvatarUpdate) SetNillableBizID(s *string) *AliyunAvatarUpdate {
- if s != nil {
- aau.SetBizID(*s)
- }
- return aau
- }
- // SetAccessKeyID sets the "access_key_id" field.
- func (aau *AliyunAvatarUpdate) SetAccessKeyID(s string) *AliyunAvatarUpdate {
- aau.mutation.SetAccessKeyID(s)
- return aau
- }
- // SetNillableAccessKeyID sets the "access_key_id" field if the given value is not nil.
- func (aau *AliyunAvatarUpdate) SetNillableAccessKeyID(s *string) *AliyunAvatarUpdate {
- if s != nil {
- aau.SetAccessKeyID(*s)
- }
- return aau
- }
- // SetAccessKeySecret sets the "access_key_secret" field.
- func (aau *AliyunAvatarUpdate) SetAccessKeySecret(s string) *AliyunAvatarUpdate {
- aau.mutation.SetAccessKeySecret(s)
- return aau
- }
- // SetNillableAccessKeySecret sets the "access_key_secret" field if the given value is not nil.
- func (aau *AliyunAvatarUpdate) SetNillableAccessKeySecret(s *string) *AliyunAvatarUpdate {
- if s != nil {
- aau.SetAccessKeySecret(*s)
- }
- return aau
- }
- // SetAppID sets the "app_id" field.
- func (aau *AliyunAvatarUpdate) SetAppID(s string) *AliyunAvatarUpdate {
- aau.mutation.SetAppID(s)
- return aau
- }
- // SetNillableAppID sets the "app_id" field if the given value is not nil.
- func (aau *AliyunAvatarUpdate) SetNillableAppID(s *string) *AliyunAvatarUpdate {
- if s != nil {
- aau.SetAppID(*s)
- }
- return aau
- }
- // ClearAppID clears the value of the "app_id" field.
- func (aau *AliyunAvatarUpdate) ClearAppID() *AliyunAvatarUpdate {
- aau.mutation.ClearAppID()
- return aau
- }
- // SetTenantID sets the "tenant_id" field.
- func (aau *AliyunAvatarUpdate) SetTenantID(u uint64) *AliyunAvatarUpdate {
- aau.mutation.ResetTenantID()
- aau.mutation.SetTenantID(u)
- return aau
- }
- // SetNillableTenantID sets the "tenant_id" field if the given value is not nil.
- func (aau *AliyunAvatarUpdate) SetNillableTenantID(u *uint64) *AliyunAvatarUpdate {
- if u != nil {
- aau.SetTenantID(*u)
- }
- return aau
- }
- // AddTenantID adds u to the "tenant_id" field.
- func (aau *AliyunAvatarUpdate) AddTenantID(u int64) *AliyunAvatarUpdate {
- aau.mutation.AddTenantID(u)
- return aau
- }
- // SetResponse sets the "response" field.
- func (aau *AliyunAvatarUpdate) SetResponse(s string) *AliyunAvatarUpdate {
- aau.mutation.SetResponse(s)
- return aau
- }
- // SetNillableResponse sets the "response" field if the given value is not nil.
- func (aau *AliyunAvatarUpdate) SetNillableResponse(s *string) *AliyunAvatarUpdate {
- if s != nil {
- aau.SetResponse(*s)
- }
- return aau
- }
- // SetToken sets the "token" field.
- func (aau *AliyunAvatarUpdate) SetToken(s string) *AliyunAvatarUpdate {
- aau.mutation.SetToken(s)
- return aau
- }
- // SetNillableToken sets the "token" field if the given value is not nil.
- func (aau *AliyunAvatarUpdate) SetNillableToken(s *string) *AliyunAvatarUpdate {
- if s != nil {
- aau.SetToken(*s)
- }
- return aau
- }
- // SetSessionID sets the "session_id" field.
- func (aau *AliyunAvatarUpdate) SetSessionID(s string) *AliyunAvatarUpdate {
- aau.mutation.SetSessionID(s)
- return aau
- }
- // SetNillableSessionID sets the "session_id" field if the given value is not nil.
- func (aau *AliyunAvatarUpdate) SetNillableSessionID(s *string) *AliyunAvatarUpdate {
- if s != nil {
- aau.SetSessionID(*s)
- }
- return aau
- }
- // Mutation returns the AliyunAvatarMutation object of the builder.
- func (aau *AliyunAvatarUpdate) Mutation() *AliyunAvatarMutation {
- return aau.mutation
- }
- // Save executes the query and returns the number of nodes affected by the update operation.
- func (aau *AliyunAvatarUpdate) Save(ctx context.Context) (int, error) {
- if err := aau.defaults(); err != nil {
- return 0, err
- }
- return withHooks(ctx, aau.sqlSave, aau.mutation, aau.hooks)
- }
- // SaveX is like Save, but panics if an error occurs.
- func (aau *AliyunAvatarUpdate) SaveX(ctx context.Context) int {
- affected, err := aau.Save(ctx)
- if err != nil {
- panic(err)
- }
- return affected
- }
- // Exec executes the query.
- func (aau *AliyunAvatarUpdate) Exec(ctx context.Context) error {
- _, err := aau.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (aau *AliyunAvatarUpdate) ExecX(ctx context.Context) {
- if err := aau.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // defaults sets the default values of the builder before save.
- func (aau *AliyunAvatarUpdate) defaults() error {
- if _, ok := aau.mutation.UpdatedAt(); !ok {
- if aliyunavatar.UpdateDefaultUpdatedAt == nil {
- return fmt.Errorf("ent: uninitialized aliyunavatar.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
- }
- v := aliyunavatar.UpdateDefaultUpdatedAt()
- aau.mutation.SetUpdatedAt(v)
- }
- return nil
- }
- func (aau *AliyunAvatarUpdate) sqlSave(ctx context.Context) (n int, err error) {
- _spec := sqlgraph.NewUpdateSpec(aliyunavatar.Table, aliyunavatar.Columns, sqlgraph.NewFieldSpec(aliyunavatar.FieldID, field.TypeUint64))
- if ps := aau.mutation.predicates; len(ps) > 0 {
- _spec.Predicate = func(selector *sql.Selector) {
- for i := range ps {
- ps[i](selector)
- }
- }
- }
- if value, ok := aau.mutation.UpdatedAt(); ok {
- _spec.SetField(aliyunavatar.FieldUpdatedAt, field.TypeTime, value)
- }
- if value, ok := aau.mutation.DeletedAt(); ok {
- _spec.SetField(aliyunavatar.FieldDeletedAt, field.TypeTime, value)
- }
- if aau.mutation.DeletedAtCleared() {
- _spec.ClearField(aliyunavatar.FieldDeletedAt, field.TypeTime)
- }
- if value, ok := aau.mutation.UserID(); ok {
- _spec.SetField(aliyunavatar.FieldUserID, field.TypeUint64, value)
- }
- if value, ok := aau.mutation.AddedUserID(); ok {
- _spec.AddField(aliyunavatar.FieldUserID, field.TypeUint64, value)
- }
- if value, ok := aau.mutation.BizID(); ok {
- _spec.SetField(aliyunavatar.FieldBizID, field.TypeString, value)
- }
- if value, ok := aau.mutation.AccessKeyID(); ok {
- _spec.SetField(aliyunavatar.FieldAccessKeyID, field.TypeString, value)
- }
- if value, ok := aau.mutation.AccessKeySecret(); ok {
- _spec.SetField(aliyunavatar.FieldAccessKeySecret, field.TypeString, value)
- }
- if value, ok := aau.mutation.AppID(); ok {
- _spec.SetField(aliyunavatar.FieldAppID, field.TypeString, value)
- }
- if aau.mutation.AppIDCleared() {
- _spec.ClearField(aliyunavatar.FieldAppID, field.TypeString)
- }
- if value, ok := aau.mutation.TenantID(); ok {
- _spec.SetField(aliyunavatar.FieldTenantID, field.TypeUint64, value)
- }
- if value, ok := aau.mutation.AddedTenantID(); ok {
- _spec.AddField(aliyunavatar.FieldTenantID, field.TypeUint64, value)
- }
- if value, ok := aau.mutation.Response(); ok {
- _spec.SetField(aliyunavatar.FieldResponse, field.TypeString, value)
- }
- if value, ok := aau.mutation.Token(); ok {
- _spec.SetField(aliyunavatar.FieldToken, field.TypeString, value)
- }
- if value, ok := aau.mutation.SessionID(); ok {
- _spec.SetField(aliyunavatar.FieldSessionID, field.TypeString, value)
- }
- if n, err = sqlgraph.UpdateNodes(ctx, aau.driver, _spec); err != nil {
- if _, ok := err.(*sqlgraph.NotFoundError); ok {
- err = &NotFoundError{aliyunavatar.Label}
- } else if sqlgraph.IsConstraintError(err) {
- err = &ConstraintError{msg: err.Error(), wrap: err}
- }
- return 0, err
- }
- aau.mutation.done = true
- return n, nil
- }
- // AliyunAvatarUpdateOne is the builder for updating a single AliyunAvatar entity.
- type AliyunAvatarUpdateOne struct {
- config
- fields []string
- hooks []Hook
- mutation *AliyunAvatarMutation
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (aauo *AliyunAvatarUpdateOne) SetUpdatedAt(t time.Time) *AliyunAvatarUpdateOne {
- aauo.mutation.SetUpdatedAt(t)
- return aauo
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (aauo *AliyunAvatarUpdateOne) SetDeletedAt(t time.Time) *AliyunAvatarUpdateOne {
- aauo.mutation.SetDeletedAt(t)
- return aauo
- }
- // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
- func (aauo *AliyunAvatarUpdateOne) SetNillableDeletedAt(t *time.Time) *AliyunAvatarUpdateOne {
- if t != nil {
- aauo.SetDeletedAt(*t)
- }
- return aauo
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (aauo *AliyunAvatarUpdateOne) ClearDeletedAt() *AliyunAvatarUpdateOne {
- aauo.mutation.ClearDeletedAt()
- return aauo
- }
- // SetUserID sets the "user_id" field.
- func (aauo *AliyunAvatarUpdateOne) SetUserID(u uint64) *AliyunAvatarUpdateOne {
- aauo.mutation.ResetUserID()
- aauo.mutation.SetUserID(u)
- return aauo
- }
- // SetNillableUserID sets the "user_id" field if the given value is not nil.
- func (aauo *AliyunAvatarUpdateOne) SetNillableUserID(u *uint64) *AliyunAvatarUpdateOne {
- if u != nil {
- aauo.SetUserID(*u)
- }
- return aauo
- }
- // AddUserID adds u to the "user_id" field.
- func (aauo *AliyunAvatarUpdateOne) AddUserID(u int64) *AliyunAvatarUpdateOne {
- aauo.mutation.AddUserID(u)
- return aauo
- }
- // SetBizID sets the "biz_id" field.
- func (aauo *AliyunAvatarUpdateOne) SetBizID(s string) *AliyunAvatarUpdateOne {
- aauo.mutation.SetBizID(s)
- return aauo
- }
- // SetNillableBizID sets the "biz_id" field if the given value is not nil.
- func (aauo *AliyunAvatarUpdateOne) SetNillableBizID(s *string) *AliyunAvatarUpdateOne {
- if s != nil {
- aauo.SetBizID(*s)
- }
- return aauo
- }
- // SetAccessKeyID sets the "access_key_id" field.
- func (aauo *AliyunAvatarUpdateOne) SetAccessKeyID(s string) *AliyunAvatarUpdateOne {
- aauo.mutation.SetAccessKeyID(s)
- return aauo
- }
- // SetNillableAccessKeyID sets the "access_key_id" field if the given value is not nil.
- func (aauo *AliyunAvatarUpdateOne) SetNillableAccessKeyID(s *string) *AliyunAvatarUpdateOne {
- if s != nil {
- aauo.SetAccessKeyID(*s)
- }
- return aauo
- }
- // SetAccessKeySecret sets the "access_key_secret" field.
- func (aauo *AliyunAvatarUpdateOne) SetAccessKeySecret(s string) *AliyunAvatarUpdateOne {
- aauo.mutation.SetAccessKeySecret(s)
- return aauo
- }
- // SetNillableAccessKeySecret sets the "access_key_secret" field if the given value is not nil.
- func (aauo *AliyunAvatarUpdateOne) SetNillableAccessKeySecret(s *string) *AliyunAvatarUpdateOne {
- if s != nil {
- aauo.SetAccessKeySecret(*s)
- }
- return aauo
- }
- // SetAppID sets the "app_id" field.
- func (aauo *AliyunAvatarUpdateOne) SetAppID(s string) *AliyunAvatarUpdateOne {
- aauo.mutation.SetAppID(s)
- return aauo
- }
- // SetNillableAppID sets the "app_id" field if the given value is not nil.
- func (aauo *AliyunAvatarUpdateOne) SetNillableAppID(s *string) *AliyunAvatarUpdateOne {
- if s != nil {
- aauo.SetAppID(*s)
- }
- return aauo
- }
- // ClearAppID clears the value of the "app_id" field.
- func (aauo *AliyunAvatarUpdateOne) ClearAppID() *AliyunAvatarUpdateOne {
- aauo.mutation.ClearAppID()
- return aauo
- }
- // SetTenantID sets the "tenant_id" field.
- func (aauo *AliyunAvatarUpdateOne) SetTenantID(u uint64) *AliyunAvatarUpdateOne {
- aauo.mutation.ResetTenantID()
- aauo.mutation.SetTenantID(u)
- return aauo
- }
- // SetNillableTenantID sets the "tenant_id" field if the given value is not nil.
- func (aauo *AliyunAvatarUpdateOne) SetNillableTenantID(u *uint64) *AliyunAvatarUpdateOne {
- if u != nil {
- aauo.SetTenantID(*u)
- }
- return aauo
- }
- // AddTenantID adds u to the "tenant_id" field.
- func (aauo *AliyunAvatarUpdateOne) AddTenantID(u int64) *AliyunAvatarUpdateOne {
- aauo.mutation.AddTenantID(u)
- return aauo
- }
- // SetResponse sets the "response" field.
- func (aauo *AliyunAvatarUpdateOne) SetResponse(s string) *AliyunAvatarUpdateOne {
- aauo.mutation.SetResponse(s)
- return aauo
- }
- // SetNillableResponse sets the "response" field if the given value is not nil.
- func (aauo *AliyunAvatarUpdateOne) SetNillableResponse(s *string) *AliyunAvatarUpdateOne {
- if s != nil {
- aauo.SetResponse(*s)
- }
- return aauo
- }
- // SetToken sets the "token" field.
- func (aauo *AliyunAvatarUpdateOne) SetToken(s string) *AliyunAvatarUpdateOne {
- aauo.mutation.SetToken(s)
- return aauo
- }
- // SetNillableToken sets the "token" field if the given value is not nil.
- func (aauo *AliyunAvatarUpdateOne) SetNillableToken(s *string) *AliyunAvatarUpdateOne {
- if s != nil {
- aauo.SetToken(*s)
- }
- return aauo
- }
- // SetSessionID sets the "session_id" field.
- func (aauo *AliyunAvatarUpdateOne) SetSessionID(s string) *AliyunAvatarUpdateOne {
- aauo.mutation.SetSessionID(s)
- return aauo
- }
- // SetNillableSessionID sets the "session_id" field if the given value is not nil.
- func (aauo *AliyunAvatarUpdateOne) SetNillableSessionID(s *string) *AliyunAvatarUpdateOne {
- if s != nil {
- aauo.SetSessionID(*s)
- }
- return aauo
- }
- // Mutation returns the AliyunAvatarMutation object of the builder.
- func (aauo *AliyunAvatarUpdateOne) Mutation() *AliyunAvatarMutation {
- return aauo.mutation
- }
- // Where appends a list predicates to the AliyunAvatarUpdate builder.
- func (aauo *AliyunAvatarUpdateOne) Where(ps ...predicate.AliyunAvatar) *AliyunAvatarUpdateOne {
- aauo.mutation.Where(ps...)
- return aauo
- }
- // Select allows selecting one or more fields (columns) of the returned entity.
- // The default is selecting all fields defined in the entity schema.
- func (aauo *AliyunAvatarUpdateOne) Select(field string, fields ...string) *AliyunAvatarUpdateOne {
- aauo.fields = append([]string{field}, fields...)
- return aauo
- }
- // Save executes the query and returns the updated AliyunAvatar entity.
- func (aauo *AliyunAvatarUpdateOne) Save(ctx context.Context) (*AliyunAvatar, error) {
- if err := aauo.defaults(); err != nil {
- return nil, err
- }
- return withHooks(ctx, aauo.sqlSave, aauo.mutation, aauo.hooks)
- }
- // SaveX is like Save, but panics if an error occurs.
- func (aauo *AliyunAvatarUpdateOne) SaveX(ctx context.Context) *AliyunAvatar {
- node, err := aauo.Save(ctx)
- if err != nil {
- panic(err)
- }
- return node
- }
- // Exec executes the query on the entity.
- func (aauo *AliyunAvatarUpdateOne) Exec(ctx context.Context) error {
- _, err := aauo.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (aauo *AliyunAvatarUpdateOne) ExecX(ctx context.Context) {
- if err := aauo.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // defaults sets the default values of the builder before save.
- func (aauo *AliyunAvatarUpdateOne) defaults() error {
- if _, ok := aauo.mutation.UpdatedAt(); !ok {
- if aliyunavatar.UpdateDefaultUpdatedAt == nil {
- return fmt.Errorf("ent: uninitialized aliyunavatar.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
- }
- v := aliyunavatar.UpdateDefaultUpdatedAt()
- aauo.mutation.SetUpdatedAt(v)
- }
- return nil
- }
- func (aauo *AliyunAvatarUpdateOne) sqlSave(ctx context.Context) (_node *AliyunAvatar, err error) {
- _spec := sqlgraph.NewUpdateSpec(aliyunavatar.Table, aliyunavatar.Columns, sqlgraph.NewFieldSpec(aliyunavatar.FieldID, field.TypeUint64))
- id, ok := aauo.mutation.ID()
- if !ok {
- return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "AliyunAvatar.id" for update`)}
- }
- _spec.Node.ID.Value = id
- if fields := aauo.fields; len(fields) > 0 {
- _spec.Node.Columns = make([]string, 0, len(fields))
- _spec.Node.Columns = append(_spec.Node.Columns, aliyunavatar.FieldID)
- for _, f := range fields {
- if !aliyunavatar.ValidColumn(f) {
- return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
- }
- if f != aliyunavatar.FieldID {
- _spec.Node.Columns = append(_spec.Node.Columns, f)
- }
- }
- }
- if ps := aauo.mutation.predicates; len(ps) > 0 {
- _spec.Predicate = func(selector *sql.Selector) {
- for i := range ps {
- ps[i](selector)
- }
- }
- }
- if value, ok := aauo.mutation.UpdatedAt(); ok {
- _spec.SetField(aliyunavatar.FieldUpdatedAt, field.TypeTime, value)
- }
- if value, ok := aauo.mutation.DeletedAt(); ok {
- _spec.SetField(aliyunavatar.FieldDeletedAt, field.TypeTime, value)
- }
- if aauo.mutation.DeletedAtCleared() {
- _spec.ClearField(aliyunavatar.FieldDeletedAt, field.TypeTime)
- }
- if value, ok := aauo.mutation.UserID(); ok {
- _spec.SetField(aliyunavatar.FieldUserID, field.TypeUint64, value)
- }
- if value, ok := aauo.mutation.AddedUserID(); ok {
- _spec.AddField(aliyunavatar.FieldUserID, field.TypeUint64, value)
- }
- if value, ok := aauo.mutation.BizID(); ok {
- _spec.SetField(aliyunavatar.FieldBizID, field.TypeString, value)
- }
- if value, ok := aauo.mutation.AccessKeyID(); ok {
- _spec.SetField(aliyunavatar.FieldAccessKeyID, field.TypeString, value)
- }
- if value, ok := aauo.mutation.AccessKeySecret(); ok {
- _spec.SetField(aliyunavatar.FieldAccessKeySecret, field.TypeString, value)
- }
- if value, ok := aauo.mutation.AppID(); ok {
- _spec.SetField(aliyunavatar.FieldAppID, field.TypeString, value)
- }
- if aauo.mutation.AppIDCleared() {
- _spec.ClearField(aliyunavatar.FieldAppID, field.TypeString)
- }
- if value, ok := aauo.mutation.TenantID(); ok {
- _spec.SetField(aliyunavatar.FieldTenantID, field.TypeUint64, value)
- }
- if value, ok := aauo.mutation.AddedTenantID(); ok {
- _spec.AddField(aliyunavatar.FieldTenantID, field.TypeUint64, value)
- }
- if value, ok := aauo.mutation.Response(); ok {
- _spec.SetField(aliyunavatar.FieldResponse, field.TypeString, value)
- }
- if value, ok := aauo.mutation.Token(); ok {
- _spec.SetField(aliyunavatar.FieldToken, field.TypeString, value)
- }
- if value, ok := aauo.mutation.SessionID(); ok {
- _spec.SetField(aliyunavatar.FieldSessionID, field.TypeString, value)
- }
- _node = &AliyunAvatar{config: aauo.config}
- _spec.Assign = _node.assignValues
- _spec.ScanValues = _node.scanValues
- if err = sqlgraph.UpdateNode(ctx, aauo.driver, _spec); err != nil {
- if _, ok := err.(*sqlgraph.NotFoundError); ok {
- err = &NotFoundError{aliyunavatar.Label}
- } else if sqlgraph.IsConstraintError(err) {
- err = &ConstraintError{msg: err.Error(), wrap: err}
- }
- return nil, err
- }
- aauo.mutation.done = true
- return _node, nil
- }
|