github.com/cloudwan/edgelq-sdk@v1.15.4/iam/resources/v1/user/user.pb.object_ext.go (about)

     1  // Code generated by protoc-gen-goten-object
     2  // File: edgelq/iam/proto/v1/user.proto
     3  // DO NOT EDIT!!!
     4  
     5  package user
     6  
     7  import (
     8  	"fmt"
     9  	"sort"
    10  
    11  	"google.golang.org/protobuf/proto"
    12  	googlefieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
    13  
    14  	gotenobject "github.com/cloudwan/goten-sdk/runtime/object"
    15  )
    16  
    17  // proto imports
    18  import (
    19  	meta "github.com/cloudwan/goten-sdk/types/meta"
    20  	timestamppb "google.golang.org/protobuf/types/known/timestamppb"
    21  )
    22  
    23  // ensure the imports are used
    24  var (
    25  	_ = new(fmt.Stringer)
    26  	_ = new(sort.Interface)
    27  
    28  	_ = new(proto.Message)
    29  	_ = googlefieldmaskpb.FieldMask{}
    30  
    31  	_ = new(gotenobject.FieldPath)
    32  )
    33  
    34  // make sure we're using proto imports
    35  var (
    36  	_ = &timestamppb.Timestamp{}
    37  	_ = &meta.Meta{}
    38  )
    39  
    40  func (o *User) GotenObjectExt() {}
    41  
    42  func (o *User) MakeFullFieldMask() *User_FieldMask {
    43  	return FullUser_FieldMask()
    44  }
    45  
    46  func (o *User) MakeRawFullFieldMask() gotenobject.FieldMask {
    47  	return FullUser_FieldMask()
    48  }
    49  
    50  func (o *User) MakeDiffFieldMask(other *User) *User_FieldMask {
    51  	if o == nil && other == nil {
    52  		return &User_FieldMask{}
    53  	}
    54  	if o == nil || other == nil {
    55  		return FullUser_FieldMask()
    56  	}
    57  
    58  	res := &User_FieldMask{}
    59  	if o.GetName().String() != other.GetName().String() {
    60  		res.Paths = append(res.Paths, &User_FieldTerminalPath{selector: User_FieldPathSelectorName})
    61  	}
    62  	{
    63  		subMask := o.GetMetadata().MakeDiffFieldMask(other.GetMetadata())
    64  		if subMask.IsFull() {
    65  			res.Paths = append(res.Paths, &User_FieldTerminalPath{selector: User_FieldPathSelectorMetadata})
    66  		} else {
    67  			for _, subpath := range subMask.Paths {
    68  				res.Paths = append(res.Paths, &User_FieldSubPath{selector: User_FieldPathSelectorMetadata, subPath: subpath})
    69  			}
    70  		}
    71  	}
    72  	if o.GetFullName() != other.GetFullName() {
    73  		res.Paths = append(res.Paths, &User_FieldTerminalPath{selector: User_FieldPathSelectorFullName})
    74  	}
    75  	if o.GetEmail() != other.GetEmail() {
    76  		res.Paths = append(res.Paths, &User_FieldTerminalPath{selector: User_FieldPathSelectorEmail})
    77  	}
    78  	if o.GetEmailVerified() != other.GetEmailVerified() {
    79  		res.Paths = append(res.Paths, &User_FieldTerminalPath{selector: User_FieldPathSelectorEmailVerified})
    80  	}
    81  	{
    82  		subMask := o.GetAuthInfo().MakeDiffFieldMask(other.GetAuthInfo())
    83  		if subMask.IsFull() {
    84  			res.Paths = append(res.Paths, &User_FieldTerminalPath{selector: User_FieldPathSelectorAuthInfo})
    85  		} else {
    86  			for _, subpath := range subMask.Paths {
    87  				res.Paths = append(res.Paths, &User_FieldSubPath{selector: User_FieldPathSelectorAuthInfo, subPath: subpath})
    88  			}
    89  		}
    90  	}
    91  
    92  	if len(o.GetSettings()) == len(other.GetSettings()) {
    93  		for i, lValue := range o.GetSettings() {
    94  			rValue := other.GetSettings()[i]
    95  			if lValue != rValue {
    96  				res.Paths = append(res.Paths, &User_FieldTerminalPath{selector: User_FieldPathSelectorSettings})
    97  				break
    98  			}
    99  		}
   100  	} else {
   101  		res.Paths = append(res.Paths, &User_FieldTerminalPath{selector: User_FieldPathSelectorSettings})
   102  	}
   103  	if !proto.Equal(o.GetRefreshedTime(), other.GetRefreshedTime()) {
   104  		res.Paths = append(res.Paths, &User_FieldTerminalPath{selector: User_FieldPathSelectorRefreshedTime})
   105  	}
   106  	{
   107  		subMask := o.GetCtrlStatus().MakeDiffFieldMask(other.GetCtrlStatus())
   108  		if subMask.IsFull() {
   109  			res.Paths = append(res.Paths, &User_FieldTerminalPath{selector: User_FieldPathSelectorCtrlStatus})
   110  		} else {
   111  			for _, subpath := range subMask.Paths {
   112  				res.Paths = append(res.Paths, &User_FieldSubPath{selector: User_FieldPathSelectorCtrlStatus, subPath: subpath})
   113  			}
   114  		}
   115  	}
   116  	return res
   117  }
   118  
   119  func (o *User) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask {
   120  	return o.MakeDiffFieldMask(other.(*User))
   121  }
   122  
   123  func (o *User) Clone() *User {
   124  	if o == nil {
   125  		return nil
   126  	}
   127  	result := &User{}
   128  	if o.Name == nil {
   129  		result.Name = nil
   130  	} else if data, err := o.Name.ProtoString(); err != nil {
   131  		panic(err)
   132  	} else {
   133  		result.Name = &Name{}
   134  		if err := result.Name.ParseProtoString(data); err != nil {
   135  			panic(err)
   136  		}
   137  	}
   138  	result.Metadata = o.Metadata.Clone()
   139  	result.FullName = o.FullName
   140  	result.Email = o.Email
   141  	result.EmailVerified = o.EmailVerified
   142  	result.AuthInfo = o.AuthInfo.Clone()
   143  	result.Settings = map[string]string{}
   144  	for key, sourceValue := range o.Settings {
   145  		result.Settings[key] = sourceValue
   146  	}
   147  	result.RefreshedTime = proto.Clone(o.RefreshedTime).(*timestamppb.Timestamp)
   148  	result.CtrlStatus = o.CtrlStatus.Clone()
   149  	return result
   150  }
   151  
   152  func (o *User) CloneRaw() gotenobject.GotenObjectExt {
   153  	return o.Clone()
   154  }
   155  
   156  func (o *User) Merge(source *User) {
   157  	if source.GetName() != nil {
   158  		if data, err := source.GetName().ProtoString(); err != nil {
   159  			panic(err)
   160  		} else {
   161  			o.Name = &Name{}
   162  			if err := o.Name.ParseProtoString(data); err != nil {
   163  				panic(err)
   164  			}
   165  		}
   166  	} else {
   167  		o.Name = nil
   168  	}
   169  	if source.GetMetadata() != nil {
   170  		if o.Metadata == nil {
   171  			o.Metadata = new(meta.Meta)
   172  		}
   173  		o.Metadata.Merge(source.GetMetadata())
   174  	}
   175  	o.FullName = source.GetFullName()
   176  	o.Email = source.GetEmail()
   177  	o.EmailVerified = source.GetEmailVerified()
   178  	if source.GetAuthInfo() != nil {
   179  		if o.AuthInfo == nil {
   180  			o.AuthInfo = new(User_AuthInfo)
   181  		}
   182  		o.AuthInfo.Merge(source.GetAuthInfo())
   183  	}
   184  	if source.GetSettings() != nil {
   185  		if o.Settings == nil {
   186  			o.Settings = make(map[string]string, len(source.GetSettings()))
   187  		}
   188  		for key, sourceValue := range source.GetSettings() {
   189  			o.Settings[key] = sourceValue
   190  		}
   191  	}
   192  	if source.GetRefreshedTime() != nil {
   193  		if o.RefreshedTime == nil {
   194  			o.RefreshedTime = new(timestamppb.Timestamp)
   195  		}
   196  		proto.Merge(o.RefreshedTime, source.GetRefreshedTime())
   197  	}
   198  	if source.GetCtrlStatus() != nil {
   199  		if o.CtrlStatus == nil {
   200  			o.CtrlStatus = new(User_WorkStatus)
   201  		}
   202  		o.CtrlStatus.Merge(source.GetCtrlStatus())
   203  	}
   204  }
   205  
   206  func (o *User) MergeRaw(source gotenobject.GotenObjectExt) {
   207  	o.Merge(source.(*User))
   208  }
   209  
   210  func (o *User_AuthInfo) GotenObjectExt() {}
   211  
   212  func (o *User_AuthInfo) MakeFullFieldMask() *User_AuthInfo_FieldMask {
   213  	return FullUser_AuthInfo_FieldMask()
   214  }
   215  
   216  func (o *User_AuthInfo) MakeRawFullFieldMask() gotenobject.FieldMask {
   217  	return FullUser_AuthInfo_FieldMask()
   218  }
   219  
   220  func (o *User_AuthInfo) MakeDiffFieldMask(other *User_AuthInfo) *User_AuthInfo_FieldMask {
   221  	if o == nil && other == nil {
   222  		return &User_AuthInfo_FieldMask{}
   223  	}
   224  	if o == nil || other == nil {
   225  		return FullUser_AuthInfo_FieldMask()
   226  	}
   227  
   228  	res := &User_AuthInfo_FieldMask{}
   229  	if o.GetProvider() != other.GetProvider() {
   230  		res.Paths = append(res.Paths, &UserAuthInfo_FieldTerminalPath{selector: UserAuthInfo_FieldPathSelectorProvider})
   231  	}
   232  	if o.GetId() != other.GetId() {
   233  		res.Paths = append(res.Paths, &UserAuthInfo_FieldTerminalPath{selector: UserAuthInfo_FieldPathSelectorId})
   234  	}
   235  	return res
   236  }
   237  
   238  func (o *User_AuthInfo) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask {
   239  	return o.MakeDiffFieldMask(other.(*User_AuthInfo))
   240  }
   241  
   242  func (o *User_AuthInfo) Clone() *User_AuthInfo {
   243  	if o == nil {
   244  		return nil
   245  	}
   246  	result := &User_AuthInfo{}
   247  	result.Provider = o.Provider
   248  	result.Id = o.Id
   249  	return result
   250  }
   251  
   252  func (o *User_AuthInfo) CloneRaw() gotenobject.GotenObjectExt {
   253  	return o.Clone()
   254  }
   255  
   256  func (o *User_AuthInfo) Merge(source *User_AuthInfo) {
   257  	o.Provider = source.GetProvider()
   258  	o.Id = source.GetId()
   259  }
   260  
   261  func (o *User_AuthInfo) MergeRaw(source gotenobject.GotenObjectExt) {
   262  	o.Merge(source.(*User_AuthInfo))
   263  }
   264  
   265  func (o *User_WorkStatus) GotenObjectExt() {}
   266  
   267  func (o *User_WorkStatus) MakeFullFieldMask() *User_WorkStatus_FieldMask {
   268  	return FullUser_WorkStatus_FieldMask()
   269  }
   270  
   271  func (o *User_WorkStatus) MakeRawFullFieldMask() gotenobject.FieldMask {
   272  	return FullUser_WorkStatus_FieldMask()
   273  }
   274  
   275  func (o *User_WorkStatus) MakeDiffFieldMask(other *User_WorkStatus) *User_WorkStatus_FieldMask {
   276  	if o == nil && other == nil {
   277  		return &User_WorkStatus_FieldMask{}
   278  	}
   279  	if o == nil || other == nil {
   280  		return FullUser_WorkStatus_FieldMask()
   281  	}
   282  
   283  	res := &User_WorkStatus_FieldMask{}
   284  	if o.GetPending() != other.GetPending() {
   285  		res.Paths = append(res.Paths, &UserWorkStatus_FieldTerminalPath{selector: UserWorkStatus_FieldPathSelectorPending})
   286  	}
   287  	return res
   288  }
   289  
   290  func (o *User_WorkStatus) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask {
   291  	return o.MakeDiffFieldMask(other.(*User_WorkStatus))
   292  }
   293  
   294  func (o *User_WorkStatus) Clone() *User_WorkStatus {
   295  	if o == nil {
   296  		return nil
   297  	}
   298  	result := &User_WorkStatus{}
   299  	result.Pending = o.Pending
   300  	return result
   301  }
   302  
   303  func (o *User_WorkStatus) CloneRaw() gotenobject.GotenObjectExt {
   304  	return o.Clone()
   305  }
   306  
   307  func (o *User_WorkStatus) Merge(source *User_WorkStatus) {
   308  	o.Pending = source.GetPending()
   309  }
   310  
   311  func (o *User_WorkStatus) MergeRaw(source gotenobject.GotenObjectExt) {
   312  	o.Merge(source.(*User_WorkStatus))
   313  }