dao.go 478 B

1234567891011121314151617181920212223242526272829
  1. package dao
  2. import (
  3. "go-common/app/job/main/identify/conf"
  4. "go-common/library/cache/memcache"
  5. xsql "go-common/library/database/sql"
  6. )
  7. // Dao dao
  8. type Dao struct {
  9. c *conf.Config
  10. authDB *xsql.DB
  11. authMC *memcache.Pool
  12. }
  13. // New init mysql db
  14. func New(c *conf.Config) (dao *Dao) {
  15. dao = &Dao{
  16. c: c,
  17. authDB: xsql.NewMySQL(c.AuthDB),
  18. authMC: memcache.NewPool(c.AuthMC),
  19. }
  20. return
  21. }
  22. // Close close the resource.
  23. func (d *Dao) Close() {
  24. d.authDB.Close()
  25. }