// update the CloseJira status into the database
Problem Statement - Golang how and where to call autogeneratedjiraclose() function to run some operation if rollback trigger.
func CloseJira(qMonName string) {
tx, err := dbCon.Begin()
notifier.CheckErr(err, "CloseJira() -> tx -> dbCon.Begin()", dbErrLog)
defer tx.Rollback()
stmt, errDBPrepare := tx.Prepare("update TABLE1 set
Key=NULL, StatusKey='Closed', Statustime_UTC=? where Name=?")
//Update db table record
notifier.CheckErr(errDBPrepare, "updateCloseJira() -> dbCon.Prepare()",
dbErrLog)
defer stmt.Close() // danger!
res, errStmtExec := stmt.Exec(time.Now().UTC(), qMonName)
notifier.CheckErr(errStmtExec, "CloseJira() -> stmt.Exec()", dbErrLog)
err = tx.Commit()
notifier.CheckErr(err, "CloseJira() -> err -> tx.Commit()", dbErrLog)
_, errRowAffected := res.RowsAffected()
notifier.CheckErr(errRowAffected, "CloseJira() -> res.RowsAffected()",
dbErrLog)
}