addit.go 736 B

12345678910111213141516171819202122232425262728
  1. package archive
  2. import (
  3. "context"
  4. "go-common/app/job/main/videoup/model/archive"
  5. "go-common/library/database/sql"
  6. "go-common/library/log"
  7. )
  8. const (
  9. _additSQL = "SELECT id,aid,source,redirect_url,mission_id,up_from,order_id,dynamic FROM archive_addit WHERE aid=?"
  10. )
  11. // Addit get archive addit.
  12. func (d *Dao) Addit(c context.Context, aid int64) (addit *archive.Addit, err error) {
  13. row := d.db.QueryRow(c, _additSQL, aid)
  14. addit = &archive.Addit{}
  15. if err = row.Scan(&addit.ID, &addit.Aid, &addit.Source, &addit.RedirectURL, &addit.MissionID, &addit.UpFrom, &addit.OrderID, &addit.Dynamic); err != nil {
  16. if err == sql.ErrNoRows {
  17. addit = nil
  18. err = nil
  19. } else {
  20. log.Error("row.Scan error(%v)", err)
  21. }
  22. }
  23. return
  24. }