dao.go 611 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package dao
  2. import (
  3. "context"
  4. "go-common/app/admin/main/cache/conf"
  5. "go-common/library/database/orm"
  6. bm "go-common/library/net/http/blademaster"
  7. "github.com/jinzhu/gorm"
  8. )
  9. // Dao dao.
  10. type Dao struct {
  11. c *conf.Config
  12. DB *gorm.DB
  13. client *bm.Client
  14. }
  15. // New new a dao and return.
  16. func New(c *conf.Config) (d *Dao) {
  17. d = &Dao{
  18. c: c,
  19. DB: orm.NewMySQL(c.MySQL),
  20. client: bm.NewClient(c.HTTPClient),
  21. }
  22. return
  23. }
  24. // Ping check connection of db , mc.
  25. func (d *Dao) Ping(c context.Context) (err error) {
  26. return
  27. }
  28. // Close close connection of db , mc.
  29. func (d *Dao) Close() {
  30. }