github.com/cloudwan/edgelq-sdk@v1.15.4/iam/resources/v1/permission/permission.pb.object_ext.go (about) 1 // Code generated by protoc-gen-goten-object 2 // File: edgelq/iam/proto/v1/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_service "github.com/cloudwan/goten-sdk/meta-service/resources/v1/service" 20 meta "github.com/cloudwan/goten-sdk/types/meta" 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 _ = &meta_service.Service{} 37 _ = &meta.Meta{} 38 ) 39 40 func (o *Permission) GotenObjectExt() {} 41 42 func (o *Permission) MakeFullFieldMask() *Permission_FieldMask { 43 return FullPermission_FieldMask() 44 } 45 46 func (o *Permission) MakeRawFullFieldMask() gotenobject.FieldMask { 47 return FullPermission_FieldMask() 48 } 49 50 func (o *Permission) MakeDiffFieldMask(other *Permission) *Permission_FieldMask { 51 if o == nil && other == nil { 52 return &Permission_FieldMask{} 53 } 54 if o == nil || other == nil { 55 return FullPermission_FieldMask() 56 } 57 58 res := &Permission_FieldMask{} 59 if o.GetName().String() != other.GetName().String() { 60 res.Paths = append(res.Paths, &Permission_FieldTerminalPath{selector: Permission_FieldPathSelectorName}) 61 } 62 { 63 subMask := o.GetMetadata().MakeDiffFieldMask(other.GetMetadata()) 64 if subMask.IsFull() { 65 res.Paths = append(res.Paths, &Permission_FieldTerminalPath{selector: Permission_FieldPathSelectorMetadata}) 66 } else { 67 for _, subpath := range subMask.Paths { 68 res.Paths = append(res.Paths, &Permission_FieldSubPath{selector: Permission_FieldPathSelectorMetadata, subPath: subpath}) 69 } 70 } 71 } 72 if o.GetTitle() != other.GetTitle() { 73 res.Paths = append(res.Paths, &Permission_FieldTerminalPath{selector: Permission_FieldPathSelectorTitle}) 74 } 75 if o.GetDescription() != other.GetDescription() { 76 res.Paths = append(res.Paths, &Permission_FieldTerminalPath{selector: Permission_FieldPathSelectorDescription}) 77 } 78 return res 79 } 80 81 func (o *Permission) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask { 82 return o.MakeDiffFieldMask(other.(*Permission)) 83 } 84 85 func (o *Permission) Clone() *Permission { 86 if o == nil { 87 return nil 88 } 89 result := &Permission{} 90 if o.Name == nil { 91 result.Name = nil 92 } else if data, err := o.Name.ProtoString(); err != nil { 93 panic(err) 94 } else { 95 result.Name = &Name{} 96 if err := result.Name.ParseProtoString(data); err != nil { 97 panic(err) 98 } 99 } 100 result.Metadata = o.Metadata.Clone() 101 result.Title = o.Title 102 result.Description = o.Description 103 return result 104 } 105 106 func (o *Permission) CloneRaw() gotenobject.GotenObjectExt { 107 return o.Clone() 108 } 109 110 func (o *Permission) Merge(source *Permission) { 111 if source.GetName() != nil { 112 if data, err := source.GetName().ProtoString(); err != nil { 113 panic(err) 114 } else { 115 o.Name = &Name{} 116 if err := o.Name.ParseProtoString(data); err != nil { 117 panic(err) 118 } 119 } 120 } else { 121 o.Name = nil 122 } 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 o.Title = source.GetTitle() 130 o.Description = source.GetDescription() 131 } 132 133 func (o *Permission) MergeRaw(source gotenobject.GotenObjectExt) { 134 o.Merge(source.(*Permission)) 135 }