dao.go 786 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package dao
  2. import (
  3. "context"
  4. "go-common/app/interface/main/push/conf"
  5. "go-common/library/queue/databus"
  6. "go-common/library/stat/prom"
  7. )
  8. // Dao .
  9. type Dao struct {
  10. c *conf.Config
  11. reportPub *databus.Databus
  12. callbackPub *databus.Databus
  13. }
  14. // New creates a push-service DAO instance.
  15. func New(c *conf.Config) *Dao {
  16. d := &Dao{
  17. c: c,
  18. reportPub: databus.New(c.ReportPub),
  19. callbackPub: databus.New(c.CallbackPub),
  20. }
  21. return d
  22. }
  23. // PromError prom error
  24. func PromError(name string) {
  25. prom.BusinessErrCount.Incr(name)
  26. }
  27. // PromInfo add prom info
  28. func PromInfo(name string) {
  29. prom.BusinessInfoCount.Incr(name)
  30. }
  31. // Close dao.
  32. func (d *Dao) Close() {}
  33. // Ping check connection status.
  34. func (d *Dao) Ping(c context.Context) (err error) {
  35. return
  36. }