1139 lines
36 KiB
Go
1139 lines
36 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
"mingyang-admin-app-rpc/ent/predicate"
|
|
"mingyang-admin-app-rpc/ent/userthirdauth"
|
|
"time"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"entgo.io/ent/schema/field"
|
|
)
|
|
|
|
// UserThirdAuthUpdate is the builder for updating UserThirdAuth entities.
|
|
type UserThirdAuthUpdate struct {
|
|
config
|
|
hooks []Hook
|
|
mutation *UserThirdAuthMutation
|
|
}
|
|
|
|
// Where appends a list predicates to the UserThirdAuthUpdate builder.
|
|
func (_u *UserThirdAuthUpdate) Where(ps ...predicate.UserThirdAuth) *UserThirdAuthUpdate {
|
|
_u.mutation.Where(ps...)
|
|
return _u
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (_u *UserThirdAuthUpdate) SetUpdatedAt(v time.Time) *UserThirdAuthUpdate {
|
|
_u.mutation.SetUpdatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (_u *UserThirdAuthUpdate) SetStatus(v uint8) *UserThirdAuthUpdate {
|
|
_u.mutation.ResetStatus()
|
|
_u.mutation.SetStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableStatus sets the "status" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdate) SetNillableStatus(v *uint8) *UserThirdAuthUpdate {
|
|
if v != nil {
|
|
_u.SetStatus(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddStatus adds value to the "status" field.
|
|
func (_u *UserThirdAuthUpdate) AddStatus(v int8) *UserThirdAuthUpdate {
|
|
_u.mutation.AddStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearStatus clears the value of the "status" field.
|
|
func (_u *UserThirdAuthUpdate) ClearStatus() *UserThirdAuthUpdate {
|
|
_u.mutation.ClearStatus()
|
|
return _u
|
|
}
|
|
|
|
// SetDeletedAt sets the "deleted_at" field.
|
|
func (_u *UserThirdAuthUpdate) SetDeletedAt(v time.Time) *UserThirdAuthUpdate {
|
|
_u.mutation.SetDeletedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdate) SetNillableDeletedAt(v *time.Time) *UserThirdAuthUpdate {
|
|
if v != nil {
|
|
_u.SetDeletedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearDeletedAt clears the value of the "deleted_at" field.
|
|
func (_u *UserThirdAuthUpdate) ClearDeletedAt() *UserThirdAuthUpdate {
|
|
_u.mutation.ClearDeletedAt()
|
|
return _u
|
|
}
|
|
|
|
// SetUserID sets the "user_id" field.
|
|
func (_u *UserThirdAuthUpdate) SetUserID(v uint64) *UserThirdAuthUpdate {
|
|
_u.mutation.ResetUserID()
|
|
_u.mutation.SetUserID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableUserID sets the "user_id" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdate) SetNillableUserID(v *uint64) *UserThirdAuthUpdate {
|
|
if v != nil {
|
|
_u.SetUserID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddUserID adds value to the "user_id" field.
|
|
func (_u *UserThirdAuthUpdate) AddUserID(v int64) *UserThirdAuthUpdate {
|
|
_u.mutation.AddUserID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetOpenid sets the "openid" field.
|
|
func (_u *UserThirdAuthUpdate) SetOpenid(v string) *UserThirdAuthUpdate {
|
|
_u.mutation.SetOpenid(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableOpenid sets the "openid" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdate) SetNillableOpenid(v *string) *UserThirdAuthUpdate {
|
|
if v != nil {
|
|
_u.SetOpenid(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetUnionid sets the "unionid" field.
|
|
func (_u *UserThirdAuthUpdate) SetUnionid(v string) *UserThirdAuthUpdate {
|
|
_u.mutation.SetUnionid(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableUnionid sets the "unionid" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdate) SetNillableUnionid(v *string) *UserThirdAuthUpdate {
|
|
if v != nil {
|
|
_u.SetUnionid(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearUnionid clears the value of the "unionid" field.
|
|
func (_u *UserThirdAuthUpdate) ClearUnionid() *UserThirdAuthUpdate {
|
|
_u.mutation.ClearUnionid()
|
|
return _u
|
|
}
|
|
|
|
// SetAccessToken sets the "access_token" field.
|
|
func (_u *UserThirdAuthUpdate) SetAccessToken(v string) *UserThirdAuthUpdate {
|
|
_u.mutation.SetAccessToken(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableAccessToken sets the "access_token" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdate) SetNillableAccessToken(v *string) *UserThirdAuthUpdate {
|
|
if v != nil {
|
|
_u.SetAccessToken(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearAccessToken clears the value of the "access_token" field.
|
|
func (_u *UserThirdAuthUpdate) ClearAccessToken() *UserThirdAuthUpdate {
|
|
_u.mutation.ClearAccessToken()
|
|
return _u
|
|
}
|
|
|
|
// SetRefreshToken sets the "refresh_token" field.
|
|
func (_u *UserThirdAuthUpdate) SetRefreshToken(v string) *UserThirdAuthUpdate {
|
|
_u.mutation.SetRefreshToken(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRefreshToken sets the "refresh_token" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdate) SetNillableRefreshToken(v *string) *UserThirdAuthUpdate {
|
|
if v != nil {
|
|
_u.SetRefreshToken(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearRefreshToken clears the value of the "refresh_token" field.
|
|
func (_u *UserThirdAuthUpdate) ClearRefreshToken() *UserThirdAuthUpdate {
|
|
_u.mutation.ClearRefreshToken()
|
|
return _u
|
|
}
|
|
|
|
// SetAccessTokenExpiry sets the "access_token_expiry" field.
|
|
func (_u *UserThirdAuthUpdate) SetAccessTokenExpiry(v time.Time) *UserThirdAuthUpdate {
|
|
_u.mutation.SetAccessTokenExpiry(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableAccessTokenExpiry sets the "access_token_expiry" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdate) SetNillableAccessTokenExpiry(v *time.Time) *UserThirdAuthUpdate {
|
|
if v != nil {
|
|
_u.SetAccessTokenExpiry(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearAccessTokenExpiry clears the value of the "access_token_expiry" field.
|
|
func (_u *UserThirdAuthUpdate) ClearAccessTokenExpiry() *UserThirdAuthUpdate {
|
|
_u.mutation.ClearAccessTokenExpiry()
|
|
return _u
|
|
}
|
|
|
|
// SetUserInfo sets the "user_info" field.
|
|
func (_u *UserThirdAuthUpdate) SetUserInfo(v map[string]interface{}) *UserThirdAuthUpdate {
|
|
_u.mutation.SetUserInfo(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearUserInfo clears the value of the "user_info" field.
|
|
func (_u *UserThirdAuthUpdate) ClearUserInfo() *UserThirdAuthUpdate {
|
|
_u.mutation.ClearUserInfo()
|
|
return _u
|
|
}
|
|
|
|
// SetPlatformUserID sets the "platform_user_id" field.
|
|
func (_u *UserThirdAuthUpdate) SetPlatformUserID(v string) *UserThirdAuthUpdate {
|
|
_u.mutation.SetPlatformUserID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillablePlatformUserID sets the "platform_user_id" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdate) SetNillablePlatformUserID(v *string) *UserThirdAuthUpdate {
|
|
if v != nil {
|
|
_u.SetPlatformUserID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearPlatformUserID clears the value of the "platform_user_id" field.
|
|
func (_u *UserThirdAuthUpdate) ClearPlatformUserID() *UserThirdAuthUpdate {
|
|
_u.mutation.ClearPlatformUserID()
|
|
return _u
|
|
}
|
|
|
|
// SetNickname sets the "nickname" field.
|
|
func (_u *UserThirdAuthUpdate) SetNickname(v string) *UserThirdAuthUpdate {
|
|
_u.mutation.SetNickname(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableNickname sets the "nickname" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdate) SetNillableNickname(v *string) *UserThirdAuthUpdate {
|
|
if v != nil {
|
|
_u.SetNickname(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearNickname clears the value of the "nickname" field.
|
|
func (_u *UserThirdAuthUpdate) ClearNickname() *UserThirdAuthUpdate {
|
|
_u.mutation.ClearNickname()
|
|
return _u
|
|
}
|
|
|
|
// SetAvatar sets the "avatar" field.
|
|
func (_u *UserThirdAuthUpdate) SetAvatar(v string) *UserThirdAuthUpdate {
|
|
_u.mutation.SetAvatar(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableAvatar sets the "avatar" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdate) SetNillableAvatar(v *string) *UserThirdAuthUpdate {
|
|
if v != nil {
|
|
_u.SetAvatar(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearAvatar clears the value of the "avatar" field.
|
|
func (_u *UserThirdAuthUpdate) ClearAvatar() *UserThirdAuthUpdate {
|
|
_u.mutation.ClearAvatar()
|
|
return _u
|
|
}
|
|
|
|
// SetEmail sets the "email" field.
|
|
func (_u *UserThirdAuthUpdate) SetEmail(v string) *UserThirdAuthUpdate {
|
|
_u.mutation.SetEmail(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableEmail sets the "email" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdate) SetNillableEmail(v *string) *UserThirdAuthUpdate {
|
|
if v != nil {
|
|
_u.SetEmail(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearEmail clears the value of the "email" field.
|
|
func (_u *UserThirdAuthUpdate) ClearEmail() *UserThirdAuthUpdate {
|
|
_u.mutation.ClearEmail()
|
|
return _u
|
|
}
|
|
|
|
// SetPhone sets the "phone" field.
|
|
func (_u *UserThirdAuthUpdate) SetPhone(v string) *UserThirdAuthUpdate {
|
|
_u.mutation.SetPhone(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillablePhone sets the "phone" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdate) SetNillablePhone(v *string) *UserThirdAuthUpdate {
|
|
if v != nil {
|
|
_u.SetPhone(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearPhone clears the value of the "phone" field.
|
|
func (_u *UserThirdAuthUpdate) ClearPhone() *UserThirdAuthUpdate {
|
|
_u.mutation.ClearPhone()
|
|
return _u
|
|
}
|
|
|
|
// SetIsBound sets the "is_bound" field.
|
|
func (_u *UserThirdAuthUpdate) SetIsBound(v bool) *UserThirdAuthUpdate {
|
|
_u.mutation.SetIsBound(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableIsBound sets the "is_bound" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdate) SetNillableIsBound(v *bool) *UserThirdAuthUpdate {
|
|
if v != nil {
|
|
_u.SetIsBound(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetBoundAt sets the "bound_at" field.
|
|
func (_u *UserThirdAuthUpdate) SetBoundAt(v time.Time) *UserThirdAuthUpdate {
|
|
_u.mutation.SetBoundAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableBoundAt sets the "bound_at" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdate) SetNillableBoundAt(v *time.Time) *UserThirdAuthUpdate {
|
|
if v != nil {
|
|
_u.SetBoundAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetExtraData sets the "extra_data" field.
|
|
func (_u *UserThirdAuthUpdate) SetExtraData(v map[string]interface{}) *UserThirdAuthUpdate {
|
|
_u.mutation.SetExtraData(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearExtraData clears the value of the "extra_data" field.
|
|
func (_u *UserThirdAuthUpdate) ClearExtraData() *UserThirdAuthUpdate {
|
|
_u.mutation.ClearExtraData()
|
|
return _u
|
|
}
|
|
|
|
// Mutation returns the UserThirdAuthMutation object of the builder.
|
|
func (_u *UserThirdAuthUpdate) Mutation() *UserThirdAuthMutation {
|
|
return _u.mutation
|
|
}
|
|
|
|
// Save executes the query and returns the number of nodes affected by the update operation.
|
|
func (_u *UserThirdAuthUpdate) Save(ctx context.Context) (int, error) {
|
|
_u.defaults()
|
|
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (_u *UserThirdAuthUpdate) SaveX(ctx context.Context) int {
|
|
affected, err := _u.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return affected
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_u *UserThirdAuthUpdate) Exec(ctx context.Context) error {
|
|
_, err := _u.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_u *UserThirdAuthUpdate) ExecX(ctx context.Context) {
|
|
if err := _u.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// defaults sets the default values of the builder before save.
|
|
func (_u *UserThirdAuthUpdate) defaults() {
|
|
if _, ok := _u.mutation.UpdatedAt(); !ok {
|
|
v := userthirdauth.UpdateDefaultUpdatedAt()
|
|
_u.mutation.SetUpdatedAt(v)
|
|
}
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
func (_u *UserThirdAuthUpdate) check() error {
|
|
if v, ok := _u.mutation.Openid(); ok {
|
|
if err := userthirdauth.OpenidValidator(v); err != nil {
|
|
return &ValidationError{Name: "openid", err: fmt.Errorf(`ent: validator failed for field "UserThirdAuth.openid": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _u.mutation.Unionid(); ok {
|
|
if err := userthirdauth.UnionidValidator(v); err != nil {
|
|
return &ValidationError{Name: "unionid", err: fmt.Errorf(`ent: validator failed for field "UserThirdAuth.unionid": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _u.mutation.AccessToken(); ok {
|
|
if err := userthirdauth.AccessTokenValidator(v); err != nil {
|
|
return &ValidationError{Name: "access_token", err: fmt.Errorf(`ent: validator failed for field "UserThirdAuth.access_token": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _u.mutation.RefreshToken(); ok {
|
|
if err := userthirdauth.RefreshTokenValidator(v); err != nil {
|
|
return &ValidationError{Name: "refresh_token", err: fmt.Errorf(`ent: validator failed for field "UserThirdAuth.refresh_token": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _u.mutation.PlatformUserID(); ok {
|
|
if err := userthirdauth.PlatformUserIDValidator(v); err != nil {
|
|
return &ValidationError{Name: "platform_user_id", err: fmt.Errorf(`ent: validator failed for field "UserThirdAuth.platform_user_id": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _u.mutation.Nickname(); ok {
|
|
if err := userthirdauth.NicknameValidator(v); err != nil {
|
|
return &ValidationError{Name: "nickname", err: fmt.Errorf(`ent: validator failed for field "UserThirdAuth.nickname": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _u.mutation.Avatar(); ok {
|
|
if err := userthirdauth.AvatarValidator(v); err != nil {
|
|
return &ValidationError{Name: "avatar", err: fmt.Errorf(`ent: validator failed for field "UserThirdAuth.avatar": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _u.mutation.Email(); ok {
|
|
if err := userthirdauth.EmailValidator(v); err != nil {
|
|
return &ValidationError{Name: "email", err: fmt.Errorf(`ent: validator failed for field "UserThirdAuth.email": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _u.mutation.Phone(); ok {
|
|
if err := userthirdauth.PhoneValidator(v); err != nil {
|
|
return &ValidationError{Name: "phone", err: fmt.Errorf(`ent: validator failed for field "UserThirdAuth.phone": %w`, err)}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (_u *UserThirdAuthUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
|
if err := _u.check(); err != nil {
|
|
return _node, err
|
|
}
|
|
_spec := sqlgraph.NewUpdateSpec(userthirdauth.Table, userthirdauth.Columns, sqlgraph.NewFieldSpec(userthirdauth.FieldID, field.TypeUint64))
|
|
if ps := _u.mutation.predicates; len(ps) > 0 {
|
|
_spec.Predicate = func(selector *sql.Selector) {
|
|
for i := range ps {
|
|
ps[i](selector)
|
|
}
|
|
}
|
|
}
|
|
if value, ok := _u.mutation.UpdatedAt(); ok {
|
|
_spec.SetField(userthirdauth.FieldUpdatedAt, field.TypeTime, value)
|
|
}
|
|
if value, ok := _u.mutation.Status(); ok {
|
|
_spec.SetField(userthirdauth.FieldStatus, field.TypeUint8, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedStatus(); ok {
|
|
_spec.AddField(userthirdauth.FieldStatus, field.TypeUint8, value)
|
|
}
|
|
if _u.mutation.StatusCleared() {
|
|
_spec.ClearField(userthirdauth.FieldStatus, field.TypeUint8)
|
|
}
|
|
if value, ok := _u.mutation.DeletedAt(); ok {
|
|
_spec.SetField(userthirdauth.FieldDeletedAt, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.DeletedAtCleared() {
|
|
_spec.ClearField(userthirdauth.FieldDeletedAt, field.TypeTime)
|
|
}
|
|
if value, ok := _u.mutation.UserID(); ok {
|
|
_spec.SetField(userthirdauth.FieldUserID, field.TypeUint64, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedUserID(); ok {
|
|
_spec.AddField(userthirdauth.FieldUserID, field.TypeUint64, value)
|
|
}
|
|
if value, ok := _u.mutation.Openid(); ok {
|
|
_spec.SetField(userthirdauth.FieldOpenid, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.Unionid(); ok {
|
|
_spec.SetField(userthirdauth.FieldUnionid, field.TypeString, value)
|
|
}
|
|
if _u.mutation.UnionidCleared() {
|
|
_spec.ClearField(userthirdauth.FieldUnionid, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.AccessToken(); ok {
|
|
_spec.SetField(userthirdauth.FieldAccessToken, field.TypeString, value)
|
|
}
|
|
if _u.mutation.AccessTokenCleared() {
|
|
_spec.ClearField(userthirdauth.FieldAccessToken, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.RefreshToken(); ok {
|
|
_spec.SetField(userthirdauth.FieldRefreshToken, field.TypeString, value)
|
|
}
|
|
if _u.mutation.RefreshTokenCleared() {
|
|
_spec.ClearField(userthirdauth.FieldRefreshToken, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.AccessTokenExpiry(); ok {
|
|
_spec.SetField(userthirdauth.FieldAccessTokenExpiry, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.AccessTokenExpiryCleared() {
|
|
_spec.ClearField(userthirdauth.FieldAccessTokenExpiry, field.TypeTime)
|
|
}
|
|
if value, ok := _u.mutation.UserInfo(); ok {
|
|
_spec.SetField(userthirdauth.FieldUserInfo, field.TypeJSON, value)
|
|
}
|
|
if _u.mutation.UserInfoCleared() {
|
|
_spec.ClearField(userthirdauth.FieldUserInfo, field.TypeJSON)
|
|
}
|
|
if value, ok := _u.mutation.PlatformUserID(); ok {
|
|
_spec.SetField(userthirdauth.FieldPlatformUserID, field.TypeString, value)
|
|
}
|
|
if _u.mutation.PlatformUserIDCleared() {
|
|
_spec.ClearField(userthirdauth.FieldPlatformUserID, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Nickname(); ok {
|
|
_spec.SetField(userthirdauth.FieldNickname, field.TypeString, value)
|
|
}
|
|
if _u.mutation.NicknameCleared() {
|
|
_spec.ClearField(userthirdauth.FieldNickname, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Avatar(); ok {
|
|
_spec.SetField(userthirdauth.FieldAvatar, field.TypeString, value)
|
|
}
|
|
if _u.mutation.AvatarCleared() {
|
|
_spec.ClearField(userthirdauth.FieldAvatar, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Email(); ok {
|
|
_spec.SetField(userthirdauth.FieldEmail, field.TypeString, value)
|
|
}
|
|
if _u.mutation.EmailCleared() {
|
|
_spec.ClearField(userthirdauth.FieldEmail, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Phone(); ok {
|
|
_spec.SetField(userthirdauth.FieldPhone, field.TypeString, value)
|
|
}
|
|
if _u.mutation.PhoneCleared() {
|
|
_spec.ClearField(userthirdauth.FieldPhone, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.IsBound(); ok {
|
|
_spec.SetField(userthirdauth.FieldIsBound, field.TypeBool, value)
|
|
}
|
|
if value, ok := _u.mutation.BoundAt(); ok {
|
|
_spec.SetField(userthirdauth.FieldBoundAt, field.TypeTime, value)
|
|
}
|
|
if value, ok := _u.mutation.ExtraData(); ok {
|
|
_spec.SetField(userthirdauth.FieldExtraData, field.TypeJSON, value)
|
|
}
|
|
if _u.mutation.ExtraDataCleared() {
|
|
_spec.ClearField(userthirdauth.FieldExtraData, field.TypeJSON)
|
|
}
|
|
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
|
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
|
err = &NotFoundError{userthirdauth.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return 0, err
|
|
}
|
|
_u.mutation.done = true
|
|
return _node, nil
|
|
}
|
|
|
|
// UserThirdAuthUpdateOne is the builder for updating a single UserThirdAuth entity.
|
|
type UserThirdAuthUpdateOne struct {
|
|
config
|
|
fields []string
|
|
hooks []Hook
|
|
mutation *UserThirdAuthMutation
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (_u *UserThirdAuthUpdateOne) SetUpdatedAt(v time.Time) *UserThirdAuthUpdateOne {
|
|
_u.mutation.SetUpdatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (_u *UserThirdAuthUpdateOne) SetStatus(v uint8) *UserThirdAuthUpdateOne {
|
|
_u.mutation.ResetStatus()
|
|
_u.mutation.SetStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableStatus sets the "status" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdateOne) SetNillableStatus(v *uint8) *UserThirdAuthUpdateOne {
|
|
if v != nil {
|
|
_u.SetStatus(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddStatus adds value to the "status" field.
|
|
func (_u *UserThirdAuthUpdateOne) AddStatus(v int8) *UserThirdAuthUpdateOne {
|
|
_u.mutation.AddStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearStatus clears the value of the "status" field.
|
|
func (_u *UserThirdAuthUpdateOne) ClearStatus() *UserThirdAuthUpdateOne {
|
|
_u.mutation.ClearStatus()
|
|
return _u
|
|
}
|
|
|
|
// SetDeletedAt sets the "deleted_at" field.
|
|
func (_u *UserThirdAuthUpdateOne) SetDeletedAt(v time.Time) *UserThirdAuthUpdateOne {
|
|
_u.mutation.SetDeletedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdateOne) SetNillableDeletedAt(v *time.Time) *UserThirdAuthUpdateOne {
|
|
if v != nil {
|
|
_u.SetDeletedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearDeletedAt clears the value of the "deleted_at" field.
|
|
func (_u *UserThirdAuthUpdateOne) ClearDeletedAt() *UserThirdAuthUpdateOne {
|
|
_u.mutation.ClearDeletedAt()
|
|
return _u
|
|
}
|
|
|
|
// SetUserID sets the "user_id" field.
|
|
func (_u *UserThirdAuthUpdateOne) SetUserID(v uint64) *UserThirdAuthUpdateOne {
|
|
_u.mutation.ResetUserID()
|
|
_u.mutation.SetUserID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableUserID sets the "user_id" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdateOne) SetNillableUserID(v *uint64) *UserThirdAuthUpdateOne {
|
|
if v != nil {
|
|
_u.SetUserID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddUserID adds value to the "user_id" field.
|
|
func (_u *UserThirdAuthUpdateOne) AddUserID(v int64) *UserThirdAuthUpdateOne {
|
|
_u.mutation.AddUserID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetOpenid sets the "openid" field.
|
|
func (_u *UserThirdAuthUpdateOne) SetOpenid(v string) *UserThirdAuthUpdateOne {
|
|
_u.mutation.SetOpenid(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableOpenid sets the "openid" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdateOne) SetNillableOpenid(v *string) *UserThirdAuthUpdateOne {
|
|
if v != nil {
|
|
_u.SetOpenid(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetUnionid sets the "unionid" field.
|
|
func (_u *UserThirdAuthUpdateOne) SetUnionid(v string) *UserThirdAuthUpdateOne {
|
|
_u.mutation.SetUnionid(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableUnionid sets the "unionid" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdateOne) SetNillableUnionid(v *string) *UserThirdAuthUpdateOne {
|
|
if v != nil {
|
|
_u.SetUnionid(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearUnionid clears the value of the "unionid" field.
|
|
func (_u *UserThirdAuthUpdateOne) ClearUnionid() *UserThirdAuthUpdateOne {
|
|
_u.mutation.ClearUnionid()
|
|
return _u
|
|
}
|
|
|
|
// SetAccessToken sets the "access_token" field.
|
|
func (_u *UserThirdAuthUpdateOne) SetAccessToken(v string) *UserThirdAuthUpdateOne {
|
|
_u.mutation.SetAccessToken(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableAccessToken sets the "access_token" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdateOne) SetNillableAccessToken(v *string) *UserThirdAuthUpdateOne {
|
|
if v != nil {
|
|
_u.SetAccessToken(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearAccessToken clears the value of the "access_token" field.
|
|
func (_u *UserThirdAuthUpdateOne) ClearAccessToken() *UserThirdAuthUpdateOne {
|
|
_u.mutation.ClearAccessToken()
|
|
return _u
|
|
}
|
|
|
|
// SetRefreshToken sets the "refresh_token" field.
|
|
func (_u *UserThirdAuthUpdateOne) SetRefreshToken(v string) *UserThirdAuthUpdateOne {
|
|
_u.mutation.SetRefreshToken(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRefreshToken sets the "refresh_token" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdateOne) SetNillableRefreshToken(v *string) *UserThirdAuthUpdateOne {
|
|
if v != nil {
|
|
_u.SetRefreshToken(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearRefreshToken clears the value of the "refresh_token" field.
|
|
func (_u *UserThirdAuthUpdateOne) ClearRefreshToken() *UserThirdAuthUpdateOne {
|
|
_u.mutation.ClearRefreshToken()
|
|
return _u
|
|
}
|
|
|
|
// SetAccessTokenExpiry sets the "access_token_expiry" field.
|
|
func (_u *UserThirdAuthUpdateOne) SetAccessTokenExpiry(v time.Time) *UserThirdAuthUpdateOne {
|
|
_u.mutation.SetAccessTokenExpiry(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableAccessTokenExpiry sets the "access_token_expiry" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdateOne) SetNillableAccessTokenExpiry(v *time.Time) *UserThirdAuthUpdateOne {
|
|
if v != nil {
|
|
_u.SetAccessTokenExpiry(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearAccessTokenExpiry clears the value of the "access_token_expiry" field.
|
|
func (_u *UserThirdAuthUpdateOne) ClearAccessTokenExpiry() *UserThirdAuthUpdateOne {
|
|
_u.mutation.ClearAccessTokenExpiry()
|
|
return _u
|
|
}
|
|
|
|
// SetUserInfo sets the "user_info" field.
|
|
func (_u *UserThirdAuthUpdateOne) SetUserInfo(v map[string]interface{}) *UserThirdAuthUpdateOne {
|
|
_u.mutation.SetUserInfo(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearUserInfo clears the value of the "user_info" field.
|
|
func (_u *UserThirdAuthUpdateOne) ClearUserInfo() *UserThirdAuthUpdateOne {
|
|
_u.mutation.ClearUserInfo()
|
|
return _u
|
|
}
|
|
|
|
// SetPlatformUserID sets the "platform_user_id" field.
|
|
func (_u *UserThirdAuthUpdateOne) SetPlatformUserID(v string) *UserThirdAuthUpdateOne {
|
|
_u.mutation.SetPlatformUserID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillablePlatformUserID sets the "platform_user_id" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdateOne) SetNillablePlatformUserID(v *string) *UserThirdAuthUpdateOne {
|
|
if v != nil {
|
|
_u.SetPlatformUserID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearPlatformUserID clears the value of the "platform_user_id" field.
|
|
func (_u *UserThirdAuthUpdateOne) ClearPlatformUserID() *UserThirdAuthUpdateOne {
|
|
_u.mutation.ClearPlatformUserID()
|
|
return _u
|
|
}
|
|
|
|
// SetNickname sets the "nickname" field.
|
|
func (_u *UserThirdAuthUpdateOne) SetNickname(v string) *UserThirdAuthUpdateOne {
|
|
_u.mutation.SetNickname(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableNickname sets the "nickname" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdateOne) SetNillableNickname(v *string) *UserThirdAuthUpdateOne {
|
|
if v != nil {
|
|
_u.SetNickname(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearNickname clears the value of the "nickname" field.
|
|
func (_u *UserThirdAuthUpdateOne) ClearNickname() *UserThirdAuthUpdateOne {
|
|
_u.mutation.ClearNickname()
|
|
return _u
|
|
}
|
|
|
|
// SetAvatar sets the "avatar" field.
|
|
func (_u *UserThirdAuthUpdateOne) SetAvatar(v string) *UserThirdAuthUpdateOne {
|
|
_u.mutation.SetAvatar(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableAvatar sets the "avatar" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdateOne) SetNillableAvatar(v *string) *UserThirdAuthUpdateOne {
|
|
if v != nil {
|
|
_u.SetAvatar(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearAvatar clears the value of the "avatar" field.
|
|
func (_u *UserThirdAuthUpdateOne) ClearAvatar() *UserThirdAuthUpdateOne {
|
|
_u.mutation.ClearAvatar()
|
|
return _u
|
|
}
|
|
|
|
// SetEmail sets the "email" field.
|
|
func (_u *UserThirdAuthUpdateOne) SetEmail(v string) *UserThirdAuthUpdateOne {
|
|
_u.mutation.SetEmail(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableEmail sets the "email" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdateOne) SetNillableEmail(v *string) *UserThirdAuthUpdateOne {
|
|
if v != nil {
|
|
_u.SetEmail(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearEmail clears the value of the "email" field.
|
|
func (_u *UserThirdAuthUpdateOne) ClearEmail() *UserThirdAuthUpdateOne {
|
|
_u.mutation.ClearEmail()
|
|
return _u
|
|
}
|
|
|
|
// SetPhone sets the "phone" field.
|
|
func (_u *UserThirdAuthUpdateOne) SetPhone(v string) *UserThirdAuthUpdateOne {
|
|
_u.mutation.SetPhone(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillablePhone sets the "phone" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdateOne) SetNillablePhone(v *string) *UserThirdAuthUpdateOne {
|
|
if v != nil {
|
|
_u.SetPhone(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearPhone clears the value of the "phone" field.
|
|
func (_u *UserThirdAuthUpdateOne) ClearPhone() *UserThirdAuthUpdateOne {
|
|
_u.mutation.ClearPhone()
|
|
return _u
|
|
}
|
|
|
|
// SetIsBound sets the "is_bound" field.
|
|
func (_u *UserThirdAuthUpdateOne) SetIsBound(v bool) *UserThirdAuthUpdateOne {
|
|
_u.mutation.SetIsBound(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableIsBound sets the "is_bound" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdateOne) SetNillableIsBound(v *bool) *UserThirdAuthUpdateOne {
|
|
if v != nil {
|
|
_u.SetIsBound(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetBoundAt sets the "bound_at" field.
|
|
func (_u *UserThirdAuthUpdateOne) SetBoundAt(v time.Time) *UserThirdAuthUpdateOne {
|
|
_u.mutation.SetBoundAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableBoundAt sets the "bound_at" field if the given value is not nil.
|
|
func (_u *UserThirdAuthUpdateOne) SetNillableBoundAt(v *time.Time) *UserThirdAuthUpdateOne {
|
|
if v != nil {
|
|
_u.SetBoundAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetExtraData sets the "extra_data" field.
|
|
func (_u *UserThirdAuthUpdateOne) SetExtraData(v map[string]interface{}) *UserThirdAuthUpdateOne {
|
|
_u.mutation.SetExtraData(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearExtraData clears the value of the "extra_data" field.
|
|
func (_u *UserThirdAuthUpdateOne) ClearExtraData() *UserThirdAuthUpdateOne {
|
|
_u.mutation.ClearExtraData()
|
|
return _u
|
|
}
|
|
|
|
// Mutation returns the UserThirdAuthMutation object of the builder.
|
|
func (_u *UserThirdAuthUpdateOne) Mutation() *UserThirdAuthMutation {
|
|
return _u.mutation
|
|
}
|
|
|
|
// Where appends a list predicates to the UserThirdAuthUpdate builder.
|
|
func (_u *UserThirdAuthUpdateOne) Where(ps ...predicate.UserThirdAuth) *UserThirdAuthUpdateOne {
|
|
_u.mutation.Where(ps...)
|
|
return _u
|
|
}
|
|
|
|
// Select allows selecting one or more fields (columns) of the returned entity.
|
|
// The default is selecting all fields defined in the entity schema.
|
|
func (_u *UserThirdAuthUpdateOne) Select(field string, fields ...string) *UserThirdAuthUpdateOne {
|
|
_u.fields = append([]string{field}, fields...)
|
|
return _u
|
|
}
|
|
|
|
// Save executes the query and returns the updated UserThirdAuth entity.
|
|
func (_u *UserThirdAuthUpdateOne) Save(ctx context.Context) (*UserThirdAuth, error) {
|
|
_u.defaults()
|
|
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (_u *UserThirdAuthUpdateOne) SaveX(ctx context.Context) *UserThirdAuth {
|
|
node, err := _u.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return node
|
|
}
|
|
|
|
// Exec executes the query on the entity.
|
|
func (_u *UserThirdAuthUpdateOne) Exec(ctx context.Context) error {
|
|
_, err := _u.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_u *UserThirdAuthUpdateOne) ExecX(ctx context.Context) {
|
|
if err := _u.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// defaults sets the default values of the builder before save.
|
|
func (_u *UserThirdAuthUpdateOne) defaults() {
|
|
if _, ok := _u.mutation.UpdatedAt(); !ok {
|
|
v := userthirdauth.UpdateDefaultUpdatedAt()
|
|
_u.mutation.SetUpdatedAt(v)
|
|
}
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
func (_u *UserThirdAuthUpdateOne) check() error {
|
|
if v, ok := _u.mutation.Openid(); ok {
|
|
if err := userthirdauth.OpenidValidator(v); err != nil {
|
|
return &ValidationError{Name: "openid", err: fmt.Errorf(`ent: validator failed for field "UserThirdAuth.openid": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _u.mutation.Unionid(); ok {
|
|
if err := userthirdauth.UnionidValidator(v); err != nil {
|
|
return &ValidationError{Name: "unionid", err: fmt.Errorf(`ent: validator failed for field "UserThirdAuth.unionid": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _u.mutation.AccessToken(); ok {
|
|
if err := userthirdauth.AccessTokenValidator(v); err != nil {
|
|
return &ValidationError{Name: "access_token", err: fmt.Errorf(`ent: validator failed for field "UserThirdAuth.access_token": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _u.mutation.RefreshToken(); ok {
|
|
if err := userthirdauth.RefreshTokenValidator(v); err != nil {
|
|
return &ValidationError{Name: "refresh_token", err: fmt.Errorf(`ent: validator failed for field "UserThirdAuth.refresh_token": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _u.mutation.PlatformUserID(); ok {
|
|
if err := userthirdauth.PlatformUserIDValidator(v); err != nil {
|
|
return &ValidationError{Name: "platform_user_id", err: fmt.Errorf(`ent: validator failed for field "UserThirdAuth.platform_user_id": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _u.mutation.Nickname(); ok {
|
|
if err := userthirdauth.NicknameValidator(v); err != nil {
|
|
return &ValidationError{Name: "nickname", err: fmt.Errorf(`ent: validator failed for field "UserThirdAuth.nickname": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _u.mutation.Avatar(); ok {
|
|
if err := userthirdauth.AvatarValidator(v); err != nil {
|
|
return &ValidationError{Name: "avatar", err: fmt.Errorf(`ent: validator failed for field "UserThirdAuth.avatar": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _u.mutation.Email(); ok {
|
|
if err := userthirdauth.EmailValidator(v); err != nil {
|
|
return &ValidationError{Name: "email", err: fmt.Errorf(`ent: validator failed for field "UserThirdAuth.email": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _u.mutation.Phone(); ok {
|
|
if err := userthirdauth.PhoneValidator(v); err != nil {
|
|
return &ValidationError{Name: "phone", err: fmt.Errorf(`ent: validator failed for field "UserThirdAuth.phone": %w`, err)}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (_u *UserThirdAuthUpdateOne) sqlSave(ctx context.Context) (_node *UserThirdAuth, err error) {
|
|
if err := _u.check(); err != nil {
|
|
return _node, err
|
|
}
|
|
_spec := sqlgraph.NewUpdateSpec(userthirdauth.Table, userthirdauth.Columns, sqlgraph.NewFieldSpec(userthirdauth.FieldID, field.TypeUint64))
|
|
id, ok := _u.mutation.ID()
|
|
if !ok {
|
|
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "UserThirdAuth.id" for update`)}
|
|
}
|
|
_spec.Node.ID.Value = id
|
|
if fields := _u.fields; len(fields) > 0 {
|
|
_spec.Node.Columns = make([]string, 0, len(fields))
|
|
_spec.Node.Columns = append(_spec.Node.Columns, userthirdauth.FieldID)
|
|
for _, f := range fields {
|
|
if !userthirdauth.ValidColumn(f) {
|
|
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
|
}
|
|
if f != userthirdauth.FieldID {
|
|
_spec.Node.Columns = append(_spec.Node.Columns, f)
|
|
}
|
|
}
|
|
}
|
|
if ps := _u.mutation.predicates; len(ps) > 0 {
|
|
_spec.Predicate = func(selector *sql.Selector) {
|
|
for i := range ps {
|
|
ps[i](selector)
|
|
}
|
|
}
|
|
}
|
|
if value, ok := _u.mutation.UpdatedAt(); ok {
|
|
_spec.SetField(userthirdauth.FieldUpdatedAt, field.TypeTime, value)
|
|
}
|
|
if value, ok := _u.mutation.Status(); ok {
|
|
_spec.SetField(userthirdauth.FieldStatus, field.TypeUint8, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedStatus(); ok {
|
|
_spec.AddField(userthirdauth.FieldStatus, field.TypeUint8, value)
|
|
}
|
|
if _u.mutation.StatusCleared() {
|
|
_spec.ClearField(userthirdauth.FieldStatus, field.TypeUint8)
|
|
}
|
|
if value, ok := _u.mutation.DeletedAt(); ok {
|
|
_spec.SetField(userthirdauth.FieldDeletedAt, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.DeletedAtCleared() {
|
|
_spec.ClearField(userthirdauth.FieldDeletedAt, field.TypeTime)
|
|
}
|
|
if value, ok := _u.mutation.UserID(); ok {
|
|
_spec.SetField(userthirdauth.FieldUserID, field.TypeUint64, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedUserID(); ok {
|
|
_spec.AddField(userthirdauth.FieldUserID, field.TypeUint64, value)
|
|
}
|
|
if value, ok := _u.mutation.Openid(); ok {
|
|
_spec.SetField(userthirdauth.FieldOpenid, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.Unionid(); ok {
|
|
_spec.SetField(userthirdauth.FieldUnionid, field.TypeString, value)
|
|
}
|
|
if _u.mutation.UnionidCleared() {
|
|
_spec.ClearField(userthirdauth.FieldUnionid, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.AccessToken(); ok {
|
|
_spec.SetField(userthirdauth.FieldAccessToken, field.TypeString, value)
|
|
}
|
|
if _u.mutation.AccessTokenCleared() {
|
|
_spec.ClearField(userthirdauth.FieldAccessToken, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.RefreshToken(); ok {
|
|
_spec.SetField(userthirdauth.FieldRefreshToken, field.TypeString, value)
|
|
}
|
|
if _u.mutation.RefreshTokenCleared() {
|
|
_spec.ClearField(userthirdauth.FieldRefreshToken, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.AccessTokenExpiry(); ok {
|
|
_spec.SetField(userthirdauth.FieldAccessTokenExpiry, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.AccessTokenExpiryCleared() {
|
|
_spec.ClearField(userthirdauth.FieldAccessTokenExpiry, field.TypeTime)
|
|
}
|
|
if value, ok := _u.mutation.UserInfo(); ok {
|
|
_spec.SetField(userthirdauth.FieldUserInfo, field.TypeJSON, value)
|
|
}
|
|
if _u.mutation.UserInfoCleared() {
|
|
_spec.ClearField(userthirdauth.FieldUserInfo, field.TypeJSON)
|
|
}
|
|
if value, ok := _u.mutation.PlatformUserID(); ok {
|
|
_spec.SetField(userthirdauth.FieldPlatformUserID, field.TypeString, value)
|
|
}
|
|
if _u.mutation.PlatformUserIDCleared() {
|
|
_spec.ClearField(userthirdauth.FieldPlatformUserID, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Nickname(); ok {
|
|
_spec.SetField(userthirdauth.FieldNickname, field.TypeString, value)
|
|
}
|
|
if _u.mutation.NicknameCleared() {
|
|
_spec.ClearField(userthirdauth.FieldNickname, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Avatar(); ok {
|
|
_spec.SetField(userthirdauth.FieldAvatar, field.TypeString, value)
|
|
}
|
|
if _u.mutation.AvatarCleared() {
|
|
_spec.ClearField(userthirdauth.FieldAvatar, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Email(); ok {
|
|
_spec.SetField(userthirdauth.FieldEmail, field.TypeString, value)
|
|
}
|
|
if _u.mutation.EmailCleared() {
|
|
_spec.ClearField(userthirdauth.FieldEmail, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Phone(); ok {
|
|
_spec.SetField(userthirdauth.FieldPhone, field.TypeString, value)
|
|
}
|
|
if _u.mutation.PhoneCleared() {
|
|
_spec.ClearField(userthirdauth.FieldPhone, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.IsBound(); ok {
|
|
_spec.SetField(userthirdauth.FieldIsBound, field.TypeBool, value)
|
|
}
|
|
if value, ok := _u.mutation.BoundAt(); ok {
|
|
_spec.SetField(userthirdauth.FieldBoundAt, field.TypeTime, value)
|
|
}
|
|
if value, ok := _u.mutation.ExtraData(); ok {
|
|
_spec.SetField(userthirdauth.FieldExtraData, field.TypeJSON, value)
|
|
}
|
|
if _u.mutation.ExtraDataCleared() {
|
|
_spec.ClearField(userthirdauth.FieldExtraData, field.TypeJSON)
|
|
}
|
|
_node = &UserThirdAuth{config: _u.config}
|
|
_spec.Assign = _node.assignValues
|
|
_spec.ScanValues = _node.scanValues
|
|
if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
|
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
|
err = &NotFoundError{userthirdauth.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return nil, err
|
|
}
|
|
_u.mutation.done = true
|
|
return _node, nil
|
|
}
|