-
Notifications
You must be signed in to change notification settings - Fork 1
/
group_member.pb.object_ext.go
162 lines (141 loc) · 4.39 KB
/
group_member.pb.object_ext.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
// Code generated by protoc-gen-goten-object
// File: edgelq/iam/proto/v1alpha2/group_member.proto
// DO NOT EDIT!!!
package group_member
import (
"fmt"
"sort"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/fieldmaskpb"
gotenobject "github.com/cloudwan/goten-sdk/runtime/object"
)
// proto imports
import (
ntt_meta "github.com/cloudwan/edgelq-sdk/common/types/meta"
group "github.com/cloudwan/edgelq-sdk/iam/resources/v1alpha2/group"
)
// ensure the imports are used
var (
_ = new(fmt.Stringer)
_ = new(sort.Interface)
_ = new(proto.Message)
_ = fieldmaskpb.FieldMask{}
_ = new(gotenobject.FieldPath)
)
// make sure we're using proto imports
var (
_ = &ntt_meta.Meta{}
_ = &group.Group{}
)
func (o *GroupMember) GotenObjectExt() {}
func (o *GroupMember) MakeFullFieldMask() *GroupMember_FieldMask {
return FullGroupMember_FieldMask()
}
func (o *GroupMember) MakeRawFullFieldMask() gotenobject.FieldMask {
return FullGroupMember_FieldMask()
}
func (o *GroupMember) MakeDiffFieldMask(other *GroupMember) *GroupMember_FieldMask {
if o == nil && other == nil {
return &GroupMember_FieldMask{}
}
if o == nil || other == nil {
return FullGroupMember_FieldMask()
}
res := &GroupMember_FieldMask{}
if o.GetName().String() != other.GetName().String() {
res.Paths = append(res.Paths, &GroupMember_FieldTerminalPath{selector: GroupMember_FieldPathSelectorName})
}
if o.GetMember() != other.GetMember() {
res.Paths = append(res.Paths, &GroupMember_FieldTerminalPath{selector: GroupMember_FieldPathSelectorMember})
}
if o.GetParentMember() != other.GetParentMember() {
res.Paths = append(res.Paths, &GroupMember_FieldTerminalPath{selector: GroupMember_FieldPathSelectorParentMember})
}
if len(o.GetMinAncestryMembers()) == len(other.GetMinAncestryMembers()) {
for i, lValue := range o.GetMinAncestryMembers() {
rValue := other.GetMinAncestryMembers()[i]
if lValue != rValue {
res.Paths = append(res.Paths, &GroupMember_FieldTerminalPath{selector: GroupMember_FieldPathSelectorMinAncestryMembers})
break
}
}
} else {
res.Paths = append(res.Paths, &GroupMember_FieldTerminalPath{selector: GroupMember_FieldPathSelectorMinAncestryMembers})
}
{
subMask := o.GetMetadata().MakeDiffFieldMask(other.GetMetadata())
if subMask.IsFull() {
res.Paths = append(res.Paths, &GroupMember_FieldTerminalPath{selector: GroupMember_FieldPathSelectorMetadata})
} else {
for _, subpath := range subMask.Paths {
res.Paths = append(res.Paths, &GroupMember_FieldSubPath{selector: GroupMember_FieldPathSelectorMetadata, subPath: subpath})
}
}
}
return res
}
func (o *GroupMember) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask {
return o.MakeDiffFieldMask(other.(*GroupMember))
}
func (o *GroupMember) Clone() *GroupMember {
if o == nil {
return nil
}
result := &GroupMember{}
if o.Name == nil {
result.Name = nil
} else if data, err := o.Name.ProtoString(); err != nil {
panic(err)
} else {
result.Name = &Name{}
if err := result.Name.ParseProtoString(data); err != nil {
panic(err)
}
}
result.Member = o.Member
result.ParentMember = o.ParentMember
result.MinAncestryMembers = make([]string, len(o.MinAncestryMembers))
for i, sourceValue := range o.MinAncestryMembers {
result.MinAncestryMembers[i] = sourceValue
}
result.Metadata = o.Metadata.Clone()
return result
}
func (o *GroupMember) CloneRaw() gotenobject.GotenObjectExt {
return o.Clone()
}
func (o *GroupMember) Merge(source *GroupMember) {
if source.GetName() != nil {
if data, err := source.GetName().ProtoString(); err != nil {
panic(err)
} else {
o.Name = &Name{}
if err := o.Name.ParseProtoString(data); err != nil {
panic(err)
}
}
} else {
o.Name = nil
}
o.Member = source.GetMember()
o.ParentMember = source.GetParentMember()
newMinAncestryMembers := make([]string, 0, len(o.MinAncestryMembers))
for _, currentValue := range o.MinAncestryMembers {
for _, sourceValue := range source.GetMinAncestryMembers() {
if currentValue == sourceValue {
newMinAncestryMembers = append(newMinAncestryMembers, currentValue)
break
}
}
}
o.MinAncestryMembers = newMinAncestryMembers
if source.GetMetadata() != nil {
if o.Metadata == nil {
o.Metadata = new(ntt_meta.Meta)
}
o.Metadata.Merge(source.GetMetadata())
}
}
func (o *GroupMember) MergeRaw(source gotenobject.GotenObjectExt) {
o.Merge(source.(*GroupMember))
}