-
Notifications
You must be signed in to change notification settings - Fork 302
/
applicationserver_integrations_alcsync.pb.setters.fm.go
189 lines (178 loc) · 5.24 KB
/
applicationserver_integrations_alcsync.pb.setters.fm.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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
// Code generated by protoc-gen-fieldmask. DO NOT EDIT.
package ttnpb
import fmt "fmt"
func (dst *ALCSyncCommand) SetFields(src *ALCSyncCommand, paths ...string) error {
for name, subs := range _processPaths(paths) {
switch name {
case "cid":
if len(subs) > 0 {
return fmt.Errorf("'cid' has no subfields, but %s were specified", subs)
}
if src != nil {
dst.Cid = src.Cid
} else {
dst.Cid = 0
}
case "payload":
if len(subs) == 0 && src == nil {
dst.Payload = nil
continue
} else if len(subs) == 0 {
dst.Payload = src.Payload
continue
}
subPathMap := _processPaths(subs)
if len(subPathMap) > 1 {
return fmt.Errorf("more than one field specified for oneof field '%s'", name)
}
for oneofName, oneofSubs := range subPathMap {
switch oneofName {
case "app_time_req":
var srcTypeOk bool
if src != nil {
_, srcTypeOk = src.Payload.(*ALCSyncCommand_AppTimeReq_)
}
if srcValid := srcTypeOk || src == nil || src.Payload == nil || len(oneofSubs) == 0; !srcValid {
return fmt.Errorf("attempt to set oneof 'app_time_req', while different oneof is set in source")
}
_, dstTypeOk := dst.Payload.(*ALCSyncCommand_AppTimeReq_)
if dstValid := dstTypeOk || dst.Payload == nil || len(oneofSubs) == 0; !dstValid {
return fmt.Errorf("attempt to set oneof 'app_time_req', while different oneof is set in destination")
}
if len(oneofSubs) > 0 {
var newDst, newSrc *ALCSyncCommand_AppTimeReq
if srcTypeOk {
newSrc = src.Payload.(*ALCSyncCommand_AppTimeReq_).AppTimeReq
}
if dstTypeOk {
newDst = dst.Payload.(*ALCSyncCommand_AppTimeReq_).AppTimeReq
} else if srcTypeOk {
newDst = &ALCSyncCommand_AppTimeReq{}
dst.Payload = &ALCSyncCommand_AppTimeReq_{AppTimeReq: newDst}
} else {
dst.Payload = nil
continue
}
if err := newDst.SetFields(newSrc, oneofSubs...); err != nil {
return err
}
} else {
if srcTypeOk {
dst.Payload = src.Payload
} else {
dst.Payload = nil
}
}
case "app_time_ans":
var srcTypeOk bool
if src != nil {
_, srcTypeOk = src.Payload.(*ALCSyncCommand_AppTimeAns_)
}
if srcValid := srcTypeOk || src == nil || src.Payload == nil || len(oneofSubs) == 0; !srcValid {
return fmt.Errorf("attempt to set oneof 'app_time_ans', while different oneof is set in source")
}
_, dstTypeOk := dst.Payload.(*ALCSyncCommand_AppTimeAns_)
if dstValid := dstTypeOk || dst.Payload == nil || len(oneofSubs) == 0; !dstValid {
return fmt.Errorf("attempt to set oneof 'app_time_ans', while different oneof is set in destination")
}
if len(oneofSubs) > 0 {
var newDst, newSrc *ALCSyncCommand_AppTimeAns
if srcTypeOk {
newSrc = src.Payload.(*ALCSyncCommand_AppTimeAns_).AppTimeAns
}
if dstTypeOk {
newDst = dst.Payload.(*ALCSyncCommand_AppTimeAns_).AppTimeAns
} else if srcTypeOk {
newDst = &ALCSyncCommand_AppTimeAns{}
dst.Payload = &ALCSyncCommand_AppTimeAns_{AppTimeAns: newDst}
} else {
dst.Payload = nil
continue
}
if err := newDst.SetFields(newSrc, oneofSubs...); err != nil {
return err
}
} else {
if srcTypeOk {
dst.Payload = src.Payload
} else {
dst.Payload = nil
}
}
default:
return fmt.Errorf("invalid oneof field: '%s.%s'", name, oneofName)
}
}
default:
return fmt.Errorf("invalid field: '%s'", name)
}
}
return nil
}
func (dst *ALCSyncCommand_AppTimeReq) SetFields(src *ALCSyncCommand_AppTimeReq, paths ...string) error {
for name, subs := range _processPaths(paths) {
switch name {
case "DeviceTime":
if len(subs) > 0 {
return fmt.Errorf("'DeviceTime' has no subfields, but %s were specified", subs)
}
if src != nil {
dst.DeviceTime = src.DeviceTime
} else {
dst.DeviceTime = nil
}
case "TokenReq":
if len(subs) > 0 {
return fmt.Errorf("'TokenReq' has no subfields, but %s were specified", subs)
}
if src != nil {
dst.TokenReq = src.TokenReq
} else {
var zero uint32
dst.TokenReq = zero
}
case "AnsRequired":
if len(subs) > 0 {
return fmt.Errorf("'AnsRequired' has no subfields, but %s were specified", subs)
}
if src != nil {
dst.AnsRequired = src.AnsRequired
} else {
var zero bool
dst.AnsRequired = zero
}
default:
return fmt.Errorf("invalid field: '%s'", name)
}
}
return nil
}
func (dst *ALCSyncCommand_AppTimeAns) SetFields(src *ALCSyncCommand_AppTimeAns, paths ...string) error {
for name, subs := range _processPaths(paths) {
switch name {
case "TimeCorrection":
if len(subs) > 0 {
return fmt.Errorf("'TimeCorrection' has no subfields, but %s were specified", subs)
}
if src != nil {
dst.TimeCorrection = src.TimeCorrection
} else {
var zero int32
dst.TimeCorrection = zero
}
case "TokenAns":
if len(subs) > 0 {
return fmt.Errorf("'TokenAns' has no subfields, but %s were specified", subs)
}
if src != nil {
dst.TokenAns = src.TokenAns
} else {
var zero uint32
dst.TokenAns = zero
}
default:
return fmt.Errorf("invalid field: '%s'", name)
}
}
return nil
}