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