mirror of
https://github.com/foomo/gotsrpc.git
synced 2025-10-16 12:35:35 +00:00
140 lines
4.1 KiB
Go
140 lines
4.1 KiB
Go
// this file was auto generated by gotsrpc https://github.com/foomo/gotsrpc
|
|
package demo
|
|
|
|
import (
|
|
tls "crypto/tls"
|
|
nested "github.com/foomo/gotsrpc/demo/nested"
|
|
gorpc "github.com/valyala/gorpc"
|
|
)
|
|
|
|
type FooGoRPCClient struct {
|
|
Client *gorpc.Client
|
|
}
|
|
|
|
func NewFooGoRPCClient(addr string, tlsConfig *tls.Config) *FooGoRPCClient {
|
|
client := &FooGoRPCClient{}
|
|
if tlsConfig == nil {
|
|
client.Client = gorpc.NewTCPClient(addr)
|
|
} else {
|
|
client.Client = gorpc.NewTLSClient(addr, tlsConfig)
|
|
}
|
|
return client
|
|
}
|
|
|
|
func (goTSRPCClientInstance *FooGoRPCClient) Start() {
|
|
goTSRPCClientInstance.Client.Start()
|
|
}
|
|
|
|
func (goTSRPCClientInstance *FooGoRPCClient) Stop() {
|
|
goTSRPCClientInstance.Client.Stop()
|
|
}
|
|
|
|
func (goTSRPCClientInstance *FooGoRPCClient) Hello(number int64) (retHello_0 int, clientErr error) {
|
|
req := FooHelloRequest{Number: number}
|
|
rpcCallRes, rpcCallErr := goTSRPCClientInstance.Client.Call(req)
|
|
if rpcCallErr != nil {
|
|
clientErr = rpcCallErr
|
|
return
|
|
}
|
|
response := rpcCallRes.(FooHelloResponse)
|
|
return response.RetHello_0, nil
|
|
}
|
|
|
|
type DemoGoRPCClient struct {
|
|
Client *gorpc.Client
|
|
}
|
|
|
|
func NewDemoGoRPCClient(addr string, tlsConfig *tls.Config) *DemoGoRPCClient {
|
|
client := &DemoGoRPCClient{}
|
|
if tlsConfig == nil {
|
|
client.Client = gorpc.NewTCPClient(addr)
|
|
} else {
|
|
client.Client = gorpc.NewTLSClient(addr, tlsConfig)
|
|
}
|
|
return client
|
|
}
|
|
|
|
func (goTSRPCClientInstance *DemoGoRPCClient) Start() {
|
|
goTSRPCClientInstance.Client.Start()
|
|
}
|
|
|
|
func (goTSRPCClientInstance *DemoGoRPCClient) Stop() {
|
|
goTSRPCClientInstance.Client.Stop()
|
|
}
|
|
|
|
func (goTSRPCClientInstance *DemoGoRPCClient) ExtractAddress(person *Person) (addr *Address, e *Err, clientErr error) {
|
|
req := DemoExtractAddressRequest{Person: person}
|
|
rpcCallRes, rpcCallErr := goTSRPCClientInstance.Client.Call(req)
|
|
if rpcCallErr != nil {
|
|
clientErr = rpcCallErr
|
|
return
|
|
}
|
|
response := rpcCallRes.(DemoExtractAddressResponse)
|
|
return response.Addr, response.E, nil
|
|
}
|
|
|
|
func (goTSRPCClientInstance *DemoGoRPCClient) GiveMeAScalar() (amount nested.Amount, wahr nested.True, hier ScalarInPlace, clientErr error) {
|
|
req := DemoGiveMeAScalarRequest{}
|
|
rpcCallRes, rpcCallErr := goTSRPCClientInstance.Client.Call(req)
|
|
if rpcCallErr != nil {
|
|
clientErr = rpcCallErr
|
|
return
|
|
}
|
|
response := rpcCallRes.(DemoGiveMeAScalarResponse)
|
|
return response.Amount, response.Wahr, response.Hier, nil
|
|
}
|
|
|
|
func (goTSRPCClientInstance *DemoGoRPCClient) Hello(name string) (retHello_0 string, retHello_1 *Err, clientErr error) {
|
|
req := DemoHelloRequest{Name: name}
|
|
rpcCallRes, rpcCallErr := goTSRPCClientInstance.Client.Call(req)
|
|
if rpcCallErr != nil {
|
|
clientErr = rpcCallErr
|
|
return
|
|
}
|
|
response := rpcCallRes.(DemoHelloResponse)
|
|
return response.RetHello_0, response.RetHello_1, nil
|
|
}
|
|
|
|
func (goTSRPCClientInstance *DemoGoRPCClient) HelloInterface(anything interface{}, anythingMap map[string]interface{}, anythingSlice []interface{}) (clientErr error) {
|
|
req := DemoHelloInterfaceRequest{Anything: anything, AnythingMap: anythingMap, AnythingSlice: anythingSlice}
|
|
_, rpcCallErr := goTSRPCClientInstance.Client.Call(req)
|
|
if rpcCallErr != nil {
|
|
clientErr = rpcCallErr
|
|
return
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (goTSRPCClientInstance *DemoGoRPCClient) MapCrap() (crap map[string][]int, clientErr error) {
|
|
req := DemoMapCrapRequest{}
|
|
rpcCallRes, rpcCallErr := goTSRPCClientInstance.Client.Call(req)
|
|
if rpcCallErr != nil {
|
|
clientErr = rpcCallErr
|
|
return
|
|
}
|
|
response := rpcCallRes.(DemoMapCrapResponse)
|
|
return response.Crap, nil
|
|
}
|
|
|
|
func (goTSRPCClientInstance *DemoGoRPCClient) Nest() (retNest_0 *nested.Nested, clientErr error) {
|
|
req := DemoNestRequest{}
|
|
rpcCallRes, rpcCallErr := goTSRPCClientInstance.Client.Call(req)
|
|
if rpcCallErr != nil {
|
|
clientErr = rpcCallErr
|
|
return
|
|
}
|
|
response := rpcCallRes.(DemoNestResponse)
|
|
return response.RetNest_0, nil
|
|
}
|
|
|
|
func (goTSRPCClientInstance *DemoGoRPCClient) TestScalarInPlace() (retTestScalarInPlace_0 ScalarInPlace, clientErr error) {
|
|
req := DemoTestScalarInPlaceRequest{}
|
|
rpcCallRes, rpcCallErr := goTSRPCClientInstance.Client.Call(req)
|
|
if rpcCallErr != nil {
|
|
clientErr = rpcCallErr
|
|
return
|
|
}
|
|
response := rpcCallRes.(DemoTestScalarInPlaceResponse)
|
|
return response.RetTestScalarInPlace_0, nil
|
|
}
|