File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -216,22 +216,23 @@ func (repositoryImpl ChartRepositoryImpl) FindPreviousChartByAppId(appId int) (c
216
216
}
217
217
218
218
func (repositoryImpl ChartRepositoryImpl ) Save (tx * pg.Tx , chart * Chart ) error {
219
+ var connection orm.DB
220
+ connection = tx
219
221
if tx == nil {
220
- return repositoryImpl .dbConnection .Insert (chart )
221
- } else {
222
- _ , err := tx .Model (& chart ).Insert ()
223
- return err
222
+ connection = repositoryImpl .dbConnection
224
223
}
224
+ _ , err := connection .Model (& chart ).Insert ()
225
+ return err
226
+
225
227
}
226
228
227
229
func (repositoryImpl ChartRepositoryImpl ) Update (tx * pg.Tx , chart * Chart ) error {
228
- var query * orm.Query
230
+ var connection orm.DB
231
+ connection = tx
229
232
if tx == nil {
230
- query = tx .Model (chart )
231
- } else {
232
- query = repositoryImpl .dbConnection .Model (chart )
233
+ connection = repositoryImpl .dbConnection
233
234
}
234
- _ , err := query .WherePK ().UpdateNotNull ()
235
+ _ , err := connection . Model ( chart ) .WherePK ().UpdateNotNull ()
235
236
return err
236
237
}
237
238
You can’t perform that action at this time.
0 commit comments