@@ -26,19 +26,10 @@ import (
26
26
type WorkflowStatusLatestRepository interface {
27
27
// CI Workflow Status Latest methods
28
28
SaveCiWorkflowStatusLatest (tx * pg.Tx , model * CiWorkflowStatusLatest ) error
29
- UpdateCiWorkflowStatusLatest (tx * pg.Tx , model * CiWorkflowStatusLatest ) error
30
- GetCiWorkflowStatusLatestByPipelineId (pipelineId int ) (* CiWorkflowStatusLatest , error )
31
- GetCiWorkflowStatusLatestByAppId (appId int ) ([]* CiWorkflowStatusLatest , error )
32
29
GetCiWorkflowStatusLatestByPipelineIds (pipelineIds []int ) ([]* CiWorkflowStatusLatest , error )
33
- DeleteCiWorkflowStatusLatestByPipelineId (pipelineId int ) error
34
30
35
31
// CD Workflow Status Latest methods
36
32
SaveCdWorkflowStatusLatest (tx * pg.Tx , model * CdWorkflowStatusLatest ) error
37
- UpdateCdWorkflowStatusLatest (tx * pg.Tx , model * CdWorkflowStatusLatest ) error
38
- GetCdWorkflowStatusLatestByPipelineIdAndWorkflowType (tx * pg.Tx , pipelineId int , workflowType string ) (* CdWorkflowStatusLatest , error )
39
- GetCdWorkflowStatusLatestByAppId (appId int ) ([]* CdWorkflowStatusLatest , error )
40
- GetCdWorkflowStatusLatestByPipelineId (pipelineId int ) ([]* CdWorkflowStatusLatest , error )
41
- DeleteCdWorkflowStatusLatestByPipelineId (pipelineId int ) error
42
33
GetCdWorkflowStatusLatestByPipelineIds (pipelineIds []int ) ([]* CdWorkflowStatusLatest , error )
43
34
}
44
35
@@ -92,56 +83,6 @@ func (impl *WorkflowStatusLatestRepositoryImpl) SaveCiWorkflowStatusLatest(tx *p
92
83
return nil
93
84
}
94
85
95
- func (impl * WorkflowStatusLatestRepositoryImpl ) UpdateCiWorkflowStatusLatest (tx * pg.Tx , model * CiWorkflowStatusLatest ) error {
96
- var connection orm.DB
97
- if tx != nil {
98
- connection = tx
99
- } else {
100
- connection = impl .dbConnection
101
- }
102
- _ , err := connection .Model (model ).WherePK ().UpdateNotNull ()
103
- if err != nil {
104
- impl .logger .Errorw ("error in updating ci workflow status latest" , "err" , err , "model" , model )
105
- return err
106
- }
107
- return nil
108
- }
109
-
110
- func (impl * WorkflowStatusLatestRepositoryImpl ) GetCiWorkflowStatusLatestByPipelineId (pipelineId int ) (* CiWorkflowStatusLatest , error ) {
111
- model := & CiWorkflowStatusLatest {}
112
- err := impl .dbConnection .Model (model ).
113
- Where ("pipeline_id = ?" , pipelineId ).
114
- Select ()
115
- if err != nil {
116
- impl .logger .Errorw ("error in getting ci workflow status latest by pipeline id" , "err" , err , "pipelineId" , pipelineId )
117
- return nil , err
118
- }
119
- return model , nil
120
- }
121
-
122
- func (impl * WorkflowStatusLatestRepositoryImpl ) GetCiWorkflowStatusLatestByAppId (appId int ) ([]* CiWorkflowStatusLatest , error ) {
123
- var models []* CiWorkflowStatusLatest
124
- err := impl .dbConnection .Model (& models ).
125
- Where ("app_id = ?" , appId ).
126
- Select ()
127
- if err != nil {
128
- impl .logger .Errorw ("error in getting ci workflow status latest by app id" , "err" , err , "appId" , appId )
129
- return nil , err
130
- }
131
- return models , nil
132
- }
133
-
134
- func (impl * WorkflowStatusLatestRepositoryImpl ) DeleteCiWorkflowStatusLatestByPipelineId (pipelineId int ) error {
135
- _ , err := impl .dbConnection .Model (& CiWorkflowStatusLatest {}).
136
- Where ("pipeline_id = ?" , pipelineId ).
137
- Delete ()
138
- if err != nil {
139
- impl .logger .Errorw ("error in deleting ci workflow status latest by pipeline id" , "err" , err , "pipelineId" , pipelineId )
140
- return err
141
- }
142
- return nil
143
- }
144
-
145
86
func (impl * WorkflowStatusLatestRepositoryImpl ) GetCiWorkflowStatusLatestByPipelineIds (pipelineIds []int ) ([]* CiWorkflowStatusLatest , error ) {
146
87
if len (pipelineIds ) == 0 {
147
88
return []* CiWorkflowStatusLatest {}, nil
@@ -174,75 +115,6 @@ func (impl *WorkflowStatusLatestRepositoryImpl) SaveCdWorkflowStatusLatest(tx *p
174
115
return nil
175
116
}
176
117
177
- func (impl * WorkflowStatusLatestRepositoryImpl ) UpdateCdWorkflowStatusLatest (tx * pg.Tx , model * CdWorkflowStatusLatest ) error {
178
- var connection orm.DB
179
- if tx != nil {
180
- connection = tx
181
- } else {
182
- connection = impl .dbConnection
183
- }
184
- _ , err := connection .Model (model ).WherePK ().UpdateNotNull ()
185
- if err != nil {
186
- impl .logger .Errorw ("error in updating cd workflow status latest" , "err" , err , "model" , model )
187
- return err
188
- }
189
- return nil
190
- }
191
-
192
- func (impl * WorkflowStatusLatestRepositoryImpl ) GetCdWorkflowStatusLatestByPipelineIdAndWorkflowType (tx * pg.Tx , pipelineId int , workflowType string ) (* CdWorkflowStatusLatest , error ) {
193
- model := & CdWorkflowStatusLatest {}
194
- var connection orm.DB
195
- if tx != nil {
196
- connection = tx
197
- } else {
198
- connection = impl .dbConnection
199
- }
200
- err := connection .Model (model ).
201
- Where ("pipeline_id = ?" , pipelineId ).
202
- Where ("workflow_type = ?" , workflowType ).
203
- Select ()
204
- if err != nil {
205
- impl .logger .Errorw ("error in getting cd workflow status latest by pipeline id and workflow type" , "err" , err , "pipelineId" , pipelineId , "workflowType" , workflowType )
206
- return nil , err
207
- }
208
- return model , nil
209
- }
210
-
211
- func (impl * WorkflowStatusLatestRepositoryImpl ) GetCdWorkflowStatusLatestByAppId (appId int ) ([]* CdWorkflowStatusLatest , error ) {
212
- var models []* CdWorkflowStatusLatest
213
- err := impl .dbConnection .Model (& models ).
214
- Where ("app_id = ?" , appId ).
215
- Select ()
216
- if err != nil {
217
- impl .logger .Errorw ("error in getting cd workflow status latest by app id" , "err" , err , "appId" , appId )
218
- return nil , err
219
- }
220
- return models , nil
221
- }
222
-
223
- func (impl * WorkflowStatusLatestRepositoryImpl ) GetCdWorkflowStatusLatestByPipelineId (pipelineId int ) ([]* CdWorkflowStatusLatest , error ) {
224
- var models []* CdWorkflowStatusLatest
225
- err := impl .dbConnection .Model (& models ).
226
- Where ("pipeline_id = ?" , pipelineId ).
227
- Select ()
228
- if err != nil {
229
- impl .logger .Errorw ("error in getting cd workflow status latest by pipeline id" , "err" , err , "pipelineId" , pipelineId )
230
- return nil , err
231
- }
232
- return models , nil
233
- }
234
-
235
- func (impl * WorkflowStatusLatestRepositoryImpl ) DeleteCdWorkflowStatusLatestByPipelineId (pipelineId int ) error {
236
- _ , err := impl .dbConnection .Model (& CdWorkflowStatusLatest {}).
237
- Where ("pipeline_id = ?" , pipelineId ).
238
- Delete ()
239
- if err != nil {
240
- impl .logger .Errorw ("error in deleting cd workflow status latest by pipeline id" , "err" , err , "pipelineId" , pipelineId )
241
- return err
242
- }
243
- return nil
244
- }
245
-
246
118
func (impl * WorkflowStatusLatestRepositoryImpl ) GetCdWorkflowStatusLatestByPipelineIds (pipelineIds []int ) ([]* CdWorkflowStatusLatest , error ) {
247
119
var models []* CdWorkflowStatusLatest
248
120
err := impl .dbConnection .Model (& models ).
0 commit comments