dao.go 597 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package dao
  2. import (
  3. "context"
  4. "go-common/app/interface/main/spread/conf"
  5. bm "go-common/library/net/http/blademaster"
  6. "go-common/library/stat/prom"
  7. )
  8. // Dao dao
  9. type Dao struct {
  10. c *conf.Config
  11. httpClient *bm.Client
  12. }
  13. // New init mysql db
  14. func New(c *conf.Config) (dao *Dao) {
  15. dao = &Dao{
  16. c: c,
  17. httpClient: bm.NewClient(c.HTTPClient),
  18. }
  19. return
  20. }
  21. // Close close the resource.
  22. func (d *Dao) Close() {
  23. }
  24. // Ping dao ping
  25. func (d *Dao) Ping(c context.Context) error {
  26. return nil
  27. }
  28. // PromError .
  29. func PromError(name string) {
  30. prom.BusinessErrCount.Incr(name)
  31. }