github.com/cloudwan/edgelq-sdk@v1.15.4/iam/resources/v1alpha2/user/user.pb.object_ext.go (about) 1 // Code generated by protoc-gen-goten-object 2 // File: edgelq/iam/proto/v1alpha2/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 _ = ×tamppb.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 if o.GetFullName() != other.GetFullName() { 63 res.Paths = append(res.Paths, &User_FieldTerminalPath{selector: User_FieldPathSelectorFullName}) 64 } 65 { 66 subMask := o.GetMetadata().MakeDiffFieldMask(other.GetMetadata()) 67 if subMask.IsFull() { 68 res.Paths = append(res.Paths, &User_FieldTerminalPath{selector: User_FieldPathSelectorMetadata}) 69 } else { 70 for _, subpath := range subMask.Paths { 71 res.Paths = append(res.Paths, &User_FieldSubPath{selector: User_FieldPathSelectorMetadata, subPath: subpath}) 72 } 73 } 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 return res 107 } 108 109 func (o *User) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask { 110 return o.MakeDiffFieldMask(other.(*User)) 111 } 112 113 func (o *User) Clone() *User { 114 if o == nil { 115 return nil 116 } 117 result := &User{} 118 if o.Name == nil { 119 result.Name = nil 120 } else if data, err := o.Name.ProtoString(); err != nil { 121 panic(err) 122 } else { 123 result.Name = &Name{} 124 if err := result.Name.ParseProtoString(data); err != nil { 125 panic(err) 126 } 127 } 128 result.FullName = o.FullName 129 result.Metadata = o.Metadata.Clone() 130 result.Email = o.Email 131 result.EmailVerified = o.EmailVerified 132 result.AuthInfo = o.AuthInfo.Clone() 133 result.Settings = map[string]string{} 134 for key, sourceValue := range o.Settings { 135 result.Settings[key] = sourceValue 136 } 137 result.RefreshedTime = proto.Clone(o.RefreshedTime).(*timestamppb.Timestamp) 138 return result 139 } 140 141 func (o *User) CloneRaw() gotenobject.GotenObjectExt { 142 return o.Clone() 143 } 144 145 func (o *User) Merge(source *User) { 146 if source.GetName() != nil { 147 if data, err := source.GetName().ProtoString(); err != nil { 148 panic(err) 149 } else { 150 o.Name = &Name{} 151 if err := o.Name.ParseProtoString(data); err != nil { 152 panic(err) 153 } 154 } 155 } else { 156 o.Name = nil 157 } 158 o.FullName = source.GetFullName() 159 if source.GetMetadata() != nil { 160 if o.Metadata == nil { 161 o.Metadata = new(meta.Meta) 162 } 163 o.Metadata.Merge(source.GetMetadata()) 164 } 165 o.Email = source.GetEmail() 166 o.EmailVerified = source.GetEmailVerified() 167 if source.GetAuthInfo() != nil { 168 if o.AuthInfo == nil { 169 o.AuthInfo = new(User_AuthInfo) 170 } 171 o.AuthInfo.Merge(source.GetAuthInfo()) 172 } 173 if source.GetSettings() != nil { 174 if o.Settings == nil { 175 o.Settings = make(map[string]string, len(source.GetSettings())) 176 } 177 for key, sourceValue := range source.GetSettings() { 178 o.Settings[key] = sourceValue 179 } 180 } 181 if source.GetRefreshedTime() != nil { 182 if o.RefreshedTime == nil { 183 o.RefreshedTime = new(timestamppb.Timestamp) 184 } 185 proto.Merge(o.RefreshedTime, source.GetRefreshedTime()) 186 } 187 } 188 189 func (o *User) MergeRaw(source gotenobject.GotenObjectExt) { 190 o.Merge(source.(*User)) 191 } 192 193 func (o *User_AuthInfo) GotenObjectExt() {} 194 195 func (o *User_AuthInfo) MakeFullFieldMask() *User_AuthInfo_FieldMask { 196 return FullUser_AuthInfo_FieldMask() 197 } 198 199 func (o *User_AuthInfo) MakeRawFullFieldMask() gotenobject.FieldMask { 200 return FullUser_AuthInfo_FieldMask() 201 } 202 203 func (o *User_AuthInfo) MakeDiffFieldMask(other *User_AuthInfo) *User_AuthInfo_FieldMask { 204 if o == nil && other == nil { 205 return &User_AuthInfo_FieldMask{} 206 } 207 if o == nil || other == nil { 208 return FullUser_AuthInfo_FieldMask() 209 } 210 211 res := &User_AuthInfo_FieldMask{} 212 if o.GetProvider() != other.GetProvider() { 213 res.Paths = append(res.Paths, &UserAuthInfo_FieldTerminalPath{selector: UserAuthInfo_FieldPathSelectorProvider}) 214 } 215 if o.GetId() != other.GetId() { 216 res.Paths = append(res.Paths, &UserAuthInfo_FieldTerminalPath{selector: UserAuthInfo_FieldPathSelectorId}) 217 } 218 return res 219 } 220 221 func (o *User_AuthInfo) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask { 222 return o.MakeDiffFieldMask(other.(*User_AuthInfo)) 223 } 224 225 func (o *User_AuthInfo) Clone() *User_AuthInfo { 226 if o == nil { 227 return nil 228 } 229 result := &User_AuthInfo{} 230 result.Provider = o.Provider 231 result.Id = o.Id 232 return result 233 } 234 235 func (o *User_AuthInfo) CloneRaw() gotenobject.GotenObjectExt { 236 return o.Clone() 237 } 238 239 func (o *User_AuthInfo) Merge(source *User_AuthInfo) { 240 o.Provider = source.GetProvider() 241 o.Id = source.GetId() 242 } 243 244 func (o *User_AuthInfo) MergeRaw(source gotenobject.GotenObjectExt) { 245 o.Merge(source.(*User_AuthInfo)) 246 }