/
status.pb.equal.go
141 lines (118 loc) · 2.43 KB
/
status.pb.equal.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
// Code generated by protoc-gen-ext. DO NOT EDIT.
// source: status.proto
package core
import (
"bytes"
"encoding/binary"
"errors"
"fmt"
"strings"
"github.com/golang/protobuf/proto"
equality "github.com/solo-io/protoc-gen-ext/pkg/equality"
)
// ensure the imports are used
var (
_ = errors.New("")
_ = fmt.Print
_ = binary.LittleEndian
_ = bytes.Compare
_ = strings.Compare
_ = equality.Equalizer(nil)
_ = proto.Message(nil)
)
// Equal function
func (m *NamespacedStatuses) Equal(that interface{}) bool {
if that == nil {
return m == nil
}
target, ok := that.(*NamespacedStatuses)
if !ok {
that2, ok := that.(NamespacedStatuses)
if ok {
target = &that2
} else {
return false
}
}
if target == nil {
return m == nil
} else if m == nil {
return false
}
if len(m.GetStatuses()) != len(target.GetStatuses()) {
return false
}
for k, v := range m.GetStatuses() {
if h, ok := interface{}(v).(equality.Equalizer); ok {
if !h.Equal(target.GetStatuses()[k]) {
return false
}
} else {
if !proto.Equal(v, target.GetStatuses()[k]) {
return false
}
}
}
return true
}
// Equal function
func (m *Status) Equal(that interface{}) bool {
if that == nil {
return m == nil
}
target, ok := that.(*Status)
if !ok {
that2, ok := that.(Status)
if ok {
target = &that2
} else {
return false
}
}
if target == nil {
return m == nil
} else if m == nil {
return false
}
if m.GetState() != target.GetState() {
return false
}
if strings.Compare(m.GetReason(), target.GetReason()) != 0 {
return false
}
if strings.Compare(m.GetReportedBy(), target.GetReportedBy()) != 0 {
return false
}
if len(m.GetSubresourceStatuses()) != len(target.GetSubresourceStatuses()) {
return false
}
for k, v := range m.GetSubresourceStatuses() {
if h, ok := interface{}(v).(equality.Equalizer); ok {
if !h.Equal(target.GetSubresourceStatuses()[k]) {
return false
}
} else {
if !proto.Equal(v, target.GetSubresourceStatuses()[k]) {
return false
}
}
}
if h, ok := interface{}(m.GetDetails()).(equality.Equalizer); ok {
if !h.Equal(target.GetDetails()) {
return false
}
} else {
if !proto.Equal(m.GetDetails(), target.GetDetails()) {
return false
}
}
if len(m.GetMessages()) != len(target.GetMessages()) {
return false
}
for idx, v := range m.GetMessages() {
if strings.Compare(v, target.GetMessages()[idx]) != 0 {
return false
}
}
return true
}