package notificationservice import ( "sync" "bitbucket.org/nemt/nemt-portal-api/application/entitymapping" "bitbucket.org/nemt/nemt-portal-api/domain/contract" "bitbucket.org/nemt/nemt-portal-api/domain/service" "bitbucket.org/nemt/nemt-portal-api/infra/config" ) var ( instance *Service once sync.Once ) // Service holds the domain service repositories type Service struct { Twilio *twilioService } // New returns a new domain Service instance func New(svc *service.Service, mapper *entitymapping.Mapper, cfg *config.Config, cache contract.CacheManager) *Service { once.Do(func() { instance = &Service{ Twilio: newTwilioService(svc, mapper, cfg, cache), } }) return instance }