gotsrpc/example/monitor/service/gorpcclient_gen.go
Kevin Franklin Kim 7faf7e4c98 feat: add monitor
2022-05-04 11:16:04 +02:00

43 lines
928 B
Go

// Code generated by gotsrpc https://github.com/foomo/gotsrpc/v2 - DO NOT EDIT.
package service
import (
tls "crypto/tls"
gorpc "github.com/valyala/gorpc"
)
type ServiceGoRPCClient struct {
Client *gorpc.Client
}
func NewServiceGoRPCClient(addr string, tlsConfig *tls.Config) *ServiceGoRPCClient {
client := &ServiceGoRPCClient{}
if tlsConfig == nil {
client.Client = gorpc.NewTCPClient(addr)
} else {
client.Client = gorpc.NewTLSClient(addr, tlsConfig)
}
return client
}
func (tsc *ServiceGoRPCClient) Start() {
tsc.Client.Start()
}
func (tsc *ServiceGoRPCClient) Stop() {
tsc.Client.Stop()
}
func (tsc *ServiceGoRPCClient) Hello(v string) (retHello_0 string, clientErr error) {
req := ServiceHelloRequest{V: v}
rpcCallRes, rpcCallErr := tsc.Client.Call(req)
if rpcCallErr != nil {
clientErr = rpcCallErr
return
}
response := rpcCallRes.(ServiceHelloResponse)
return response.RetHello_0, nil
}