go-common/app/job/main/up-rating/dao/task_status.go
2019-04-22 18:49:16 +08:00

24 lines
496 B
Go

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()
}