You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
496 B
23 lines
496 B
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() |
|
}
|
|
|