-
Notifications
You must be signed in to change notification settings - Fork 3
/
pb.objs.go
148 lines (138 loc) · 2.16 KB
/
pb.objs.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
// Code generated by github.com/hooto/protobuf_slice
// DO NOT EDIT!
package inapi
import "bytes"
func PbBytesSliceEqual(ls, ls2 []byte) bool {
if len(ls) != len(ls2) {
return false
}
return bytes.Compare(ls, ls2) == 0
}
func PbArrayBytesSliceEqual(ls, ls2 [][]byte) bool {
if len(ls) != len(ls2) {
return false
}
for i, v := range ls {
if !PbBytesSliceEqual(v, ls2[i]) {
return false
}
}
return true
}
func PbStringSliceEqual(ls, ls2 []string) bool {
if len(ls) != len(ls2) {
return false
}
for _, v := range ls {
hit := false
for _, v2 := range ls2 {
if v == v2 {
hit = true
break
}
}
if !hit {
return false
}
}
return true
}
func PbStringSliceSyncSlice(ls, ls2 []string) ([]string, bool) {
if len(ls2) == 0 {
return ls, false
}
hit := false
changed := false
for _, v2 := range ls2 {
hit = false
for _, v := range ls {
if v == v2 {
hit = true
break
}
}
if !hit {
ls = append(ls, v2)
changed = true
}
}
return ls, changed
}
func PbInt32SliceEqual(ls, ls2 []int32) bool {
if len(ls) != len(ls2) {
return false
}
for _, v := range ls {
hit := false
for _, v2 := range ls2 {
if v == v2 {
hit = true
break
}
}
if !hit {
return false
}
}
return true
}
func PbInt32SliceSyncSlice(ls, ls2 []int32) ([]int32, bool) {
if len(ls2) == 0 {
return ls, false
}
hit := false
changed := false
for _, v2 := range ls2 {
hit = false
for _, v := range ls {
if v == v2 {
hit = true
break
}
}
if !hit {
ls = append(ls, v2)
changed = true
}
}
return ls, changed
}
func PbUint32SliceEqual(ls, ls2 []uint32) bool {
if len(ls) != len(ls2) {
return false
}
for _, v := range ls {
hit := false
for _, v2 := range ls2 {
if v == v2 {
hit = true
break
}
}
if !hit {
return false
}
}
return true
}
func PbUint32SliceSyncSlice(ls, ls2 []uint32) ([]uint32, bool) {
if len(ls2) == 0 {
return ls, false
}
hit := false
changed := false
for _, v2 := range ls2 {
hit = false
for _, v := range ls {
if v == v2 {
hit = true
break
}
}
if !hit {
ls = append(ls, v2)
changed = true
}
}
return ls, changed
}