package service import ( "context" "fmt" "git.loafle.net/commons/logging-go" crc "git.loafle.net/commons/rpc-go/client" ) type RPCClientService struct { client *crc.Client } func (s *RPCClientService) InitService() error { return nil } func (s *RPCClientService) StartService() error { return nil } func (s *RPCClientService) StopService() { if err := s.client.Stop(context.Background()); nil != err { logging.Logger().Error(err) } } func (s *RPCClientService) DestroyService() { s.client = nil } func (s *RPCClientService) Call(result interface{}, method string, params ...interface{}) error { if nil == s.client { return fmt.Errorf("rpc client is not valid") } return s.client.Call(result, method, params...) } func (s *RPCClientService) Send(method string, params ...interface{}) error { if nil == s.client { return fmt.Errorf("rpc client is not valid") } return s.client.Send(method, params...) }