lottery.go 623 B

12345678910111213141516171819202122232425262728293031
  1. package income
  2. import (
  3. "context"
  4. )
  5. const (
  6. _getBubbleMetaSQL = "SELECT id,av_id,b_type FROM lottery_av_info WHERE id > ? ORDER BY id LIMIT ?"
  7. )
  8. // GetBubbleMeta get bubble meta
  9. func (d *Dao) GetBubbleMeta(c context.Context, id int64, limit int64) (data map[int64][]int, last int64, err error) {
  10. data = make(map[int64][]int)
  11. rows, err := d.db.Query(c, _getBubbleMetaSQL, id, limit)
  12. if err != nil {
  13. return
  14. }
  15. defer rows.Close()
  16. for rows.Next() {
  17. var (
  18. avID int64
  19. bType int
  20. )
  21. err = rows.Scan(&last, &avID, &bType)
  22. if err != nil {
  23. return
  24. }
  25. data[avID] = append(data[avID], bType)
  26. }
  27. return
  28. }