dao.go 599 B

1234567891011121314151617181920212223242526272829303132
  1. package dao
  2. import (
  3. "context"
  4. "go-common/app/job/main/stat/conf"
  5. xsql "go-common/library/database/sql"
  6. bm "go-common/library/net/http/blademaster"
  7. )
  8. // Dao is stat job dao.
  9. type Dao struct {
  10. c *conf.Config
  11. smsClient *bm.Client
  12. db *xsql.DB
  13. clickDB *xsql.DB
  14. }
  15. // New add a feed job dao.
  16. func New(c *conf.Config) *Dao {
  17. return &Dao{
  18. c: c,
  19. smsClient: bm.NewClient(c.HTTPClient),
  20. db: xsql.NewMySQL(c.DB),
  21. clickDB: xsql.NewMySQL(c.ClickDB),
  22. }
  23. }
  24. // Ping ping health of db.
  25. func (d *Dao) Ping(c context.Context) (err error) {
  26. return d.db.Ping(c)
  27. }