-
Notifications
You must be signed in to change notification settings - Fork 13
/
schedule.go
295 lines (247 loc) · 7.96 KB
/
schedule.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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
// SPDX-License-Identifier: Apache-2.0
package library
import (
"fmt"
)
// Schedule is the API representation of a schedule for a repo.
//
// swagger:model Schedule
type Schedule struct {
ID *int64 `json:"id,omitempty"`
RepoID *int64 `json:"repo_id,omitempty"`
Active *bool `json:"active,omitempty"`
Name *string `json:"name,omitempty"`
Entry *string `json:"entry,omitempty"`
CreatedAt *int64 `json:"created_at,omitempty"`
CreatedBy *string `json:"created_by,omitempty"`
UpdatedAt *int64 `json:"updated_at,omitempty"`
UpdatedBy *string `json:"updated_by,omitempty"`
ScheduledAt *int64 `json:"scheduled_at,omitempty"`
Branch *string `json:"branch,omitempty"`
}
// GetID returns the ID field from the provided Schedule. If the object is nil,
// or the field within the object is nil, it returns the zero value instead.
func (s *Schedule) GetID() int64 {
// return zero value if Schedule type or ID field is nil
if s == nil || s.ID == nil {
return 0
}
return *s.ID
}
// GetRepoID returns the RepoID field from the provided Schedule. If the object is nil,
// or the field within the object is nil, it returns the zero value instead.
func (s *Schedule) GetRepoID() int64 {
// return zero value if Schedule type or RepoID field is nil
if s == nil || s.RepoID == nil {
return 0
}
return *s.RepoID
}
// GetActive returns the Active field from the provided Schedule. If the object is nil,
// or the field within the object is nil, it returns the zero value instead.
func (s *Schedule) GetActive() bool {
// return zero value if Schedule type or Active field is nil
if s == nil || s.Active == nil {
return false
}
return *s.Active
}
// GetName returns the Name field from the provided Schedule. If the object is nil,
// or the field within the object is nil, it returns the zero value instead.
func (s *Schedule) GetName() string {
// return zero value if Schedule type or Name field is nil
if s == nil || s.Name == nil {
return ""
}
return *s.Name
}
// GetEntry returns the Entry field from the provided Schedule. If the object is nil,
// or the field within the object is nil, it returns the zero value instead.
func (s *Schedule) GetEntry() string {
// return zero value if Schedule type or Entry field is nil
if s == nil || s.Entry == nil {
return ""
}
return *s.Entry
}
// GetCreatedAt returns the CreatedAt field from the provided Schedule. If the object is nil,
// or the field within the object is nil, it returns the zero value instead.
func (s *Schedule) GetCreatedAt() int64 {
// return zero value if Schedule type or CreatedAt field is nil
if s == nil || s.CreatedAt == nil {
return 0
}
return *s.CreatedAt
}
// GetCreatedBy returns the CreatedBy field from the provided Schedule. If the object is nil,
// or the field within the object is nil, it returns the zero value instead.
func (s *Schedule) GetCreatedBy() string {
// return zero value if Schedule type or CreatedBy field is nil
if s == nil || s.CreatedBy == nil {
return ""
}
return *s.CreatedBy
}
// GetUpdatedAt returns the UpdatedAt field from the provided Schedule. If the object is nil,
// or the field within the object is nil, it returns the zero value instead.
func (s *Schedule) GetUpdatedAt() int64 {
// return zero value if Schedule type or UpdatedAt field is nil
if s == nil || s.UpdatedAt == nil {
return 0
}
return *s.UpdatedAt
}
// GetUpdatedBy returns the UpdatedBy field from the provided Schedule. If the object is nil,
// or the field within the object is nil, it returns the zero value instead.
func (s *Schedule) GetUpdatedBy() string {
// return zero value if Schedule type or UpdatedBy field is nil
if s == nil || s.UpdatedBy == nil {
return ""
}
return *s.UpdatedBy
}
// GetScheduledAt returns the ScheduledAt field from the provided Schedule. If the object is nil,
// or the field within the object is nil, it returns the zero value instead.
func (s *Schedule) GetScheduledAt() int64 {
// return zero value if Schedule type or ScheduledAt field is nil
if s == nil || s.ScheduledAt == nil {
return 0
}
return *s.ScheduledAt
}
// GetBranch returns the Branch field from the provided Schedule. If the object is nil,
// or the field within the object is nil, it returns the zero value instead.
func (s *Schedule) GetBranch() string {
// return zero value if Schedule type or ScheduledAt field is nil
if s == nil || s.Branch == nil {
return ""
}
return *s.Branch
}
// SetID sets the ID field in the provided Schedule. If the object is nil,
// it will set nothing and immediately return making this a no-op.
func (s *Schedule) SetID(id int64) {
// return if Schedule type is nil
if s == nil {
return
}
s.ID = &id
}
// SetRepoID sets the RepoID field in the provided Schedule. If the object is nil,
// it will set nothing and immediately return making this a no-op.
func (s *Schedule) SetRepoID(repoID int64) {
// return if Schedule type is nil
if s == nil {
return
}
s.RepoID = &repoID
}
// SetActive sets the Active field in the provided Schedule. If the object is nil,
// it will set nothing and immediately return making this a no-op.
func (s *Schedule) SetActive(active bool) {
// return if Schedule type is nil
if s == nil {
return
}
s.Active = &active
}
// SetName sets the Name field in the provided Schedule. If the object is nil,
// it will set nothing and immediately return making this a no-op.
func (s *Schedule) SetName(name string) {
// return if Schedule type is nil
if s == nil {
return
}
s.Name = &name
}
// SetEntry sets the Entry field in the provided Schedule. If the object is nil,
// it will set nothing and immediately return making this a no-op.
func (s *Schedule) SetEntry(entry string) {
// return if Schedule type is nil
if s == nil {
return
}
s.Entry = &entry
}
// SetCreatedAt sets the CreatedAt field in the provided Schedule. If the object is nil,
// it will set nothing and immediately return making this a no-op.
func (s *Schedule) SetCreatedAt(createdAt int64) {
// return if Schedule type is nil
if s == nil {
return
}
s.CreatedAt = &createdAt
}
// SetCreatedBy sets the CreatedBy field in the provided Schedule. If the object is nil,
// it will set nothing and immediately return making this a no-op.
func (s *Schedule) SetCreatedBy(createdBy string) {
// return if Schedule type is nil
if s == nil {
return
}
s.CreatedBy = &createdBy
}
// SetUpdatedAt sets the UpdatedAt field in the provided Schedule. If the object is nil,
// it will set nothing and immediately return making this a no-op.
func (s *Schedule) SetUpdatedAt(updatedAt int64) {
// return if Schedule type is nil
if s == nil {
return
}
s.UpdatedAt = &updatedAt
}
// SetUpdatedBy sets the UpdatedBy field in the provided Schedule. If the object is nil,
// it will set nothing and immediately return making this a no-op.
func (s *Schedule) SetUpdatedBy(updatedBy string) {
// return if Schedule type is nil
if s == nil {
return
}
s.UpdatedBy = &updatedBy
}
// SetScheduledAt sets the ScheduledAt field in the provided Schedule. If the object is nil,
// it will set nothing and immediately return making this a no-op.
func (s *Schedule) SetScheduledAt(scheduledAt int64) {
// return if Schedule type is nil
if s == nil {
return
}
s.ScheduledAt = &scheduledAt
}
// SetBranch sets the Branch field in the provided Schedule. If the object is nil,
// it will set nothing and immediately return making this a no-op.
func (s *Schedule) SetBranch(branch string) {
// return if Schedule type is nil
if s == nil {
return
}
s.Branch = &branch
}
// String implements the Stringer interface for the Schedule type.
func (s *Schedule) String() string {
return fmt.Sprintf(`{
Active: %t,
CreatedAt: %d,
CreatedBy: %s,
Entry: %s,
ID: %d,
Name: %s,
RepoID: %d,
ScheduledAt: %d,
UpdatedAt: %d,
UpdatedBy: %s,
Branch: %s,
}`,
s.GetActive(),
s.GetCreatedAt(),
s.GetCreatedBy(),
s.GetEntry(),
s.GetID(),
s.GetName(),
s.GetRepoID(),
s.GetScheduledAt(),
s.GetUpdatedAt(),
s.GetUpdatedBy(),
s.GetBranch(),
)
}