go-common/app/job/main/activity/dao/like/extend.go

23 lines
460 B
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
package like
import (
"context"
"fmt"
"github.com/pkg/errors"
)
var (
_batchUpExtSQL = "INSERT INTO like_extend (`lid`,`like`) VALUES %s ON DUPLICATE KEY UPDATE `like`=values(`like`)"
)
// AddExtend .
func (dao *Dao) AddExtend(c context.Context, query string) (res int64, err error) {
rows, err := dao.db.Exec(c, fmt.Sprintf(_batchUpExtSQL, query))
if err != nil {
err = errors.Wrap(err, " dao.db.Exec()")
return
}
return rows.RowsAffected()
}