task_log.go 645 B

123456789101112131415161718192021222324
  1. package dao
  2. import (
  3. "context"
  4. "github.com/pkg/errors"
  5. xsql "go-common/library/database/sql"
  6. )
  7. const (
  8. _addTaskLogSql = "INSERT INTO task_log (task_id, mid, build, platform, task_state, reason) VALUES ( ?, ?, ?, ?, ?, ? )"
  9. )
  10. func (d *Dao) TxAddTaskLog(c context.Context, tx *xsql.Tx, taskID int64, mid int64, build string, platform int, taskState int, reason string) (insertID int64, err error) {
  11. res, err := tx.Exec(_addTaskLogSql, taskID, mid, build, platform, taskState, reason)
  12. if err != nil {
  13. err = errors.WithStack(err)
  14. return
  15. }
  16. if insertID, err = res.LastInsertId(); err == nil {
  17. insertID = int64(insertID)
  18. }
  19. return
  20. }