Add rollback if GetTicInTx fails and move GetTicInTx to shared/repository.go

This commit is contained in:
yaoandrew
2019-01-11 10:07:00 -08:00
parent c8aa3dc275
commit e2b864baa8
4 changed files with 20 additions and 13 deletions
+4
View File
@@ -34,6 +34,10 @@ func (repository DentRepository) Create(headerID int64, models []interface{}) er
tic, getTicErr := shared.GetTicInTx(headerID, tx)
if getTicErr != nil {
rollbackErr := tx.Rollback()
if rollbackErr != nil {
log.Error("failed to rollback ", rollbackErr)
}
return getTicErr
}