go-common/app/job/main/up-rating/dao/task_status.go

24 lines
496 B
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
package dao
import (
"context"
"fmt"
)
const (
// insert
_inTaskStatusSQL = "INSERT INTO task_status(type, status, date, message) VALUES %s ON DUPLICATE KEY UPDATE status=VALUES(status), message=VALUES(message)"
)
// InsertTaskStatus insert task status
func (d *Dao) InsertTaskStatus(c context.Context, val string) (rows int64, err error) {
if val == "" {
return
}
res, err := d.db.Exec(c, fmt.Sprintf(_inTaskStatusSQL, val))
if err != nil {
return
}
return res.RowsAffected()
}