go-common/app/admin/main/answer/service/service.go

33 lines
566 B
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
package service
import (
"context"
"go-common/app/admin/main/answer/conf"
"go-common/app/admin/main/answer/dao"
"go-common/library/cache"
)
// Service struct of service.
type Service struct {
c *conf.Config
dao *dao.Dao
eventChan *cache.Cache
}
// New create service instance and return.
func New(c *conf.Config) (s *Service) {
s = &Service{
c: c,
dao: dao.New(c),
eventChan: cache.New(1, 10240),
}
s.generate(context.Background(), x, 0, len(x)-1)
return
}
// Close dao.
func (s *Service) Close() {
s.dao.Close()
}