github.com/cloudwan/edgelq-sdk@v1.15.4/iam/resources/v1alpha2/group/group.pb.object_ext.go (about) 1 // Code generated by protoc-gen-goten-object 2 // File: edgelq/iam/proto/v1alpha2/group.proto 3 // DO NOT EDIT!!! 4 5 package group 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 organization "github.com/cloudwan/edgelq-sdk/iam/resources/v1alpha2/organization" 20 project "github.com/cloudwan/edgelq-sdk/iam/resources/v1alpha2/project" 21 meta "github.com/cloudwan/goten-sdk/types/meta" 22 ) 23 24 // ensure the imports are used 25 var ( 26 _ = new(fmt.Stringer) 27 _ = new(sort.Interface) 28 29 _ = new(proto.Message) 30 _ = googlefieldmaskpb.FieldMask{} 31 32 _ = new(gotenobject.FieldPath) 33 ) 34 35 // make sure we're using proto imports 36 var ( 37 _ = &organization.Organization{} 38 _ = &project.Project{} 39 _ = &meta.Meta{} 40 ) 41 42 func (o *Group) GotenObjectExt() {} 43 44 func (o *Group) MakeFullFieldMask() *Group_FieldMask { 45 return FullGroup_FieldMask() 46 } 47 48 func (o *Group) MakeRawFullFieldMask() gotenobject.FieldMask { 49 return FullGroup_FieldMask() 50 } 51 52 func (o *Group) MakeDiffFieldMask(other *Group) *Group_FieldMask { 53 if o == nil && other == nil { 54 return &Group_FieldMask{} 55 } 56 if o == nil || other == nil { 57 return FullGroup_FieldMask() 58 } 59 60 res := &Group_FieldMask{} 61 if o.GetName().String() != other.GetName().String() { 62 res.Paths = append(res.Paths, &Group_FieldTerminalPath{selector: Group_FieldPathSelectorName}) 63 } 64 if o.GetDisplayName() != other.GetDisplayName() { 65 res.Paths = append(res.Paths, &Group_FieldTerminalPath{selector: Group_FieldPathSelectorDisplayName}) 66 } 67 if o.GetEmail() != other.GetEmail() { 68 res.Paths = append(res.Paths, &Group_FieldTerminalPath{selector: Group_FieldPathSelectorEmail}) 69 } 70 { 71 subMask := o.GetMetadata().MakeDiffFieldMask(other.GetMetadata()) 72 if subMask.IsFull() { 73 res.Paths = append(res.Paths, &Group_FieldTerminalPath{selector: Group_FieldPathSelectorMetadata}) 74 } else { 75 for _, subpath := range subMask.Paths { 76 res.Paths = append(res.Paths, &Group_FieldSubPath{selector: Group_FieldPathSelectorMetadata, subPath: subpath}) 77 } 78 } 79 } 80 return res 81 } 82 83 func (o *Group) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask { 84 return o.MakeDiffFieldMask(other.(*Group)) 85 } 86 87 func (o *Group) Clone() *Group { 88 if o == nil { 89 return nil 90 } 91 result := &Group{} 92 if o.Name == nil { 93 result.Name = nil 94 } else if data, err := o.Name.ProtoString(); err != nil { 95 panic(err) 96 } else { 97 result.Name = &Name{} 98 if err := result.Name.ParseProtoString(data); err != nil { 99 panic(err) 100 } 101 } 102 result.DisplayName = o.DisplayName 103 result.Email = o.Email 104 result.Metadata = o.Metadata.Clone() 105 return result 106 } 107 108 func (o *Group) CloneRaw() gotenobject.GotenObjectExt { 109 return o.Clone() 110 } 111 112 func (o *Group) Merge(source *Group) { 113 if source.GetName() != nil { 114 if data, err := source.GetName().ProtoString(); err != nil { 115 panic(err) 116 } else { 117 o.Name = &Name{} 118 if err := o.Name.ParseProtoString(data); err != nil { 119 panic(err) 120 } 121 } 122 } else { 123 o.Name = nil 124 } 125 o.DisplayName = source.GetDisplayName() 126 o.Email = source.GetEmail() 127 if source.GetMetadata() != nil { 128 if o.Metadata == nil { 129 o.Metadata = new(meta.Meta) 130 } 131 o.Metadata.Merge(source.GetMetadata()) 132 } 133 } 134 135 func (o *Group) MergeRaw(source gotenobject.GotenObjectExt) { 136 o.Merge(source.(*Group)) 137 }