package service import ( "context" "reflect" cda "git.loafle.net/commons/di-go/annotation" cdr "git.loafle.net/commons/di-go/registry" logging "git.loafle.net/commons/logging-go" crc "git.loafle.net/commons/rpc-go/client" // For annotation _ "git.loafle.net/overflow/commons-go/core/annotation" ) var GeneralClientServiceType = reflect.TypeOf((*GeneralClientService)(nil)) func init() { cdr.RegisterType(GeneralClientServiceType) } type GeneralClientService struct { cda.TypeAnnotation `annotation:"@overflow:RPCService()"` EncryptionKey string client *crc.Client } func (s *GeneralClientService) InitService() error { return nil } func (s *GeneralClientService) StartService() error { return nil } func (s *GeneralClientService) StopService() { if nil != s.client { if err := s.client.Stop(context.Background()); nil != err { logging.Logger().Error(err) } } } func (s *GeneralClientService) DestroyService() { s.client = nil }