archive_biz.go 968 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package archive
  2. import (
  3. "context"
  4. "go-common/app/job/main/videoup/model/archive"
  5. xsql "go-common/library/database/sql"
  6. "go-common/library/log"
  7. )
  8. const (
  9. _arcPOISQL = "SELECT data from archive_biz WHERE aid=? AND type= ?"
  10. _arcVoteSQL = "SELECT data from archive_biz WHERE aid=? AND type=2"
  11. )
  12. // POI get a archive POI by avid.
  13. func (d *Dao) POI(c context.Context, aid int64) (data []byte, err error) {
  14. var (
  15. row = d.db.QueryRow(c, _arcPOISQL, aid, archive.BIZPOI)
  16. )
  17. if err = row.Scan(&data); err != nil {
  18. if err == xsql.ErrNoRows {
  19. err = nil
  20. } else {
  21. log.Error("row.Scan error(%v)", err)
  22. }
  23. return
  24. }
  25. return
  26. }
  27. // Vote get a archive Vote by avid.
  28. func (d *Dao) Vote(c context.Context, aid int64) (data []byte, err error) {
  29. var (
  30. row = d.db.QueryRow(c, _arcVoteSQL, aid)
  31. )
  32. if err = row.Scan(&data); err != nil {
  33. if err == xsql.ErrNoRows {
  34. err = nil
  35. } else {
  36. log.Error("row.Scan error(%v)", err)
  37. }
  38. return
  39. }
  40. return
  41. }