dao.go 462 B

123456789101112131415161718192021222324252627282930313233
  1. package dao
  2. import (
  3. "context"
  4. "go-common/app/service/live/xuserex/conf"
  5. "go-common/library/cache/memcache"
  6. )
  7. // Dao dao
  8. type Dao struct {
  9. c *conf.Config
  10. mc *memcache.Pool
  11. }
  12. // New init mysql db
  13. func New(c *conf.Config) (dao *Dao) {
  14. dao = &Dao{
  15. c: c,
  16. mc: memcache.NewPool(c.Memcache),
  17. }
  18. return
  19. }
  20. // Close close the resource.
  21. func (d *Dao) Close() {
  22. d.mc.Close()
  23. }
  24. // Ping dao ping
  25. func (d *Dao) Ping(c context.Context) error {
  26. return nil
  27. }