dao.go 490 B

123456789101112131415161718192021222324
  1. package pub
  2. import (
  3. "go-common/app/job/main/favorite/conf"
  4. "go-common/library/queue/databus"
  5. )
  6. // Dao stat dao.
  7. type Dao struct {
  8. databus2 *databus.Databus
  9. consumersMap map[int8]string
  10. }
  11. // New new a stat dao and return.
  12. func New(c *conf.Config) *Dao {
  13. consumersMap := make(map[int8]string)
  14. for name, typ := range c.StatFavDatabus.Consumers {
  15. consumersMap[typ] = name
  16. }
  17. return &Dao{
  18. databus2: databus.New(c.StatFavDatabus.Config),
  19. consumersMap: consumersMap,
  20. }
  21. }