gotsrpc/example/nullable/service/gorpcclient_gen.go
2022-02-17 14:22:15 +01:00

120 lines
3.2 KiB
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) VariantA(i1 Base) (r1 Base, clientErr error) {
req := ServiceVariantARequest{I1: i1}
rpcCallRes, rpcCallErr := tsc.Client.Call(req)
if rpcCallErr != nil {
clientErr = rpcCallErr
return
}
response := rpcCallRes.(ServiceVariantAResponse)
return response.R1, nil
}
func (tsc *ServiceGoRPCClient) VariantB(i1 BCustomType) (r1 BCustomType, clientErr error) {
req := ServiceVariantBRequest{I1: i1}
rpcCallRes, rpcCallErr := tsc.Client.Call(req)
if rpcCallErr != nil {
clientErr = rpcCallErr
return
}
response := rpcCallRes.(ServiceVariantBResponse)
return response.R1, nil
}
func (tsc *ServiceGoRPCClient) VariantC(i1 BCustomTypes) (r1 BCustomTypes, clientErr error) {
req := ServiceVariantCRequest{I1: i1}
rpcCallRes, rpcCallErr := tsc.Client.Call(req)
if rpcCallErr != nil {
clientErr = rpcCallErr
return
}
response := rpcCallRes.(ServiceVariantCResponse)
return response.R1, nil
}
func (tsc *ServiceGoRPCClient) VariantD(i1 BCustomTypesMap) (r1 BCustomTypesMap, clientErr error) {
req := ServiceVariantDRequest{I1: i1}
rpcCallRes, rpcCallErr := tsc.Client.Call(req)
if rpcCallErr != nil {
clientErr = rpcCallErr
return
}
response := rpcCallRes.(ServiceVariantDResponse)
return response.R1, nil
}
func (tsc *ServiceGoRPCClient) VariantE(i1 *Base) (r1 *Base, clientErr error) {
req := ServiceVariantERequest{I1: i1}
rpcCallRes, rpcCallErr := tsc.Client.Call(req)
if rpcCallErr != nil {
clientErr = rpcCallErr
return
}
response := rpcCallRes.(ServiceVariantEResponse)
return response.R1, nil
}
func (tsc *ServiceGoRPCClient) VariantF(i1 []*Base) (r1 []*Base, clientErr error) {
req := ServiceVariantFRequest{I1: i1}
rpcCallRes, rpcCallErr := tsc.Client.Call(req)
if rpcCallErr != nil {
clientErr = rpcCallErr
return
}
response := rpcCallRes.(ServiceVariantFResponse)
return response.R1, nil
}
func (tsc *ServiceGoRPCClient) VariantG(i1 map[string]*Base) (r1 map[string]*Base, clientErr error) {
req := ServiceVariantGRequest{I1: i1}
rpcCallRes, rpcCallErr := tsc.Client.Call(req)
if rpcCallErr != nil {
clientErr = rpcCallErr
return
}
response := rpcCallRes.(ServiceVariantGResponse)
return response.R1, nil
}
func (tsc *ServiceGoRPCClient) VariantH(i1 Base, i2 *Base, i3 []*Base, i4 map[string]Base) (r1 Base, r2 *Base, r3 []*Base, r4 map[string]Base, clientErr error) {
req := ServiceVariantHRequest{I1: i1, I2: i2, I3: i3, I4: i4}
rpcCallRes, rpcCallErr := tsc.Client.Call(req)
if rpcCallErr != nil {
clientErr = rpcCallErr
return
}
response := rpcCallRes.(ServiceVariantHResponse)
return response.R1, response.R2, response.R3, response.R4, nil
}