diff --git a/example/basic/client/src/service-client.ts b/example/basic/client/src/service-client.ts index 59e7e62..6ae6605 100644 --- a/example/basic/client/src/service-client.ts +++ b/example/basic/client/src/service-client.ts @@ -115,8 +115,8 @@ export class ServiceClient { async interfaceSlice(v:Array|null):Promise|null> { return (await this.transport<{0:Array|null}>("InterfaceSlice", [v]))[0] } - async nestedType():Promise { - return (await this.transport<{0:github_com_foomo_gotsrpc_v2_example_basic_service.NestedType|null}>("NestedType", []))[0] + async nestedType(v:github_com_foomo_gotsrpc_v2_example_basic_service.NestedType|null):Promise { + return (await this.transport<{0:github_com_foomo_gotsrpc_v2_example_basic_service.NestedType|null}>("NestedType", [v]))[0] } async string(v:string):Promise { return (await this.transport<{0:string}>("String", [v]))[0] diff --git a/example/basic/client/src/service-vo.ts b/example/basic/client/src/service-vo.ts index c22f779..9e0a900 100644 --- a/example/basic/client/src/service-vo.ts +++ b/example/basic/client/src/service-vo.ts @@ -86,16 +86,15 @@ export enum IntTypeMapValue { IntATypeMapValue = 1, IntBTypeMapValue = 2, } -// github.com/foomo/gotsrpc/v2/example/basic/service.NestedSubType -export interface NestedSubType { - Foo:string; -} // github.com/foomo/gotsrpc/v2/example/basic/service.NestedType -export type NestedType = Record|null>|null> +export type NestedType = Record|null>|null> // github.com/foomo/gotsrpc/v2/example/basic/service.NestedTypeKey export type NestedTypeKey = string // github.com/foomo/gotsrpc/v2/example/basic/service.NestedTypeSubKey export type NestedTypeSubKey = string +// github.com/foomo/gotsrpc/v2/example/basic/service.NestedTypeSubType +export interface NestedTypeSubType { +} // github.com/foomo/gotsrpc/v2/example/basic/service.StringType export enum StringType { StringAType = "A", diff --git a/example/basic/service/gorpc_gen.go b/example/basic/service/gorpc_gen.go index 0008ad3..806c80d 100644 --- a/example/basic/service/gorpc_gen.go +++ b/example/basic/service/gorpc_gen.go @@ -272,6 +272,7 @@ type ( } ServiceNestedTypeRequest struct { + V NestedType } ServiceNestedTypeResponse struct { RetNestedType_0 NestedType @@ -762,7 +763,8 @@ func (p *ServiceGoRPCProxy) handler(clientAddr string, request interface{}) (res retInterfaceSlice_0 := p.service.InterfaceSlice(req.V) response = ServiceInterfaceSliceResponse{RetInterfaceSlice_0: retInterfaceSlice_0} case "ServiceNestedTypeRequest": - retNestedType_0 := p.service.NestedType() + req := request.(ServiceNestedTypeRequest) + retNestedType_0 := p.service.NestedType(req.V) response = ServiceNestedTypeResponse{RetNestedType_0: retNestedType_0} case "ServiceStringRequest": req := request.(ServiceStringRequest) diff --git a/example/basic/service/gorpcclient_gen.go b/example/basic/service/gorpcclient_gen.go index 3f4f1f3..84846ed 100644 --- a/example/basic/service/gorpcclient_gen.go +++ b/example/basic/service/gorpcclient_gen.go @@ -425,8 +425,8 @@ func (tsc *ServiceGoRPCClient) InterfaceSlice(v []interface{}) (retInterfaceSlic return response.RetInterfaceSlice_0, nil } -func (tsc *ServiceGoRPCClient) NestedType() (retNestedType_0 NestedType, clientErr error) { - req := ServiceNestedTypeRequest{} +func (tsc *ServiceGoRPCClient) NestedType(v NestedType) (retNestedType_0 NestedType, clientErr error) { + req := ServiceNestedTypeRequest{V: v} rpcCallRes, rpcCallErr := tsc.Client.Call(req) if rpcCallErr != nil { clientErr = rpcCallErr diff --git a/example/basic/service/gotsrpc_gen.go b/example/basic/service/gotsrpc_gen.go index 3449cd1..ba4b679 100644 --- a/example/basic/service/gotsrpc_gen.go +++ b/example/basic/service/gotsrpc_gen.go @@ -932,8 +932,16 @@ func (p *ServiceGoTSRPCProxy) ServeHTTP(w http.ResponseWriter, r *http.Request) args []interface{} rets []interface{} ) + var ( + arg_v NestedType + ) + args = []interface{}{&arg_v} + if err := gotsrpc.LoadArgs(&args, callStats, r); err != nil { + gotsrpc.ErrorCouldNotLoadArgs(w) + return + } executionStart := time.Now() - nestedTypeRet := p.service.NestedType() + nestedTypeRet := p.service.NestedType(arg_v) callStats.Execution = time.Since(executionStart) rets = []interface{}{nestedTypeRet} if err := gotsrpc.Reply(rets, callStats, r, w); err != nil { diff --git a/example/basic/service/gotsrpcclient_gen.go b/example/basic/service/gotsrpcclient_gen.go index 7416849..9228474 100644 --- a/example/basic/service/gotsrpcclient_gen.go +++ b/example/basic/service/gotsrpcclient_gen.go @@ -47,7 +47,7 @@ type ServiceGoTSRPCClient interface { IntTypeMapTyped(ctx go_context.Context, v IntTypeMapTyped) (retIntTypeMapTyped_0 IntTypeMapTyped, clientErr error) Interface(ctx go_context.Context, v interface{}) (retInterface_0 interface{}, clientErr error) InterfaceSlice(ctx go_context.Context, v []interface{}) (retInterfaceSlice_0 []interface{}, clientErr error) - NestedType(ctx go_context.Context) (retNestedType_0 NestedType, clientErr error) + NestedType(ctx go_context.Context, v NestedType) (retNestedType_0 NestedType, clientErr error) String(ctx go_context.Context, v string) (retString_0 string, clientErr error) StringMap(ctx go_context.Context, v map[string]interface{}) (retStringMap_0 map[string]interface{}, clientErr error) StringSlice(ctx go_context.Context, v []string) (retStringSlice_0 []string, clientErr error) @@ -456,8 +456,8 @@ func (tsc *HTTPServiceGoTSRPCClient) InterfaceSlice(ctx go_context.Context, v [] return } -func (tsc *HTTPServiceGoTSRPCClient) NestedType(ctx go_context.Context) (retNestedType_0 NestedType, clientErr error) { - args := []interface{}{} +func (tsc *HTTPServiceGoTSRPCClient) NestedType(ctx go_context.Context, v NestedType) (retNestedType_0 NestedType, clientErr error) { + args := []interface{}{v} reply := []interface{}{&retNestedType_0} clientErr = tsc.Client.Call(ctx, tsc.URL, tsc.EndPoint, "NestedType", args, reply) if clientErr != nil { diff --git a/example/basic/service/service.go b/example/basic/service/service.go index 64d0047..3adcc05 100644 --- a/example/basic/service/service.go +++ b/example/basic/service/service.go @@ -62,5 +62,5 @@ type Service interface { Float32Type(v Float32Type) Float32Type Float64Type(v Float64Type) Float64Type StringType(v StringType) StringType - NestedType() NestedType + NestedType(v NestedType) NestedType }