From d74c278e01bedfd0831b510b1b7e008e0f516c8d Mon Sep 17 00:00:00 2001 From: Jack Chistyakov Date: Mon, 30 Sep 2024 04:11:26 -0700 Subject: [PATCH] Move req/resp struct definitions to types.go Summary: Makes `svcs.go` smaller and easier to read. Moves req/resp structs right next to regular program structs. All in one place. Consistent. Reviewed By: awalterschulze Differential Revision: D63611565 fbshipit-source-id: 2211f37ae2013794bc10733789377c6e9aacd50a --- .../generate/templates/go/svc/client.mustache | 5 - .../generate/templates/go/types.go.mustache | 11 + .../adapter/out/go/gen-go/module/svcs.go | 973 --- .../adapter/out/go/gen-go/module/types.go | 973 +++ .../go/gen-go/thrift/annotation/cpp/types.go | 1 + .../go/gen-go/thrift/annotation/hack/types.go | 1 + .../gen-go/thrift/annotation/python/types.go | 1 + .../go/gen-go/thrift/annotation/rust/types.go | 1 + .../gen-go/thrift/annotation/scope/types.go | 1 + .../gen-go/thrift/annotation/thrift/types.go | 1 + .../out/go/gen-go/module/svcs.go | 4477 ++---------- .../out/go/gen-go/module/types.go | 3046 ++++++++ .../go/gen-go/thrift/annotation/cpp/types.go | 1 + .../go/gen-go/thrift/annotation/go/types.go | 1 + .../go/gen-go/thrift/annotation/hack/types.go | 1 + .../gen-go/thrift/annotation/scope/types.go | 1 + .../gen-go/thrift/annotation/thrift/types.go | 1 + .../basic/out/go/gen-go/module/svcs.go | 4120 +---------- .../basic/out/go/gen-go/module/types.go | 3452 +++++++++ .../go/gen-go/thrift/annotation/hack/types.go | 1 + .../gen-go/thrift/annotation/scope/types.go | 1 + .../gen-go/thrift/annotation/thrift/types.go | 1 + .../out/go/gen-go/module/types.go | 1 + .../go/gen-go/thrift/annotation/cpp/types.go | 1 + .../gen-go/thrift/annotation/scope/types.go | 1 + .../gen-go/thrift/annotation/thrift/types.go | 1 + .../constants/out/go/gen-go/module/types.go | 1 + .../out/go/gen-go/module/types.go | 1 + .../doctext/out/go/gen-go/module/svcs.go | 675 -- .../doctext/out/go/gen-go/module/types.go | 676 ++ .../out/go/gen-go/module/types.go | 1 + .../enums/out/go/gen-go/module/types.go | 1 + .../gen-go/thrift/annotation/scope/types.go | 1 + .../gen-go/thrift/annotation/thrift/types.go | 1 + .../exceptions/out/go/gen-go/module/svcs.go | 1261 ---- .../exceptions/out/go/gen-go/module/types.go | 1262 ++++ .../gen-go/thrift/annotation/python/types.go | 1 + .../gen-go/thrift/annotation/scope/types.go | 1 + .../gen-go/thrift/annotation/thrift/types.go | 1 + .../go-service/out/go/gen-go/module/svcs.go | 6213 ---------------- .../go-service/out/go/gen-go/module/types.go | 6214 +++++++++++++++++ .../out/go_module0/gen-go/module0/types.go | 1 + .../out/go_module1/gen-go/module0/types.go | 1 + .../out/go_module1/gen-go/module1/svcs.go | 882 --- .../out/go_module1/gen-go/module1/types.go | 883 +++ .../out/go_module1/gen-go/module2/types.go | 1 + .../gen-go/thrift/annotation/go/types.go | 1 + .../gen-go/thrift/annotation/scope/types.go | 1 + .../out/go_module2/gen-go/module2/types.go | 1 + .../gen-go/IncludesAlso/types.go | 1 + .../gen-go/matching_names/types.go | 1 + .../out/go_service/gen-go/includes/types.go | 1 + .../out/go_service/gen-go/module/types.go | 1 + .../out/go_service/gen-go/service/svcs.go | 631 -- .../out/go_service/gen-go/service/types.go | 632 ++ .../out/go_service/gen-go/transitive/types.go | 1 + .../inheritance/out/go/gen-go/module/svcs.go | 516 -- .../inheritance/out/go/gen-go/module/types.go | 515 ++ .../out/go/gen-go/foo/types.go | 1 + .../out/go/gen-go/module/types.go | 1 + .../thrift/annotation/internals/types.go | 1 + .../gen-go/thrift/annotation/scope/types.go | 1 + .../gen-go/thrift/annotation/thrift/types.go | 1 + .../interactions/out/go/gen-go/module/svcs.go | 759 -- .../out/go/gen-go/module/types.go | 757 ++ .../interactions/out/go/gen-go/shared/svcs.go | 1 - .../out/go/gen-go/shared/types.go | 2 + .../go/gen-go/thrift/annotation/cpp/types.go | 1 + .../gen-go/thrift/annotation/scope/types.go | 1 + .../gen-go/thrift/annotation/thrift/types.go | 1 + .../gen-go/my/namespacing/test/module/svcs.go | 290 - .../my/namespacing/test/module/types.go | 291 + .../out/go_emptyns/gen-go/emptyns/svcs.go | 290 - .../out/go_emptyns/gen-go/emptyns/types.go | 291 + .../gen-go/my/namespacing/extend/test/svcs.go | 310 - .../my/namespacing/extend/test/types.go | 311 + .../gen-go/my/namespacing/test/svcs.go | 290 - .../gen-go/my/namespacing/test/types.go | 291 + .../gen-go/my/namespacing/test/svcs.go | 290 - .../gen-go/my/namespacing/test/types.go | 291 + .../gen-go/my/namespacing/test/module/svcs.go | 290 - .../my/namespacing/test/module/types.go | 291 + .../namespace_from_package/module/svcs.go | 290 - .../namespace_from_package/module/types.go | 291 + .../module/svcs.go | 290 - .../module/types.go | 291 + .../optionals/out/go/gen-go/module/types.go | 1 + .../params/out/go/gen-go/module/svcs.go | 1613 ----- .../params/out/go/gen-go/module/types.go | 1614 +++++ .../out/go/gen-go/module/types.go | 1 + .../gen-go/thrift/annotation/scope/types.go | 1 + .../gen-go/thrift/annotation/thrift/types.go | 1 + .../out/go/gen-go/terse_write/types.go | 1 + .../go/gen-go/thrift/annotation/cpp/types.go | 1 + .../go/gen-go/thrift/annotation/hack/types.go | 1 + .../gen-go/thrift/annotation/scope/types.go | 1 + .../gen-go/thrift/annotation/thrift/types.go | 1 + .../types/out/go/gen-go/included/types.go | 1 + .../types/out/go/gen-go/module/svcs.go | 667 -- .../types/out/go/gen-go/module/types.go | 668 ++ .../go/gen-go/thrift/annotation/cpp/types.go | 1 + .../gen-go/thrift/annotation/scope/types.go | 1 + .../gen-go/thrift/annotation/thrift/types.go | 1 + 103 files changed, 24159 insertions(+), 24086 deletions(-) diff --git a/thrift/compiler/generate/templates/go/svc/client.mustache b/thrift/compiler/generate/templates/go/svc/client.mustache index 41a20ec731c..629e74a08ed 100644 --- a/thrift/compiler/generate/templates/go/svc/client.mustache +++ b/thrift/compiler/generate/templates/go/svc/client.mustache @@ -116,8 +116,3 @@ func (c *{{service:go_name}}Client) {{> svc/func_signature_with_ctx}} { } {{/function:go_supported?}} {{/service:functions}} - -{{#service:req_resp_structs}} -{{> types/struct}} - -{{/service:req_resp_structs}} diff --git a/thrift/compiler/generate/templates/go/types.go.mustache b/thrift/compiler/generate/templates/go/types.go.mustache index 2a8bee22a99..c12bfd386ac 100644 --- a/thrift/compiler/generate/templates/go/types.go.mustache +++ b/thrift/compiler/generate/templates/go/types.go.mustache @@ -58,6 +58,17 @@ var _ = thrift.ZERO {{/program:structs}} {{/program:structs?}} +{{! Req/resp srtucts }} +{{#program:services?}} +// Service req/resp structs (below) +{{#program:services}} +{{#service:req_resp_structs}} +{{> types/struct}} + +{{/service:req_resp_structs}} +{{/program:services}} +{{/program:services?}} + {{#program:structs?}} {{> common/registry}} {{/program:structs?}} diff --git a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/module/svcs.go b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/module/svcs.go index fd7fcbde5cd..8f48c1a492a 100644 --- a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/module/svcs.go +++ b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/module/svcs.go @@ -100,422 +100,6 @@ func (c *ServiceClient) FuncContext(ctx context.Context, arg1 StringWithAdapter_ return c.chClient.Func(ctx, arg1, arg2, arg3) } -type reqServiceFunc struct { - Arg1 StringWithAdapter_7208 `thrift:"arg1,1" json:"arg1" db:"arg1"` - Arg2 string `thrift:"arg2,2" json:"arg2" db:"arg2"` - Arg3 *Foo `thrift:"arg3,3" json:"arg3" db:"arg3"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqServiceFunc)(nil) - -// Deprecated: ServiceFuncArgsDeprecated is deprecated, since it is supposed to be internal. -type ServiceFuncArgsDeprecated = reqServiceFunc - -func newReqServiceFunc() *reqServiceFunc { - return (&reqServiceFunc{}).setDefaults() -} - -func (x *reqServiceFunc) GetArg1() StringWithAdapter_7208 { - return x.Arg1 -} - -func (x *reqServiceFunc) GetArg2() string { - return x.Arg2 -} - -func (x *reqServiceFunc) GetArg3() *Foo { - if !x.IsSetArg3() { - return nil - } - return x.Arg3 -} - -func (x *reqServiceFunc) SetArg1NonCompat(value StringWithAdapter_7208) *reqServiceFunc { - x.Arg1 = value - return x -} - -func (x *reqServiceFunc) SetArg1(value StringWithAdapter_7208) *reqServiceFunc { - x.Arg1 = value - return x -} - -func (x *reqServiceFunc) SetArg2NonCompat(value string) *reqServiceFunc { - x.Arg2 = value - return x -} - -func (x *reqServiceFunc) SetArg2(value string) *reqServiceFunc { - x.Arg2 = value - return x -} - -func (x *reqServiceFunc) SetArg3NonCompat(value *Foo) *reqServiceFunc { - x.Arg3 = value - return x -} - -func (x *reqServiceFunc) SetArg3(value *Foo) *reqServiceFunc { - x.Arg3 = value - return x -} - -func (x *reqServiceFunc) IsSetArg3() bool { - return x != nil && x.Arg3 != nil -} - -func (x *reqServiceFunc) writeField1(p thrift.Encoder) error { // Arg1 - if err := p.WriteFieldBegin("arg1", thrift.STRING, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Arg1 - err := WriteStringWithAdapter_7208(item, p) -if err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqServiceFunc) writeField2(p thrift.Encoder) error { // Arg2 - if err := p.WriteFieldBegin("arg2", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Arg2 - if err := p.WriteString(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqServiceFunc) writeField3(p thrift.Encoder) error { // Arg3 - if !x.IsSetArg3() { - return nil - } - - if err := p.WriteFieldBegin("arg3", thrift.STRUCT, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Arg3 - if err := item.Write(p); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqServiceFunc) readField1(p thrift.Decoder) error { // Arg1 - result, err := ReadStringWithAdapter_7208(p) -if err != nil { - return err -} - - x.Arg1 = result - return nil -} - -func (x *reqServiceFunc) readField2(p thrift.Decoder) error { // Arg2 - result, err := p.ReadString() -if err != nil { - return err -} - - x.Arg2 = result - return nil -} - -func (x *reqServiceFunc) readField3(p thrift.Decoder) error { // Arg3 - result := NewFoo() -err := result.Read(p) -if err != nil { - return err -} - - x.Arg3 = result - return nil -} - -func (x *reqServiceFunc) toString1() string { // Arg1 - return fmt.Sprintf("%v", x.Arg1) -} - -func (x *reqServiceFunc) toString2() string { // Arg2 - return fmt.Sprintf("%v", x.Arg2) -} - -func (x *reqServiceFunc) toString3() string { // Arg3 - return fmt.Sprintf("%v", x.Arg3) -} - -// Deprecated: Use newReqServiceFunc().GetArg3() instead. -func (x *reqServiceFunc) DefaultGetArg3() *Foo { - if !x.IsSetArg3() { - return NewFoo() - } - return x.Arg3 -} - - - -func (x *reqServiceFunc) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqServiceFunc"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - if err := x.writeField2(p); err != nil { - return err - } - if err := x.writeField3(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqServiceFunc) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.STRING)): // arg1 - fieldReadErr = x.readField1(p) - case (id == 2 && wireType == thrift.Type(thrift.STRING)): // arg2 - fieldReadErr = x.readField2(p) - case (id == 3 && wireType == thrift.Type(thrift.STRUCT)): // arg3 - fieldReadErr = x.readField3(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqServiceFunc) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqServiceFunc({") - sb.WriteString(fmt.Sprintf("Arg1:%s ", x.toString1())) - sb.WriteString(fmt.Sprintf("Arg2:%s ", x.toString2())) - sb.WriteString(fmt.Sprintf("Arg3:%s", x.toString3())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqServiceFunc) setDefaults() *reqServiceFunc { - return x. - SetArg1NonCompat(NewStringWithAdapter_7208()). - SetArg2NonCompat(""). - SetArg3NonCompat(NewFoo()) -} - -type respServiceFunc struct { - Success *MyI32_4873 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respServiceFunc)(nil) -var _ thrift.WritableResult = (*respServiceFunc)(nil) - -// Deprecated: ServiceFuncResultDeprecated is deprecated, since it is supposed to be internal. -type ServiceFuncResultDeprecated = respServiceFunc - -func newRespServiceFunc() *respServiceFunc { - return (&respServiceFunc{}).setDefaults() -} - -func (x *respServiceFunc) GetSuccess() MyI32_4873 { - if !x.IsSetSuccess() { - return NewMyI32_4873() - } - return *x.Success -} - -func (x *respServiceFunc) SetSuccessNonCompat(value MyI32_4873) *respServiceFunc { - x.Success = &value - return x -} - -func (x *respServiceFunc) SetSuccess(value *MyI32_4873) *respServiceFunc { - x.Success = value - return x -} - -func (x *respServiceFunc) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respServiceFunc) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - err := WriteMyI32_4873(item, p) -if err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respServiceFunc) readField0(p thrift.Decoder) error { // Success - result, err := ReadMyI32_4873(p) -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respServiceFunc) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respServiceFunc) Exception() thrift.WritableException { - return nil -} - -func (x *respServiceFunc) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respServiceFunc"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respServiceFunc) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.I32)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respServiceFunc) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respServiceFunc({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respServiceFunc) setDefaults() *respServiceFunc { - return x -} - - type ServiceProcessor struct { processorFunctionMap map[string]thrift.ProcessorFunction @@ -710,563 +294,6 @@ func (c *AdapterServiceClient) AdaptedTypesContext(ctx context.Context, arg *Hea return c.chClient.AdaptedTypes(ctx, arg) } -type reqAdapterServiceCount struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqAdapterServiceCount)(nil) - -// Deprecated: AdapterServiceCountArgsDeprecated is deprecated, since it is supposed to be internal. -type AdapterServiceCountArgsDeprecated = reqAdapterServiceCount - -func newReqAdapterServiceCount() *reqAdapterServiceCount { - return (&reqAdapterServiceCount{}).setDefaults() -} - - - -func (x *reqAdapterServiceCount) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqAdapterServiceCount"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqAdapterServiceCount) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqAdapterServiceCount) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqAdapterServiceCount({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqAdapterServiceCount) setDefaults() *reqAdapterServiceCount { - return x -} - -type respAdapterServiceCount struct { - Success *CountingStruct `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respAdapterServiceCount)(nil) -var _ thrift.WritableResult = (*respAdapterServiceCount)(nil) - -// Deprecated: AdapterServiceCountResultDeprecated is deprecated, since it is supposed to be internal. -type AdapterServiceCountResultDeprecated = respAdapterServiceCount - -func newRespAdapterServiceCount() *respAdapterServiceCount { - return (&respAdapterServiceCount{}).setDefaults() -} - -func (x *respAdapterServiceCount) GetSuccess() *CountingStruct { - if !x.IsSetSuccess() { - return nil - } - return x.Success -} - -func (x *respAdapterServiceCount) SetSuccessNonCompat(value *CountingStruct) *respAdapterServiceCount { - x.Success = value - return x -} - -func (x *respAdapterServiceCount) SetSuccess(value *CountingStruct) *respAdapterServiceCount { - x.Success = value - return x -} - -func (x *respAdapterServiceCount) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respAdapterServiceCount) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Success - if err := item.Write(p); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respAdapterServiceCount) readField0(p thrift.Decoder) error { // Success - result := NewCountingStruct() -err := result.Read(p) -if err != nil { - return err -} - - x.Success = result - return nil -} - -func (x *respAdapterServiceCount) toString0() string { // Success - return fmt.Sprintf("%v", x.Success) -} - -// Deprecated: Use newRespAdapterServiceCount().GetSuccess() instead. -func (x *respAdapterServiceCount) DefaultGetSuccess() *CountingStruct { - if !x.IsSetSuccess() { - return NewCountingStruct() - } - return x.Success -} - - - -func (x *respAdapterServiceCount) Exception() thrift.WritableException { - return nil -} - -func (x *respAdapterServiceCount) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respAdapterServiceCount"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respAdapterServiceCount) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.STRUCT)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respAdapterServiceCount) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respAdapterServiceCount({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respAdapterServiceCount) setDefaults() *respAdapterServiceCount { - return x -} - -type reqAdapterServiceAdaptedTypes struct { - Arg *HeapAllocated `thrift:"arg,1" json:"arg" db:"arg"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqAdapterServiceAdaptedTypes)(nil) - -// Deprecated: AdapterServiceAdaptedTypesArgsDeprecated is deprecated, since it is supposed to be internal. -type AdapterServiceAdaptedTypesArgsDeprecated = reqAdapterServiceAdaptedTypes - -func newReqAdapterServiceAdaptedTypes() *reqAdapterServiceAdaptedTypes { - return (&reqAdapterServiceAdaptedTypes{}).setDefaults() -} - -func (x *reqAdapterServiceAdaptedTypes) GetArg() *HeapAllocated { - if !x.IsSetArg() { - return nil - } - return x.Arg -} - -func (x *reqAdapterServiceAdaptedTypes) SetArgNonCompat(value *HeapAllocated) *reqAdapterServiceAdaptedTypes { - x.Arg = value - return x -} - -func (x *reqAdapterServiceAdaptedTypes) SetArg(value *HeapAllocated) *reqAdapterServiceAdaptedTypes { - x.Arg = value - return x -} - -func (x *reqAdapterServiceAdaptedTypes) IsSetArg() bool { - return x != nil && x.Arg != nil -} - -func (x *reqAdapterServiceAdaptedTypes) writeField1(p thrift.Encoder) error { // Arg - if !x.IsSetArg() { - return nil - } - - if err := p.WriteFieldBegin("arg", thrift.STRUCT, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Arg - if err := item.Write(p); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqAdapterServiceAdaptedTypes) readField1(p thrift.Decoder) error { // Arg - result := NewHeapAllocated() -err := result.Read(p) -if err != nil { - return err -} - - x.Arg = result - return nil -} - -func (x *reqAdapterServiceAdaptedTypes) toString1() string { // Arg - return fmt.Sprintf("%v", x.Arg) -} - -// Deprecated: Use newReqAdapterServiceAdaptedTypes().GetArg() instead. -func (x *reqAdapterServiceAdaptedTypes) DefaultGetArg() *HeapAllocated { - if !x.IsSetArg() { - return NewHeapAllocated() - } - return x.Arg -} - - - -func (x *reqAdapterServiceAdaptedTypes) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqAdapterServiceAdaptedTypes"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqAdapterServiceAdaptedTypes) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.STRUCT)): // arg - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqAdapterServiceAdaptedTypes) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqAdapterServiceAdaptedTypes({") - sb.WriteString(fmt.Sprintf("Arg:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqAdapterServiceAdaptedTypes) setDefaults() *reqAdapterServiceAdaptedTypes { - return x. - SetArgNonCompat(NewHeapAllocated()) -} - -type respAdapterServiceAdaptedTypes struct { - Success *HeapAllocated `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respAdapterServiceAdaptedTypes)(nil) -var _ thrift.WritableResult = (*respAdapterServiceAdaptedTypes)(nil) - -// Deprecated: AdapterServiceAdaptedTypesResultDeprecated is deprecated, since it is supposed to be internal. -type AdapterServiceAdaptedTypesResultDeprecated = respAdapterServiceAdaptedTypes - -func newRespAdapterServiceAdaptedTypes() *respAdapterServiceAdaptedTypes { - return (&respAdapterServiceAdaptedTypes{}).setDefaults() -} - -func (x *respAdapterServiceAdaptedTypes) GetSuccess() *HeapAllocated { - if !x.IsSetSuccess() { - return nil - } - return x.Success -} - -func (x *respAdapterServiceAdaptedTypes) SetSuccessNonCompat(value *HeapAllocated) *respAdapterServiceAdaptedTypes { - x.Success = value - return x -} - -func (x *respAdapterServiceAdaptedTypes) SetSuccess(value *HeapAllocated) *respAdapterServiceAdaptedTypes { - x.Success = value - return x -} - -func (x *respAdapterServiceAdaptedTypes) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respAdapterServiceAdaptedTypes) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Success - if err := item.Write(p); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respAdapterServiceAdaptedTypes) readField0(p thrift.Decoder) error { // Success - result := NewHeapAllocated() -err := result.Read(p) -if err != nil { - return err -} - - x.Success = result - return nil -} - -func (x *respAdapterServiceAdaptedTypes) toString0() string { // Success - return fmt.Sprintf("%v", x.Success) -} - -// Deprecated: Use newRespAdapterServiceAdaptedTypes().GetSuccess() instead. -func (x *respAdapterServiceAdaptedTypes) DefaultGetSuccess() *HeapAllocated { - if !x.IsSetSuccess() { - return NewHeapAllocated() - } - return x.Success -} - - - -func (x *respAdapterServiceAdaptedTypes) Exception() thrift.WritableException { - return nil -} - -func (x *respAdapterServiceAdaptedTypes) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respAdapterServiceAdaptedTypes"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respAdapterServiceAdaptedTypes) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.STRUCT)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respAdapterServiceAdaptedTypes) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respAdapterServiceAdaptedTypes({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respAdapterServiceAdaptedTypes) setDefaults() *respAdapterServiceAdaptedTypes { - return x -} - - type AdapterServiceProcessor struct { processorFunctionMap map[string]thrift.ProcessorFunction diff --git a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/module/types.go b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/module/types.go index c5de43edc8e..4371be98726 100644 --- a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/module/types.go +++ b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/module/types.go @@ -9737,6 +9737,979 @@ func (x *RenamedStructWithStructAdapterAndFieldAdapter) setDefaults() *RenamedSt } +// Service req/resp structs (below) +type reqServiceFunc struct { + Arg1 StringWithAdapter_7208 `thrift:"arg1,1" json:"arg1" db:"arg1"` + Arg2 string `thrift:"arg2,2" json:"arg2" db:"arg2"` + Arg3 *Foo `thrift:"arg3,3" json:"arg3" db:"arg3"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqServiceFunc)(nil) + +// Deprecated: ServiceFuncArgsDeprecated is deprecated, since it is supposed to be internal. +type ServiceFuncArgsDeprecated = reqServiceFunc + +func newReqServiceFunc() *reqServiceFunc { + return (&reqServiceFunc{}).setDefaults() +} + +func (x *reqServiceFunc) GetArg1() StringWithAdapter_7208 { + return x.Arg1 +} + +func (x *reqServiceFunc) GetArg2() string { + return x.Arg2 +} + +func (x *reqServiceFunc) GetArg3() *Foo { + if !x.IsSetArg3() { + return nil + } + return x.Arg3 +} + +func (x *reqServiceFunc) SetArg1NonCompat(value StringWithAdapter_7208) *reqServiceFunc { + x.Arg1 = value + return x +} + +func (x *reqServiceFunc) SetArg1(value StringWithAdapter_7208) *reqServiceFunc { + x.Arg1 = value + return x +} + +func (x *reqServiceFunc) SetArg2NonCompat(value string) *reqServiceFunc { + x.Arg2 = value + return x +} + +func (x *reqServiceFunc) SetArg2(value string) *reqServiceFunc { + x.Arg2 = value + return x +} + +func (x *reqServiceFunc) SetArg3NonCompat(value *Foo) *reqServiceFunc { + x.Arg3 = value + return x +} + +func (x *reqServiceFunc) SetArg3(value *Foo) *reqServiceFunc { + x.Arg3 = value + return x +} + +func (x *reqServiceFunc) IsSetArg3() bool { + return x != nil && x.Arg3 != nil +} + +func (x *reqServiceFunc) writeField1(p thrift.Encoder) error { // Arg1 + if err := p.WriteFieldBegin("arg1", thrift.STRING, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Arg1 + err := WriteStringWithAdapter_7208(item, p) +if err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqServiceFunc) writeField2(p thrift.Encoder) error { // Arg2 + if err := p.WriteFieldBegin("arg2", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Arg2 + if err := p.WriteString(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqServiceFunc) writeField3(p thrift.Encoder) error { // Arg3 + if !x.IsSetArg3() { + return nil + } + + if err := p.WriteFieldBegin("arg3", thrift.STRUCT, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Arg3 + if err := item.Write(p); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqServiceFunc) readField1(p thrift.Decoder) error { // Arg1 + result, err := ReadStringWithAdapter_7208(p) +if err != nil { + return err +} + + x.Arg1 = result + return nil +} + +func (x *reqServiceFunc) readField2(p thrift.Decoder) error { // Arg2 + result, err := p.ReadString() +if err != nil { + return err +} + + x.Arg2 = result + return nil +} + +func (x *reqServiceFunc) readField3(p thrift.Decoder) error { // Arg3 + result := NewFoo() +err := result.Read(p) +if err != nil { + return err +} + + x.Arg3 = result + return nil +} + +func (x *reqServiceFunc) toString1() string { // Arg1 + return fmt.Sprintf("%v", x.Arg1) +} + +func (x *reqServiceFunc) toString2() string { // Arg2 + return fmt.Sprintf("%v", x.Arg2) +} + +func (x *reqServiceFunc) toString3() string { // Arg3 + return fmt.Sprintf("%v", x.Arg3) +} + +// Deprecated: Use newReqServiceFunc().GetArg3() instead. +func (x *reqServiceFunc) DefaultGetArg3() *Foo { + if !x.IsSetArg3() { + return NewFoo() + } + return x.Arg3 +} + + + +func (x *reqServiceFunc) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqServiceFunc"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + if err := x.writeField2(p); err != nil { + return err + } + if err := x.writeField3(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqServiceFunc) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.STRING)): // arg1 + fieldReadErr = x.readField1(p) + case (id == 2 && wireType == thrift.Type(thrift.STRING)): // arg2 + fieldReadErr = x.readField2(p) + case (id == 3 && wireType == thrift.Type(thrift.STRUCT)): // arg3 + fieldReadErr = x.readField3(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqServiceFunc) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqServiceFunc({") + sb.WriteString(fmt.Sprintf("Arg1:%s ", x.toString1())) + sb.WriteString(fmt.Sprintf("Arg2:%s ", x.toString2())) + sb.WriteString(fmt.Sprintf("Arg3:%s", x.toString3())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqServiceFunc) setDefaults() *reqServiceFunc { + return x. + SetArg1NonCompat(NewStringWithAdapter_7208()). + SetArg2NonCompat(""). + SetArg3NonCompat(NewFoo()) +} + +type respServiceFunc struct { + Success *MyI32_4873 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respServiceFunc)(nil) +var _ thrift.WritableResult = (*respServiceFunc)(nil) + +// Deprecated: ServiceFuncResultDeprecated is deprecated, since it is supposed to be internal. +type ServiceFuncResultDeprecated = respServiceFunc + +func newRespServiceFunc() *respServiceFunc { + return (&respServiceFunc{}).setDefaults() +} + +func (x *respServiceFunc) GetSuccess() MyI32_4873 { + if !x.IsSetSuccess() { + return NewMyI32_4873() + } + return *x.Success +} + +func (x *respServiceFunc) SetSuccessNonCompat(value MyI32_4873) *respServiceFunc { + x.Success = &value + return x +} + +func (x *respServiceFunc) SetSuccess(value *MyI32_4873) *respServiceFunc { + x.Success = value + return x +} + +func (x *respServiceFunc) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respServiceFunc) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + err := WriteMyI32_4873(item, p) +if err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respServiceFunc) readField0(p thrift.Decoder) error { // Success + result, err := ReadMyI32_4873(p) +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respServiceFunc) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respServiceFunc) Exception() thrift.WritableException { + return nil +} + +func (x *respServiceFunc) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respServiceFunc"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respServiceFunc) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.I32)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respServiceFunc) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respServiceFunc({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respServiceFunc) setDefaults() *respServiceFunc { + return x +} + +type reqAdapterServiceCount struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqAdapterServiceCount)(nil) + +// Deprecated: AdapterServiceCountArgsDeprecated is deprecated, since it is supposed to be internal. +type AdapterServiceCountArgsDeprecated = reqAdapterServiceCount + +func newReqAdapterServiceCount() *reqAdapterServiceCount { + return (&reqAdapterServiceCount{}).setDefaults() +} + + + +func (x *reqAdapterServiceCount) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqAdapterServiceCount"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqAdapterServiceCount) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqAdapterServiceCount) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqAdapterServiceCount({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqAdapterServiceCount) setDefaults() *reqAdapterServiceCount { + return x +} + +type respAdapterServiceCount struct { + Success *CountingStruct `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respAdapterServiceCount)(nil) +var _ thrift.WritableResult = (*respAdapterServiceCount)(nil) + +// Deprecated: AdapterServiceCountResultDeprecated is deprecated, since it is supposed to be internal. +type AdapterServiceCountResultDeprecated = respAdapterServiceCount + +func newRespAdapterServiceCount() *respAdapterServiceCount { + return (&respAdapterServiceCount{}).setDefaults() +} + +func (x *respAdapterServiceCount) GetSuccess() *CountingStruct { + if !x.IsSetSuccess() { + return nil + } + return x.Success +} + +func (x *respAdapterServiceCount) SetSuccessNonCompat(value *CountingStruct) *respAdapterServiceCount { + x.Success = value + return x +} + +func (x *respAdapterServiceCount) SetSuccess(value *CountingStruct) *respAdapterServiceCount { + x.Success = value + return x +} + +func (x *respAdapterServiceCount) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respAdapterServiceCount) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Success + if err := item.Write(p); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respAdapterServiceCount) readField0(p thrift.Decoder) error { // Success + result := NewCountingStruct() +err := result.Read(p) +if err != nil { + return err +} + + x.Success = result + return nil +} + +func (x *respAdapterServiceCount) toString0() string { // Success + return fmt.Sprintf("%v", x.Success) +} + +// Deprecated: Use newRespAdapterServiceCount().GetSuccess() instead. +func (x *respAdapterServiceCount) DefaultGetSuccess() *CountingStruct { + if !x.IsSetSuccess() { + return NewCountingStruct() + } + return x.Success +} + + + +func (x *respAdapterServiceCount) Exception() thrift.WritableException { + return nil +} + +func (x *respAdapterServiceCount) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respAdapterServiceCount"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respAdapterServiceCount) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.STRUCT)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respAdapterServiceCount) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respAdapterServiceCount({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respAdapterServiceCount) setDefaults() *respAdapterServiceCount { + return x +} + +type reqAdapterServiceAdaptedTypes struct { + Arg *HeapAllocated `thrift:"arg,1" json:"arg" db:"arg"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqAdapterServiceAdaptedTypes)(nil) + +// Deprecated: AdapterServiceAdaptedTypesArgsDeprecated is deprecated, since it is supposed to be internal. +type AdapterServiceAdaptedTypesArgsDeprecated = reqAdapterServiceAdaptedTypes + +func newReqAdapterServiceAdaptedTypes() *reqAdapterServiceAdaptedTypes { + return (&reqAdapterServiceAdaptedTypes{}).setDefaults() +} + +func (x *reqAdapterServiceAdaptedTypes) GetArg() *HeapAllocated { + if !x.IsSetArg() { + return nil + } + return x.Arg +} + +func (x *reqAdapterServiceAdaptedTypes) SetArgNonCompat(value *HeapAllocated) *reqAdapterServiceAdaptedTypes { + x.Arg = value + return x +} + +func (x *reqAdapterServiceAdaptedTypes) SetArg(value *HeapAllocated) *reqAdapterServiceAdaptedTypes { + x.Arg = value + return x +} + +func (x *reqAdapterServiceAdaptedTypes) IsSetArg() bool { + return x != nil && x.Arg != nil +} + +func (x *reqAdapterServiceAdaptedTypes) writeField1(p thrift.Encoder) error { // Arg + if !x.IsSetArg() { + return nil + } + + if err := p.WriteFieldBegin("arg", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Arg + if err := item.Write(p); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqAdapterServiceAdaptedTypes) readField1(p thrift.Decoder) error { // Arg + result := NewHeapAllocated() +err := result.Read(p) +if err != nil { + return err +} + + x.Arg = result + return nil +} + +func (x *reqAdapterServiceAdaptedTypes) toString1() string { // Arg + return fmt.Sprintf("%v", x.Arg) +} + +// Deprecated: Use newReqAdapterServiceAdaptedTypes().GetArg() instead. +func (x *reqAdapterServiceAdaptedTypes) DefaultGetArg() *HeapAllocated { + if !x.IsSetArg() { + return NewHeapAllocated() + } + return x.Arg +} + + + +func (x *reqAdapterServiceAdaptedTypes) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqAdapterServiceAdaptedTypes"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqAdapterServiceAdaptedTypes) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.STRUCT)): // arg + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqAdapterServiceAdaptedTypes) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqAdapterServiceAdaptedTypes({") + sb.WriteString(fmt.Sprintf("Arg:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqAdapterServiceAdaptedTypes) setDefaults() *reqAdapterServiceAdaptedTypes { + return x. + SetArgNonCompat(NewHeapAllocated()) +} + +type respAdapterServiceAdaptedTypes struct { + Success *HeapAllocated `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respAdapterServiceAdaptedTypes)(nil) +var _ thrift.WritableResult = (*respAdapterServiceAdaptedTypes)(nil) + +// Deprecated: AdapterServiceAdaptedTypesResultDeprecated is deprecated, since it is supposed to be internal. +type AdapterServiceAdaptedTypesResultDeprecated = respAdapterServiceAdaptedTypes + +func newRespAdapterServiceAdaptedTypes() *respAdapterServiceAdaptedTypes { + return (&respAdapterServiceAdaptedTypes{}).setDefaults() +} + +func (x *respAdapterServiceAdaptedTypes) GetSuccess() *HeapAllocated { + if !x.IsSetSuccess() { + return nil + } + return x.Success +} + +func (x *respAdapterServiceAdaptedTypes) SetSuccessNonCompat(value *HeapAllocated) *respAdapterServiceAdaptedTypes { + x.Success = value + return x +} + +func (x *respAdapterServiceAdaptedTypes) SetSuccess(value *HeapAllocated) *respAdapterServiceAdaptedTypes { + x.Success = value + return x +} + +func (x *respAdapterServiceAdaptedTypes) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respAdapterServiceAdaptedTypes) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Success + if err := item.Write(p); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respAdapterServiceAdaptedTypes) readField0(p thrift.Decoder) error { // Success + result := NewHeapAllocated() +err := result.Read(p) +if err != nil { + return err +} + + x.Success = result + return nil +} + +func (x *respAdapterServiceAdaptedTypes) toString0() string { // Success + return fmt.Sprintf("%v", x.Success) +} + +// Deprecated: Use newRespAdapterServiceAdaptedTypes().GetSuccess() instead. +func (x *respAdapterServiceAdaptedTypes) DefaultGetSuccess() *HeapAllocated { + if !x.IsSetSuccess() { + return NewHeapAllocated() + } + return x.Success +} + + + +func (x *respAdapterServiceAdaptedTypes) Exception() thrift.WritableException { + return nil +} + +func (x *respAdapterServiceAdaptedTypes) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respAdapterServiceAdaptedTypes"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respAdapterServiceAdaptedTypes) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.STRUCT)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respAdapterServiceAdaptedTypes) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respAdapterServiceAdaptedTypes({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respAdapterServiceAdaptedTypes) setDefaults() *respAdapterServiceAdaptedTypes { + return x +} + + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/cpp/types.go b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/cpp/types.go index b7608402504..fde8434e68b 100644 --- a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/cpp/types.go +++ b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/cpp/types.go @@ -2282,6 +2282,7 @@ func (x *GenerateDeprecatedHeaderClientMethods) setDefaults() *GenerateDeprecate } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/hack/types.go b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/hack/types.go index 25397ae334e..42eacb139df 100644 --- a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/hack/types.go +++ b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/hack/types.go @@ -1464,6 +1464,7 @@ func (x *ModuleInternal) setDefaults() *ModuleInternal { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/python/types.go b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/python/types.go index 6c730aa3cae..a7510986f18 100644 --- a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/python/types.go +++ b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/python/types.go @@ -760,6 +760,7 @@ func (x *UseCAPI) setDefaults() *UseCAPI { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/rust/types.go b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/rust/types.go index c0cf6e463b8..708aab15059 100644 --- a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/rust/types.go +++ b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/rust/types.go @@ -1540,6 +1540,7 @@ func (x *ServiceExn) setDefaults() *ServiceExn { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/scope/types.go b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/scope/types.go index c2871133501..c8a6b005a41 100644 --- a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/scope/types.go +++ b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/scope/types.go @@ -1380,6 +1380,7 @@ func (x *Definition) setDefaults() *Definition { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/thrift/types.go b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/thrift/types.go index 85cadd20f65..ba562235211 100644 --- a/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/thrift/types.go +++ b/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/thrift/types.go @@ -1804,6 +1804,7 @@ func (x *AllowReservedFilename) setDefaults() *AllowReservedFilename { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/module/svcs.go b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/module/svcs.go index 57288ebd5cb..1bc1e9c2b96 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/module/svcs.go +++ b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/module/svcs.go @@ -232,3086 +232,72 @@ func (c *MyServiceClient) GoDoNothingContext(ctx context.Context) (error) { return c.chClient.GoDoNothing(ctx) } -type reqMyServicePing struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqMyServicePing)(nil) - -// Deprecated: MyServicePingArgsDeprecated is deprecated, since it is supposed to be internal. -type MyServicePingArgsDeprecated = reqMyServicePing - -func newReqMyServicePing() *reqMyServicePing { - return (&reqMyServicePing{}).setDefaults() -} - - - -func (x *reqMyServicePing) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyServicePing"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyServicePing) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqMyServicePing) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqMyServicePing({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyServicePing) setDefaults() *reqMyServicePing { - return x -} - -type respMyServicePing struct { - MyExcept *MyException `thrift:"myExcept,1,optional" json:"myExcept,omitempty" db:"myExcept"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyServicePing)(nil) -var _ thrift.WritableResult = (*respMyServicePing)(nil) - -// Deprecated: MyServicePingResultDeprecated is deprecated, since it is supposed to be internal. -type MyServicePingResultDeprecated = respMyServicePing - -func newRespMyServicePing() *respMyServicePing { - return (&respMyServicePing{}).setDefaults() -} - -func (x *respMyServicePing) GetMyExcept() *MyException { - if !x.IsSetMyExcept() { - return nil - } - return x.MyExcept -} - -func (x *respMyServicePing) SetMyExceptNonCompat(value *MyException) *respMyServicePing { - x.MyExcept = value - return x -} - -func (x *respMyServicePing) SetMyExcept(value *MyException) *respMyServicePing { - x.MyExcept = value - return x -} - -func (x *respMyServicePing) IsSetMyExcept() bool { - return x != nil && x.MyExcept != nil -} - -func (x *respMyServicePing) writeField1(p thrift.Encoder) error { // MyExcept - if !x.IsSetMyExcept() { - return nil - } - - if err := p.WriteFieldBegin("myExcept", thrift.STRUCT, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.MyExcept - if err := item.Write(p); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respMyServicePing) readField1(p thrift.Decoder) error { // MyExcept - result := NewMyException() -err := result.Read(p) -if err != nil { - return err -} - - x.MyExcept = result - return nil -} - -func (x *respMyServicePing) toString1() string { // MyExcept - return fmt.Sprintf("%v", x.MyExcept) -} - -// Deprecated: Use newRespMyServicePing().GetMyExcept() instead. -func (x *respMyServicePing) DefaultGetMyExcept() *MyException { - if !x.IsSetMyExcept() { - return NewMyException() - } - return x.MyExcept -} - - - -func (x *respMyServicePing) Exception() thrift.WritableException { - if x.MyExcept != nil { - return x.MyExcept - } - return nil -} - -func (x *respMyServicePing) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyServicePing"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respMyServicePing) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.STRUCT)): // myExcept - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respMyServicePing) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyServicePing({") - sb.WriteString(fmt.Sprintf("MyExcept:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *respMyServicePing) setDefaults() *respMyServicePing { - return x -} - -type reqMyServiceGetRandomData struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqMyServiceGetRandomData)(nil) - -// Deprecated: MyServiceGetRandomDataArgsDeprecated is deprecated, since it is supposed to be internal. -type MyServiceGetRandomDataArgsDeprecated = reqMyServiceGetRandomData - -func newReqMyServiceGetRandomData() *reqMyServiceGetRandomData { - return (&reqMyServiceGetRandomData{}).setDefaults() -} - - - -func (x *reqMyServiceGetRandomData) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyServiceGetRandomData"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceGetRandomData) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqMyServiceGetRandomData) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqMyServiceGetRandomData({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyServiceGetRandomData) setDefaults() *reqMyServiceGetRandomData { - return x -} - -type respMyServiceGetRandomData struct { - Success *string `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyServiceGetRandomData)(nil) -var _ thrift.WritableResult = (*respMyServiceGetRandomData)(nil) - -// Deprecated: MyServiceGetRandomDataResultDeprecated is deprecated, since it is supposed to be internal. -type MyServiceGetRandomDataResultDeprecated = respMyServiceGetRandomData - -func newRespMyServiceGetRandomData() *respMyServiceGetRandomData { - return (&respMyServiceGetRandomData{}).setDefaults() -} - -func (x *respMyServiceGetRandomData) GetSuccess() string { - if !x.IsSetSuccess() { - return "" - } - return *x.Success -} - -func (x *respMyServiceGetRandomData) SetSuccessNonCompat(value string) *respMyServiceGetRandomData { - x.Success = &value - return x -} - -func (x *respMyServiceGetRandomData) SetSuccess(value *string) *respMyServiceGetRandomData { - x.Success = value - return x -} - -func (x *respMyServiceGetRandomData) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respMyServiceGetRandomData) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.STRING, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteString(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respMyServiceGetRandomData) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadString() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respMyServiceGetRandomData) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respMyServiceGetRandomData) Exception() thrift.WritableException { - return nil -} - -func (x *respMyServiceGetRandomData) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyServiceGetRandomData"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respMyServiceGetRandomData) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.STRING)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respMyServiceGetRandomData) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyServiceGetRandomData({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respMyServiceGetRandomData) setDefaults() *respMyServiceGetRandomData { - return x -} - -type reqMyServiceHasDataById struct { - Id int64 `thrift:"id,1" json:"id" db:"id"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqMyServiceHasDataById)(nil) - -// Deprecated: MyServiceHasDataByIdArgsDeprecated is deprecated, since it is supposed to be internal. -type MyServiceHasDataByIdArgsDeprecated = reqMyServiceHasDataById - -func newReqMyServiceHasDataById() *reqMyServiceHasDataById { - return (&reqMyServiceHasDataById{}).setDefaults() -} - -func (x *reqMyServiceHasDataById) GetId() int64 { - return x.Id -} - -func (x *reqMyServiceHasDataById) SetIdNonCompat(value int64) *reqMyServiceHasDataById { - x.Id = value - return x -} - -func (x *reqMyServiceHasDataById) SetId(value int64) *reqMyServiceHasDataById { - x.Id = value - return x -} - -func (x *reqMyServiceHasDataById) writeField1(p thrift.Encoder) error { // Id - if err := p.WriteFieldBegin("id", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Id - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceHasDataById) readField1(p thrift.Decoder) error { // Id - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Id = result - return nil -} - -func (x *reqMyServiceHasDataById) toString1() string { // Id - return fmt.Sprintf("%v", x.Id) -} - - - -func (x *reqMyServiceHasDataById) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyServiceHasDataById"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceHasDataById) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // id - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqMyServiceHasDataById) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqMyServiceHasDataById({") - sb.WriteString(fmt.Sprintf("Id:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyServiceHasDataById) setDefaults() *reqMyServiceHasDataById { - return x. - SetIdNonCompat(0) -} - -type respMyServiceHasDataById struct { - Success *bool `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyServiceHasDataById)(nil) -var _ thrift.WritableResult = (*respMyServiceHasDataById)(nil) - -// Deprecated: MyServiceHasDataByIdResultDeprecated is deprecated, since it is supposed to be internal. -type MyServiceHasDataByIdResultDeprecated = respMyServiceHasDataById - -func newRespMyServiceHasDataById() *respMyServiceHasDataById { - return (&respMyServiceHasDataById{}).setDefaults() -} - -func (x *respMyServiceHasDataById) GetSuccess() bool { - if !x.IsSetSuccess() { - return false - } - return *x.Success -} - -func (x *respMyServiceHasDataById) SetSuccessNonCompat(value bool) *respMyServiceHasDataById { - x.Success = &value - return x -} - -func (x *respMyServiceHasDataById) SetSuccess(value *bool) *respMyServiceHasDataById { - x.Success = value - return x -} - -func (x *respMyServiceHasDataById) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respMyServiceHasDataById) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.BOOL, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteBool(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respMyServiceHasDataById) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadBool() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respMyServiceHasDataById) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respMyServiceHasDataById) Exception() thrift.WritableException { - return nil -} - -func (x *respMyServiceHasDataById) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyServiceHasDataById"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respMyServiceHasDataById) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.BOOL)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respMyServiceHasDataById) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyServiceHasDataById({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respMyServiceHasDataById) setDefaults() *respMyServiceHasDataById { - return x -} - -type reqMyServiceGoGetDataById struct { - Id int64 `thrift:"id,1" json:"id" db:"id"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqMyServiceGoGetDataById)(nil) - -// Deprecated: MyServiceGoGetDataByIdArgsDeprecated is deprecated, since it is supposed to be internal. -type MyServiceGoGetDataByIdArgsDeprecated = reqMyServiceGoGetDataById - -func newReqMyServiceGoGetDataById() *reqMyServiceGoGetDataById { - return (&reqMyServiceGoGetDataById{}).setDefaults() -} - -func (x *reqMyServiceGoGetDataById) GetId() int64 { - return x.Id -} - -func (x *reqMyServiceGoGetDataById) SetIdNonCompat(value int64) *reqMyServiceGoGetDataById { - x.Id = value - return x -} - -func (x *reqMyServiceGoGetDataById) SetId(value int64) *reqMyServiceGoGetDataById { - x.Id = value - return x -} - -func (x *reqMyServiceGoGetDataById) writeField1(p thrift.Encoder) error { // Id - if err := p.WriteFieldBegin("id", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Id - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceGoGetDataById) readField1(p thrift.Decoder) error { // Id - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Id = result - return nil -} - -func (x *reqMyServiceGoGetDataById) toString1() string { // Id - return fmt.Sprintf("%v", x.Id) -} - - - -func (x *reqMyServiceGoGetDataById) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyServiceGoGetDataById"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceGoGetDataById) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // id - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqMyServiceGoGetDataById) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqMyServiceGoGetDataById({") - sb.WriteString(fmt.Sprintf("Id:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyServiceGoGetDataById) setDefaults() *reqMyServiceGoGetDataById { - return x. - SetIdNonCompat(0) -} - -type respMyServiceGoGetDataById struct { - Success *string `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyServiceGoGetDataById)(nil) -var _ thrift.WritableResult = (*respMyServiceGoGetDataById)(nil) - -// Deprecated: MyServiceGoGetDataByIdResultDeprecated is deprecated, since it is supposed to be internal. -type MyServiceGoGetDataByIdResultDeprecated = respMyServiceGoGetDataById - -func newRespMyServiceGoGetDataById() *respMyServiceGoGetDataById { - return (&respMyServiceGoGetDataById{}).setDefaults() -} - -func (x *respMyServiceGoGetDataById) GetSuccess() string { - if !x.IsSetSuccess() { - return "" - } - return *x.Success -} - -func (x *respMyServiceGoGetDataById) SetSuccessNonCompat(value string) *respMyServiceGoGetDataById { - x.Success = &value - return x -} - -func (x *respMyServiceGoGetDataById) SetSuccess(value *string) *respMyServiceGoGetDataById { - x.Success = value - return x -} - -func (x *respMyServiceGoGetDataById) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respMyServiceGoGetDataById) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.STRING, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteString(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respMyServiceGoGetDataById) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadString() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respMyServiceGoGetDataById) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respMyServiceGoGetDataById) Exception() thrift.WritableException { - return nil -} - -func (x *respMyServiceGoGetDataById) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyServiceGoGetDataById"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respMyServiceGoGetDataById) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.STRING)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respMyServiceGoGetDataById) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyServiceGoGetDataById({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respMyServiceGoGetDataById) setDefaults() *respMyServiceGoGetDataById { - return x -} - -type reqMyServicePutDataById struct { - Id int64 `thrift:"id,1" json:"id" db:"id"` - Data string `thrift:"data,2" json:"data" db:"data"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqMyServicePutDataById)(nil) - -// Deprecated: MyServicePutDataByIdArgsDeprecated is deprecated, since it is supposed to be internal. -type MyServicePutDataByIdArgsDeprecated = reqMyServicePutDataById - -func newReqMyServicePutDataById() *reqMyServicePutDataById { - return (&reqMyServicePutDataById{}).setDefaults() -} - -func (x *reqMyServicePutDataById) GetId() int64 { - return x.Id -} - -func (x *reqMyServicePutDataById) GetData() string { - return x.Data -} - -func (x *reqMyServicePutDataById) SetIdNonCompat(value int64) *reqMyServicePutDataById { - x.Id = value - return x -} - -func (x *reqMyServicePutDataById) SetId(value int64) *reqMyServicePutDataById { - x.Id = value - return x -} - -func (x *reqMyServicePutDataById) SetDataNonCompat(value string) *reqMyServicePutDataById { - x.Data = value - return x -} - -func (x *reqMyServicePutDataById) SetData(value string) *reqMyServicePutDataById { - x.Data = value - return x -} - -func (x *reqMyServicePutDataById) writeField1(p thrift.Encoder) error { // Id - if err := p.WriteFieldBegin("id", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Id - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqMyServicePutDataById) writeField2(p thrift.Encoder) error { // Data - if err := p.WriteFieldBegin("data", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Data - if err := p.WriteString(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqMyServicePutDataById) readField1(p thrift.Decoder) error { // Id - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Id = result - return nil -} - -func (x *reqMyServicePutDataById) readField2(p thrift.Decoder) error { // Data - result, err := p.ReadString() -if err != nil { - return err -} - - x.Data = result - return nil -} - -func (x *reqMyServicePutDataById) toString1() string { // Id - return fmt.Sprintf("%v", x.Id) -} - -func (x *reqMyServicePutDataById) toString2() string { // Data - return fmt.Sprintf("%v", x.Data) -} - - - -func (x *reqMyServicePutDataById) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyServicePutDataById"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - if err := x.writeField2(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyServicePutDataById) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // id - fieldReadErr = x.readField1(p) - case (id == 2 && wireType == thrift.Type(thrift.STRING)): // data - fieldReadErr = x.readField2(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqMyServicePutDataById) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqMyServicePutDataById({") - sb.WriteString(fmt.Sprintf("Id:%s ", x.toString1())) - sb.WriteString(fmt.Sprintf("Data:%s", x.toString2())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyServicePutDataById) setDefaults() *reqMyServicePutDataById { - return x. - SetIdNonCompat(0). - SetDataNonCompat("") -} - -type respMyServicePutDataById struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyServicePutDataById)(nil) -var _ thrift.WritableResult = (*respMyServicePutDataById)(nil) - -// Deprecated: MyServicePutDataByIdResultDeprecated is deprecated, since it is supposed to be internal. -type MyServicePutDataByIdResultDeprecated = respMyServicePutDataById - -func newRespMyServicePutDataById() *respMyServicePutDataById { - return (&respMyServicePutDataById{}).setDefaults() -} - - - -func (x *respMyServicePutDataById) Exception() thrift.WritableException { - return nil -} - -func (x *respMyServicePutDataById) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyServicePutDataById"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respMyServicePutDataById) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respMyServicePutDataById) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyServicePutDataById({") - sb.WriteString("})") - - return sb.String() -} -func (x *respMyServicePutDataById) setDefaults() *respMyServicePutDataById { - return x -} - -type reqMyServiceLobDataById struct { - Id int64 `thrift:"id,1" json:"id" db:"id"` - Data string `thrift:"data,2" json:"data" db:"data"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqMyServiceLobDataById)(nil) - -// Deprecated: MyServiceLobDataByIdArgsDeprecated is deprecated, since it is supposed to be internal. -type MyServiceLobDataByIdArgsDeprecated = reqMyServiceLobDataById - -func newReqMyServiceLobDataById() *reqMyServiceLobDataById { - return (&reqMyServiceLobDataById{}).setDefaults() -} - -func (x *reqMyServiceLobDataById) GetId() int64 { - return x.Id -} - -func (x *reqMyServiceLobDataById) GetData() string { - return x.Data -} - -func (x *reqMyServiceLobDataById) SetIdNonCompat(value int64) *reqMyServiceLobDataById { - x.Id = value - return x -} - -func (x *reqMyServiceLobDataById) SetId(value int64) *reqMyServiceLobDataById { - x.Id = value - return x -} - -func (x *reqMyServiceLobDataById) SetDataNonCompat(value string) *reqMyServiceLobDataById { - x.Data = value - return x -} - -func (x *reqMyServiceLobDataById) SetData(value string) *reqMyServiceLobDataById { - x.Data = value - return x -} - -func (x *reqMyServiceLobDataById) writeField1(p thrift.Encoder) error { // Id - if err := p.WriteFieldBegin("id", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Id - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceLobDataById) writeField2(p thrift.Encoder) error { // Data - if err := p.WriteFieldBegin("data", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Data - if err := p.WriteString(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceLobDataById) readField1(p thrift.Decoder) error { // Id - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Id = result - return nil -} - -func (x *reqMyServiceLobDataById) readField2(p thrift.Decoder) error { // Data - result, err := p.ReadString() -if err != nil { - return err -} - - x.Data = result - return nil -} - -func (x *reqMyServiceLobDataById) toString1() string { // Id - return fmt.Sprintf("%v", x.Id) -} - -func (x *reqMyServiceLobDataById) toString2() string { // Data - return fmt.Sprintf("%v", x.Data) -} - - - -func (x *reqMyServiceLobDataById) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyServiceLobDataById"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - if err := x.writeField2(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceLobDataById) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // id - fieldReadErr = x.readField1(p) - case (id == 2 && wireType == thrift.Type(thrift.STRING)): // data - fieldReadErr = x.readField2(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqMyServiceLobDataById) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqMyServiceLobDataById({") - sb.WriteString(fmt.Sprintf("Id:%s ", x.toString1())) - sb.WriteString(fmt.Sprintf("Data:%s", x.toString2())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyServiceLobDataById) setDefaults() *reqMyServiceLobDataById { - return x. - SetIdNonCompat(0). - SetDataNonCompat("") -} - -type respMyServiceLobDataById struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyServiceLobDataById)(nil) -var _ thrift.WritableResult = (*respMyServiceLobDataById)(nil) - -// Deprecated: MyServiceLobDataByIdResultDeprecated is deprecated, since it is supposed to be internal. -type MyServiceLobDataByIdResultDeprecated = respMyServiceLobDataById - -func newRespMyServiceLobDataById() *respMyServiceLobDataById { - return (&respMyServiceLobDataById{}).setDefaults() -} - - - -func (x *respMyServiceLobDataById) Exception() thrift.WritableException { - return nil -} - -func (x *respMyServiceLobDataById) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyServiceLobDataById"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respMyServiceLobDataById) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respMyServiceLobDataById) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyServiceLobDataById({") - sb.WriteString("})") - - return sb.String() -} -func (x *respMyServiceLobDataById) setDefaults() *respMyServiceLobDataById { - return x -} - -type reqMyServiceGoDoNothing struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqMyServiceGoDoNothing)(nil) - -// Deprecated: MyServiceGoDoNothingArgsDeprecated is deprecated, since it is supposed to be internal. -type MyServiceGoDoNothingArgsDeprecated = reqMyServiceGoDoNothing - -func newReqMyServiceGoDoNothing() *reqMyServiceGoDoNothing { - return (&reqMyServiceGoDoNothing{}).setDefaults() -} - - - -func (x *reqMyServiceGoDoNothing) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyServiceGoDoNothing"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceGoDoNothing) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqMyServiceGoDoNothing) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqMyServiceGoDoNothing({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyServiceGoDoNothing) setDefaults() *reqMyServiceGoDoNothing { - return x -} - -type respMyServiceGoDoNothing struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyServiceGoDoNothing)(nil) -var _ thrift.WritableResult = (*respMyServiceGoDoNothing)(nil) - -// Deprecated: MyServiceGoDoNothingResultDeprecated is deprecated, since it is supposed to be internal. -type MyServiceGoDoNothingResultDeprecated = respMyServiceGoDoNothing - -func newRespMyServiceGoDoNothing() *respMyServiceGoDoNothing { - return (&respMyServiceGoDoNothing{}).setDefaults() -} - - - -func (x *respMyServiceGoDoNothing) Exception() thrift.WritableException { - return nil -} - -func (x *respMyServiceGoDoNothing) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyServiceGoDoNothing"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respMyServiceGoDoNothing) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respMyServiceGoDoNothing) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyServiceGoDoNothing({") - sb.WriteString("})") - - return sb.String() -} -func (x *respMyServiceGoDoNothing) setDefaults() *respMyServiceGoDoNothing { - return x -} - - - -type MyServiceProcessor struct { - processorFunctionMap map[string]thrift.ProcessorFunction - functionServiceMap map[string]string - handler MyService -} -// Compile time interface enforcer -var _ thrift.Processor = (*MyServiceProcessor)(nil) - -func NewMyServiceProcessor(handler MyService) *MyServiceProcessor { - p := &MyServiceProcessor{ - handler: handler, - processorFunctionMap: make(map[string]thrift.ProcessorFunction), - functionServiceMap: make(map[string]string), - } - p.AddToProcessorFunctionMap("ping", &procFuncMyServicePing{handler: handler}) - p.AddToProcessorFunctionMap("getRandomData", &procFuncMyServiceGetRandomData{handler: handler}) - p.AddToProcessorFunctionMap("hasDataById", &procFuncMyServiceHasDataById{handler: handler}) - p.AddToProcessorFunctionMap("getDataById", &procFuncMyServiceGoGetDataById{handler: handler}) - p.AddToProcessorFunctionMap("putDataById", &procFuncMyServicePutDataById{handler: handler}) - p.AddToProcessorFunctionMap("lobDataById", &procFuncMyServiceLobDataById{handler: handler}) - p.AddToProcessorFunctionMap("doNothing", &procFuncMyServiceGoDoNothing{handler: handler}) - p.AddToFunctionServiceMap("ping", "MyService") - p.AddToFunctionServiceMap("getRandomData", "MyService") - p.AddToFunctionServiceMap("hasDataById", "MyService") - p.AddToFunctionServiceMap("getDataById", "MyService") - p.AddToFunctionServiceMap("putDataById", "MyService") - p.AddToFunctionServiceMap("lobDataById", "MyService") - p.AddToFunctionServiceMap("doNothing", "MyService") - - return p -} - -func (p *MyServiceProcessor) AddToProcessorFunctionMap(key string, processorFunction thrift.ProcessorFunction) { - p.processorFunctionMap[key] = processorFunction -} - -func (p *MyServiceProcessor) AddToFunctionServiceMap(key, service string) { - p.functionServiceMap[key] = service -} - -func (p *MyServiceProcessor) GetProcessorFunction(key string) (processor thrift.ProcessorFunction) { - return p.processorFunctionMap[key] -} - -func (p *MyServiceProcessor) ProcessorFunctionMap() map[string]thrift.ProcessorFunction { - return p.processorFunctionMap -} - -func (p *MyServiceProcessor) FunctionServiceMap() map[string]string { - return p.functionServiceMap -} - -func (p *MyServiceProcessor) GetThriftMetadata() *metadata.ThriftMetadata { - return GetThriftMetadataForService("module.MyService") -} - - -type procFuncMyServicePing struct { - handler MyService -} -// Compile time interface enforcer -var _ thrift.ProcessorFunction = (*procFuncMyServicePing)(nil) - -func (p *procFuncMyServicePing) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { - args := newReqMyServicePing() - if err := args.Read(iprot); err != nil { - return nil, err - } - iprot.ReadMessageEnd() - return args, nil -} - -func (p *procFuncMyServicePing) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { - var err2 error - messageType := thrift.REPLY - switch v := result.(type) { - case *MyException: - result = &respMyServicePing{ - MyExcept: v, - } - case thrift.ApplicationException: - messageType = thrift.EXCEPTION - } - - if err2 = oprot.WriteMessageBegin("ping", messageType, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - return err -} - -func (p *procFuncMyServicePing) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { - result := newRespMyServicePing() - err := p.handler.Ping(ctx) - if err != nil { - switch v := err.(type) { - case *MyException: - result.MyExcept = v - return result, nil - default: - x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing Ping: " + err.Error(), err) - return x, x - } - } - - return result, nil -} - - -type procFuncMyServiceGetRandomData struct { - handler MyService -} -// Compile time interface enforcer -var _ thrift.ProcessorFunction = (*procFuncMyServiceGetRandomData)(nil) - -func (p *procFuncMyServiceGetRandomData) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { - args := newReqMyServiceGetRandomData() - if err := args.Read(iprot); err != nil { - return nil, err - } - iprot.ReadMessageEnd() - return args, nil -} - -func (p *procFuncMyServiceGetRandomData) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { - var err2 error - messageType := thrift.REPLY - switch result.(type) { - case thrift.ApplicationException: - messageType = thrift.EXCEPTION - } - - if err2 = oprot.WriteMessageBegin("getRandomData", messageType, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - return err -} - -func (p *procFuncMyServiceGetRandomData) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { - result := newRespMyServiceGetRandomData() - retval, err := p.handler.GetRandomData(ctx) - if err != nil { - x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing GetRandomData: " + err.Error(), err) - return x, x - } - - result.Success = &retval - return result, nil -} - - -type procFuncMyServiceHasDataById struct { - handler MyService -} -// Compile time interface enforcer -var _ thrift.ProcessorFunction = (*procFuncMyServiceHasDataById)(nil) - -func (p *procFuncMyServiceHasDataById) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { - args := newReqMyServiceHasDataById() - if err := args.Read(iprot); err != nil { - return nil, err - } - iprot.ReadMessageEnd() - return args, nil -} - -func (p *procFuncMyServiceHasDataById) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { - var err2 error - messageType := thrift.REPLY - switch result.(type) { - case thrift.ApplicationException: - messageType = thrift.EXCEPTION - } - - if err2 = oprot.WriteMessageBegin("hasDataById", messageType, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - return err -} - -func (p *procFuncMyServiceHasDataById) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { - args := reqStruct.(*reqMyServiceHasDataById) - result := newRespMyServiceHasDataById() - retval, err := p.handler.HasDataById(ctx, args.Id) - if err != nil { - x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing HasDataById: " + err.Error(), err) - return x, x - } - - result.Success = &retval - return result, nil -} - - -type procFuncMyServiceGoGetDataById struct { - handler MyService -} -// Compile time interface enforcer -var _ thrift.ProcessorFunction = (*procFuncMyServiceGoGetDataById)(nil) - -func (p *procFuncMyServiceGoGetDataById) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { - args := newReqMyServiceGoGetDataById() - if err := args.Read(iprot); err != nil { - return nil, err - } - iprot.ReadMessageEnd() - return args, nil -} - -func (p *procFuncMyServiceGoGetDataById) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { - var err2 error - messageType := thrift.REPLY - switch result.(type) { - case thrift.ApplicationException: - messageType = thrift.EXCEPTION - } - - if err2 = oprot.WriteMessageBegin("getDataById", messageType, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - return err -} - -func (p *procFuncMyServiceGoGetDataById) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { - args := reqStruct.(*reqMyServiceGoGetDataById) - result := newRespMyServiceGoGetDataById() - retval, err := p.handler.GoGetDataById(ctx, args.Id) - if err != nil { - x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing GoGetDataById: " + err.Error(), err) - return x, x - } - - result.Success = &retval - return result, nil -} - - -type procFuncMyServicePutDataById struct { - handler MyService -} -// Compile time interface enforcer -var _ thrift.ProcessorFunction = (*procFuncMyServicePutDataById)(nil) - -func (p *procFuncMyServicePutDataById) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { - args := newReqMyServicePutDataById() - if err := args.Read(iprot); err != nil { - return nil, err - } - iprot.ReadMessageEnd() - return args, nil -} - -func (p *procFuncMyServicePutDataById) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { - var err2 error - messageType := thrift.REPLY - switch result.(type) { - case thrift.ApplicationException: - messageType = thrift.EXCEPTION - } - - if err2 = oprot.WriteMessageBegin("putDataById", messageType, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - return err -} - -func (p *procFuncMyServicePutDataById) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { - args := reqStruct.(*reqMyServicePutDataById) - result := newRespMyServicePutDataById() - err := p.handler.PutDataById(ctx, args.Id, args.Data) - if err != nil { - x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing PutDataById: " + err.Error(), err) - return x, x - } - - return result, nil -} - - -type procFuncMyServiceLobDataById struct { - handler MyService -} -// Compile time interface enforcer -var _ thrift.ProcessorFunction = (*procFuncMyServiceLobDataById)(nil) - -func (p *procFuncMyServiceLobDataById) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { - args := newReqMyServiceLobDataById() - if err := args.Read(iprot); err != nil { - return nil, err - } - iprot.ReadMessageEnd() - return args, nil -} - -func (p *procFuncMyServiceLobDataById) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { - var err2 error - messageType := thrift.REPLY - switch result.(type) { - case thrift.ApplicationException: - messageType = thrift.EXCEPTION - } - - if err2 = oprot.WriteMessageBegin("lobDataById", messageType, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - return err -} - -func (p *procFuncMyServiceLobDataById) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { - args := reqStruct.(*reqMyServiceLobDataById) - err := p.handler.LobDataById(ctx, args.Id, args.Data) - if err != nil { - x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing LobDataById: " + err.Error(), err) - return x, x - } - - return nil, nil -} - - -type procFuncMyServiceGoDoNothing struct { - handler MyService -} -// Compile time interface enforcer -var _ thrift.ProcessorFunction = (*procFuncMyServiceGoDoNothing)(nil) - -func (p *procFuncMyServiceGoDoNothing) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { - args := newReqMyServiceGoDoNothing() - if err := args.Read(iprot); err != nil { - return nil, err - } - iprot.ReadMessageEnd() - return args, nil -} - -func (p *procFuncMyServiceGoDoNothing) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { - var err2 error - messageType := thrift.REPLY - switch result.(type) { - case thrift.ApplicationException: - messageType = thrift.EXCEPTION - } - - if err2 = oprot.WriteMessageBegin("doNothing", messageType, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - return err -} - -func (p *procFuncMyServiceGoDoNothing) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { - result := newRespMyServiceGoDoNothing() - err := p.handler.GoDoNothing(ctx) - if err != nil { - x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing GoDoNothing: " + err.Error(), err) - return x, x - } - - return result, nil -} - - -type MyServicePrioParent interface { - Ping(ctx context.Context) (error) - Pong(ctx context.Context) (error) -} - -type MyServicePrioParentChannelClientInterface interface { - thrift.ClientInterface - MyServicePrioParent -} - -type MyServicePrioParentClientInterface interface { - thrift.ClientInterface - Ping() (error) - Pong() (error) -} - -type MyServicePrioParentContextClientInterface interface { - MyServicePrioParentClientInterface - PingContext(ctx context.Context) (error) - PongContext(ctx context.Context) (error) -} - -type MyServicePrioParentChannelClient struct { - ch thrift.RequestChannel -} -// Compile time interface enforcer -var _ MyServicePrioParentChannelClientInterface = (*MyServicePrioParentChannelClient)(nil) - -func NewMyServicePrioParentChannelClient(channel thrift.RequestChannel) *MyServicePrioParentChannelClient { - return &MyServicePrioParentChannelClient{ - ch: channel, - } -} - -func (c *MyServicePrioParentChannelClient) Close() error { - return c.ch.Close() -} - -type MyServicePrioParentClient struct { - chClient *MyServicePrioParentChannelClient -} -// Compile time interface enforcer -var _ MyServicePrioParentClientInterface = (*MyServicePrioParentClient)(nil) -var _ MyServicePrioParentContextClientInterface = (*MyServicePrioParentClient)(nil) - -func NewMyServicePrioParentClient(prot thrift.Protocol) *MyServicePrioParentClient { - return &MyServicePrioParentClient{ - chClient: NewMyServicePrioParentChannelClient( - thrift.NewSerialChannel(prot), - ), - } -} - -func (c *MyServicePrioParentClient) Close() error { - return c.chClient.Close() -} - -func (c *MyServicePrioParentChannelClient) Ping(ctx context.Context) (error) { - in := &reqMyServicePrioParentPing{ - } - out := newRespMyServicePrioParentPing() - err := c.ch.Call(ctx, "ping", in, out) - if err != nil { - return err - } - return nil -} - -func (c *MyServicePrioParentClient) Ping() (error) { - return c.chClient.Ping(context.Background()) -} - -func (c *MyServicePrioParentClient) PingContext(ctx context.Context) (error) { - return c.chClient.Ping(ctx) -} - -func (c *MyServicePrioParentChannelClient) Pong(ctx context.Context) (error) { - in := &reqMyServicePrioParentPong{ - } - out := newRespMyServicePrioParentPong() - err := c.ch.Call(ctx, "pong", in, out) - if err != nil { - return err - } - return nil -} - -func (c *MyServicePrioParentClient) Pong() (error) { - return c.chClient.Pong(context.Background()) -} - -func (c *MyServicePrioParentClient) PongContext(ctx context.Context) (error) { - return c.chClient.Pong(ctx) -} - -type reqMyServicePrioParentPing struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqMyServicePrioParentPing)(nil) - -// Deprecated: MyServicePrioParentPingArgsDeprecated is deprecated, since it is supposed to be internal. -type MyServicePrioParentPingArgsDeprecated = reqMyServicePrioParentPing - -func newReqMyServicePrioParentPing() *reqMyServicePrioParentPing { - return (&reqMyServicePrioParentPing{}).setDefaults() -} - - - -func (x *reqMyServicePrioParentPing) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyServicePrioParentPing"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyServicePrioParentPing) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqMyServicePrioParentPing) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqMyServicePrioParentPing({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyServicePrioParentPing) setDefaults() *reqMyServicePrioParentPing { - return x -} - -type respMyServicePrioParentPing struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyServicePrioParentPing)(nil) -var _ thrift.WritableResult = (*respMyServicePrioParentPing)(nil) - -// Deprecated: MyServicePrioParentPingResultDeprecated is deprecated, since it is supposed to be internal. -type MyServicePrioParentPingResultDeprecated = respMyServicePrioParentPing - -func newRespMyServicePrioParentPing() *respMyServicePrioParentPing { - return (&respMyServicePrioParentPing{}).setDefaults() -} - - - -func (x *respMyServicePrioParentPing) Exception() thrift.WritableException { - return nil -} - -func (x *respMyServicePrioParentPing) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyServicePrioParentPing"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respMyServicePrioParentPing) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respMyServicePrioParentPing) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyServicePrioParentPing({") - sb.WriteString("})") - - return sb.String() -} -func (x *respMyServicePrioParentPing) setDefaults() *respMyServicePrioParentPing { - return x -} - -type reqMyServicePrioParentPong struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqMyServicePrioParentPong)(nil) - -// Deprecated: MyServicePrioParentPongArgsDeprecated is deprecated, since it is supposed to be internal. -type MyServicePrioParentPongArgsDeprecated = reqMyServicePrioParentPong - -func newReqMyServicePrioParentPong() *reqMyServicePrioParentPong { - return (&reqMyServicePrioParentPong{}).setDefaults() -} - - - -func (x *reqMyServicePrioParentPong) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyServicePrioParentPong"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyServicePrioParentPong) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqMyServicePrioParentPong) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqMyServicePrioParentPong({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyServicePrioParentPong) setDefaults() *reqMyServicePrioParentPong { - return x -} - -type respMyServicePrioParentPong struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyServicePrioParentPong)(nil) -var _ thrift.WritableResult = (*respMyServicePrioParentPong)(nil) - -// Deprecated: MyServicePrioParentPongResultDeprecated is deprecated, since it is supposed to be internal. -type MyServicePrioParentPongResultDeprecated = respMyServicePrioParentPong - -func newRespMyServicePrioParentPong() *respMyServicePrioParentPong { - return (&respMyServicePrioParentPong{}).setDefaults() -} - - - -func (x *respMyServicePrioParentPong) Exception() thrift.WritableException { - return nil -} - -func (x *respMyServicePrioParentPong) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyServicePrioParentPong"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respMyServicePrioParentPong) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respMyServicePrioParentPong) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyServicePrioParentPong({") - sb.WriteString("})") - - return sb.String() -} -func (x *respMyServicePrioParentPong) setDefaults() *respMyServicePrioParentPong { - return x -} - - - -type MyServicePrioParentProcessor struct { - processorFunctionMap map[string]thrift.ProcessorFunction - functionServiceMap map[string]string - handler MyServicePrioParent -} -// Compile time interface enforcer -var _ thrift.Processor = (*MyServicePrioParentProcessor)(nil) - -func NewMyServicePrioParentProcessor(handler MyServicePrioParent) *MyServicePrioParentProcessor { - p := &MyServicePrioParentProcessor{ - handler: handler, - processorFunctionMap: make(map[string]thrift.ProcessorFunction), - functionServiceMap: make(map[string]string), - } - p.AddToProcessorFunctionMap("ping", &procFuncMyServicePrioParentPing{handler: handler}) - p.AddToProcessorFunctionMap("pong", &procFuncMyServicePrioParentPong{handler: handler}) - p.AddToFunctionServiceMap("ping", "MyServicePrioParent") - p.AddToFunctionServiceMap("pong", "MyServicePrioParent") - - return p -} - -func (p *MyServicePrioParentProcessor) AddToProcessorFunctionMap(key string, processorFunction thrift.ProcessorFunction) { - p.processorFunctionMap[key] = processorFunction -} - -func (p *MyServicePrioParentProcessor) AddToFunctionServiceMap(key, service string) { - p.functionServiceMap[key] = service -} - -func (p *MyServicePrioParentProcessor) GetProcessorFunction(key string) (processor thrift.ProcessorFunction) { - return p.processorFunctionMap[key] -} - -func (p *MyServicePrioParentProcessor) ProcessorFunctionMap() map[string]thrift.ProcessorFunction { - return p.processorFunctionMap -} - -func (p *MyServicePrioParentProcessor) FunctionServiceMap() map[string]string { - return p.functionServiceMap -} - -func (p *MyServicePrioParentProcessor) GetThriftMetadata() *metadata.ThriftMetadata { - return GetThriftMetadataForService("module.MyServicePrioParent") -} - - -type procFuncMyServicePrioParentPing struct { - handler MyServicePrioParent -} -// Compile time interface enforcer -var _ thrift.ProcessorFunction = (*procFuncMyServicePrioParentPing)(nil) - -func (p *procFuncMyServicePrioParentPing) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { - args := newReqMyServicePrioParentPing() - if err := args.Read(iprot); err != nil { - return nil, err - } - iprot.ReadMessageEnd() - return args, nil -} - -func (p *procFuncMyServicePrioParentPing) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { - var err2 error - messageType := thrift.REPLY - switch result.(type) { - case thrift.ApplicationException: - messageType = thrift.EXCEPTION - } - - if err2 = oprot.WriteMessageBegin("ping", messageType, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - return err -} - -func (p *procFuncMyServicePrioParentPing) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { - result := newRespMyServicePrioParentPing() - err := p.handler.Ping(ctx) - if err != nil { - x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing Ping: " + err.Error(), err) - return x, x - } - - return result, nil -} - - -type procFuncMyServicePrioParentPong struct { - handler MyServicePrioParent -} -// Compile time interface enforcer -var _ thrift.ProcessorFunction = (*procFuncMyServicePrioParentPong)(nil) - -func (p *procFuncMyServicePrioParentPong) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { - args := newReqMyServicePrioParentPong() - if err := args.Read(iprot); err != nil { - return nil, err - } - iprot.ReadMessageEnd() - return args, nil -} - -func (p *procFuncMyServicePrioParentPong) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { - var err2 error - messageType := thrift.REPLY - switch result.(type) { - case thrift.ApplicationException: - messageType = thrift.EXCEPTION - } - - if err2 = oprot.WriteMessageBegin("pong", messageType, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - return err -} - -func (p *procFuncMyServicePrioParentPong) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { - result := newRespMyServicePrioParentPong() - err := p.handler.Pong(ctx) - if err != nil { - x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing Pong: " + err.Error(), err) - return x, x - } - - return result, nil -} - - -type MyServicePrioChild interface { - // Inherited/extended service - MyServicePrioParent - - Pang(ctx context.Context) (error) -} - -type MyServicePrioChildChannelClientInterface interface { - thrift.ClientInterface - MyServicePrioChild -} - -type MyServicePrioChildClientInterface interface { - thrift.ClientInterface - Pang() (error) -} - -type MyServicePrioChildContextClientInterface interface { - MyServicePrioChildClientInterface - // Inherited/extended service - MyServicePrioParentContextClientInterface - - PangContext(ctx context.Context) (error) -} - -type MyServicePrioChildChannelClient struct { - // Inherited/extended service - *MyServicePrioParentChannelClient - ch thrift.RequestChannel -} -// Compile time interface enforcer -var _ MyServicePrioChildChannelClientInterface = (*MyServicePrioChildChannelClient)(nil) - -func NewMyServicePrioChildChannelClient(channel thrift.RequestChannel) *MyServicePrioChildChannelClient { - return &MyServicePrioChildChannelClient{ - MyServicePrioParentChannelClient: NewMyServicePrioParentChannelClient(channel), - ch: channel, - } -} - -func (c *MyServicePrioChildChannelClient) Close() error { - return c.ch.Close() -} - -type MyServicePrioChildClient struct { - // Inherited/extended service - *MyServicePrioParentClient - chClient *MyServicePrioChildChannelClient -} -// Compile time interface enforcer -var _ MyServicePrioChildClientInterface = (*MyServicePrioChildClient)(nil) -var _ MyServicePrioChildContextClientInterface = (*MyServicePrioChildClient)(nil) - -func NewMyServicePrioChildClient(prot thrift.Protocol) *MyServicePrioChildClient { - return &MyServicePrioChildClient{ - MyServicePrioParentClient: NewMyServicePrioParentClient(prot), - chClient: NewMyServicePrioChildChannelClient( - thrift.NewSerialChannel(prot), - ), - } -} - -func (c *MyServicePrioChildClient) Close() error { - return c.chClient.Close() -} - -func (c *MyServicePrioChildChannelClient) Pang(ctx context.Context) (error) { - in := &reqMyServicePrioChildPang{ - } - out := newRespMyServicePrioChildPang() - err := c.ch.Call(ctx, "pang", in, out) - if err != nil { - return err - } - return nil -} - -func (c *MyServicePrioChildClient) Pang() (error) { - return c.chClient.Pang(context.Background()) -} - -func (c *MyServicePrioChildClient) PangContext(ctx context.Context) (error) { - return c.chClient.Pang(ctx) -} -type reqMyServicePrioChildPang struct { +type MyServiceProcessor struct { + processorFunctionMap map[string]thrift.ProcessorFunction + functionServiceMap map[string]string + handler MyService } // Compile time interface enforcer -var _ thrift.Struct = (*reqMyServicePrioChildPang)(nil) - -// Deprecated: MyServicePrioChildPangArgsDeprecated is deprecated, since it is supposed to be internal. -type MyServicePrioChildPangArgsDeprecated = reqMyServicePrioChildPang - -func newReqMyServicePrioChildPang() *reqMyServicePrioChildPang { - return (&reqMyServicePrioChildPang{}).setDefaults() -} - - - -func (x *reqMyServicePrioChildPang) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyServicePrioChildPang"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyServicePrioChildPang) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} +var _ thrift.Processor = (*MyServiceProcessor)(nil) -func (x *reqMyServicePrioChildPang) String() string { - if x == nil { - return "" +func NewMyServiceProcessor(handler MyService) *MyServiceProcessor { + p := &MyServiceProcessor{ + handler: handler, + processorFunctionMap: make(map[string]thrift.ProcessorFunction), + functionServiceMap: make(map[string]string), } + p.AddToProcessorFunctionMap("ping", &procFuncMyServicePing{handler: handler}) + p.AddToProcessorFunctionMap("getRandomData", &procFuncMyServiceGetRandomData{handler: handler}) + p.AddToProcessorFunctionMap("hasDataById", &procFuncMyServiceHasDataById{handler: handler}) + p.AddToProcessorFunctionMap("getDataById", &procFuncMyServiceGoGetDataById{handler: handler}) + p.AddToProcessorFunctionMap("putDataById", &procFuncMyServicePutDataById{handler: handler}) + p.AddToProcessorFunctionMap("lobDataById", &procFuncMyServiceLobDataById{handler: handler}) + p.AddToProcessorFunctionMap("doNothing", &procFuncMyServiceGoDoNothing{handler: handler}) + p.AddToFunctionServiceMap("ping", "MyService") + p.AddToFunctionServiceMap("getRandomData", "MyService") + p.AddToFunctionServiceMap("hasDataById", "MyService") + p.AddToFunctionServiceMap("getDataById", "MyService") + p.AddToFunctionServiceMap("putDataById", "MyService") + p.AddToFunctionServiceMap("lobDataById", "MyService") + p.AddToFunctionServiceMap("doNothing", "MyService") - var sb strings.Builder - - sb.WriteString("reqMyServicePrioChildPang({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyServicePrioChildPang) setDefaults() *reqMyServicePrioChildPang { - return x -} - -type respMyServicePrioChildPang struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyServicePrioChildPang)(nil) -var _ thrift.WritableResult = (*respMyServicePrioChildPang)(nil) - -// Deprecated: MyServicePrioChildPangResultDeprecated is deprecated, since it is supposed to be internal. -type MyServicePrioChildPangResultDeprecated = respMyServicePrioChildPang - -func newRespMyServicePrioChildPang() *respMyServicePrioChildPang { - return (&respMyServicePrioChildPang{}).setDefaults() -} - - - -func (x *respMyServicePrioChildPang) Exception() thrift.WritableException { - return nil + return p } -func (x *respMyServicePrioChildPang) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyServicePrioChildPang"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil +func (p *MyServiceProcessor) AddToProcessorFunctionMap(key string, processorFunction thrift.ProcessorFunction) { + p.processorFunctionMap[key] = processorFunction } -func (x *respMyServicePrioChildPang) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil +func (p *MyServiceProcessor) AddToFunctionServiceMap(key, service string) { + p.functionServiceMap[key] = service } -func (x *respMyServicePrioChildPang) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyServicePrioChildPang({") - sb.WriteString("})") - - return sb.String() -} -func (x *respMyServicePrioChildPang) setDefaults() *respMyServicePrioChildPang { - return x +func (p *MyServiceProcessor) GetProcessorFunction(key string) (processor thrift.ProcessorFunction) { + return p.processorFunctionMap[key] } - - -type MyServicePrioChildProcessor struct { - // Inherited/extended processor - *MyServicePrioParentProcessor +func (p *MyServiceProcessor) ProcessorFunctionMap() map[string]thrift.ProcessorFunction { + return p.processorFunctionMap } -// Compile time interface enforcer -var _ thrift.Processor = (*MyServicePrioChildProcessor)(nil) - -func NewMyServicePrioChildProcessor(handler MyServicePrioChild) *MyServicePrioChildProcessor { - p := &MyServicePrioChildProcessor{ - NewMyServicePrioParentProcessor(handler), - } - p.AddToProcessorFunctionMap("pang", &procFuncMyServicePrioChildPang{handler: handler}) - p.AddToFunctionServiceMap("pang", "MyServicePrioChild") - return p +func (p *MyServiceProcessor) FunctionServiceMap() map[string]string { + return p.functionServiceMap } -func (p *MyServicePrioChildProcessor) GetThriftMetadata() *metadata.ThriftMetadata { - return GetThriftMetadataForService("module.MyServicePrioChild") +func (p *MyServiceProcessor) GetThriftMetadata() *metadata.ThriftMetadata { + return GetThriftMetadataForService("module.MyService") } - -type procFuncMyServicePrioChildPang struct { - handler MyServicePrioChild + +type procFuncMyServicePing struct { + handler MyService } // Compile time interface enforcer -var _ thrift.ProcessorFunction = (*procFuncMyServicePrioChildPang)(nil) +var _ thrift.ProcessorFunction = (*procFuncMyServicePing)(nil) -func (p *procFuncMyServicePrioChildPang) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { - args := newReqMyServicePrioChildPang() +func (p *procFuncMyServicePing) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { + args := newReqMyServicePing() if err := args.Read(iprot); err != nil { return nil, err } @@ -3319,15 +305,19 @@ func (p *procFuncMyServicePrioChildPang) Read(iprot thrift.Decoder) (thrift.Stru return args, nil } -func (p *procFuncMyServicePrioChildPang) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { +func (p *procFuncMyServicePing) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { var err2 error messageType := thrift.REPLY - switch result.(type) { + switch v := result.(type) { + case *MyException: + result = &respMyServicePing{ + MyExcept: v, + } case thrift.ApplicationException: messageType = thrift.EXCEPTION } - if err2 = oprot.WriteMessageBegin("pang", messageType, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin("ping", messageType, seqId); err2 != nil { err = err2 } if err2 = result.Write(oprot); err == nil && err2 != nil { @@ -3342,383 +332,288 @@ func (p *procFuncMyServicePrioChildPang) Write(seqId int32, result thrift.Writab return err } -func (p *procFuncMyServicePrioChildPang) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { - result := newRespMyServicePrioChildPang() - err := p.handler.Pang(ctx) +func (p *procFuncMyServicePing) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { + result := newRespMyServicePing() + err := p.handler.Ping(ctx) if err != nil { - x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing Pang: " + err.Error(), err) - return x, x + switch v := err.(type) { + case *MyException: + result.MyExcept = v + return result, nil + default: + x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing Ping: " + err.Error(), err) + return x, x + } } return result, nil } -type BadService interface { - Bar(ctx context.Context) (int32, error) -} - -type BadServiceChannelClientInterface interface { - thrift.ClientInterface - BadService -} - -type BadServiceClientInterface interface { - thrift.ClientInterface - Bar() (int32, error) -} - -type BadServiceContextClientInterface interface { - BadServiceClientInterface - BarContext(ctx context.Context) (int32, error) -} - -type BadServiceChannelClient struct { - ch thrift.RequestChannel +type procFuncMyServiceGetRandomData struct { + handler MyService } // Compile time interface enforcer -var _ BadServiceChannelClientInterface = (*BadServiceChannelClient)(nil) +var _ thrift.ProcessorFunction = (*procFuncMyServiceGetRandomData)(nil) -func NewBadServiceChannelClient(channel thrift.RequestChannel) *BadServiceChannelClient { - return &BadServiceChannelClient{ - ch: channel, +func (p *procFuncMyServiceGetRandomData) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { + args := newReqMyServiceGetRandomData() + if err := args.Read(iprot); err != nil { + return nil, err } + iprot.ReadMessageEnd() + return args, nil } -func (c *BadServiceChannelClient) Close() error { - return c.ch.Close() -} - -type BadServiceClient struct { - chClient *BadServiceChannelClient -} -// Compile time interface enforcer -var _ BadServiceClientInterface = (*BadServiceClient)(nil) -var _ BadServiceContextClientInterface = (*BadServiceClient)(nil) - -func NewBadServiceClient(prot thrift.Protocol) *BadServiceClient { - return &BadServiceClient{ - chClient: NewBadServiceChannelClient( - thrift.NewSerialChannel(prot), - ), +func (p *procFuncMyServiceGetRandomData) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { + var err2 error + messageType := thrift.REPLY + switch result.(type) { + case thrift.ApplicationException: + messageType = thrift.EXCEPTION } -} -func (c *BadServiceClient) Close() error { - return c.chClient.Close() + if err2 = oprot.WriteMessageBegin("getRandomData", messageType, seqId); err2 != nil { + err = err2 + } + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + return err } -func (c *BadServiceChannelClient) Bar(ctx context.Context) (int32, error) { - in := &reqBadServiceBar{ - } - out := newRespBadServiceBar() - err := c.ch.Call(ctx, "bar", in, out) +func (p *procFuncMyServiceGetRandomData) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { + result := newRespMyServiceGetRandomData() + retval, err := p.handler.GetRandomData(ctx) if err != nil { - return 0, err + x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing GetRandomData: " + err.Error(), err) + return x, x } - return out.GetSuccess(), nil -} -func (c *BadServiceClient) Bar() (int32, error) { - return c.chClient.Bar(context.Background()) + result.Success = &retval + return result, nil } -func (c *BadServiceClient) BarContext(ctx context.Context) (int32, error) { - return c.chClient.Bar(ctx) -} -type reqBadServiceBar struct { +type procFuncMyServiceHasDataById struct { + handler MyService } // Compile time interface enforcer -var _ thrift.Struct = (*reqBadServiceBar)(nil) - -// Deprecated: BadServiceBarArgsDeprecated is deprecated, since it is supposed to be internal. -type BadServiceBarArgsDeprecated = reqBadServiceBar - -func newReqBadServiceBar() *reqBadServiceBar { - return (&reqBadServiceBar{}).setDefaults() -} - - +var _ thrift.ProcessorFunction = (*procFuncMyServiceHasDataById)(nil) -func (x *reqBadServiceBar) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqBadServiceBar"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) +func (p *procFuncMyServiceHasDataById) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { + args := newReqMyServiceHasDataById() + if err := args.Read(iprot); err != nil { + return nil, err } + iprot.ReadMessageEnd() + return args, nil +} - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) +func (p *procFuncMyServiceHasDataById) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { + var err2 error + messageType := thrift.REPLY + switch result.(type) { + case thrift.ApplicationException: + messageType = thrift.EXCEPTION } - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + if err2 = oprot.WriteMessageBegin("hasDataById", messageType, seqId); err2 != nil { + err = err2 } - return nil -} - -func (x *reqBadServiceBar) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 } - - return nil + return err } -func (x *reqBadServiceBar) String() string { - if x == nil { - return "" +func (p *procFuncMyServiceHasDataById) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { + args := reqStruct.(*reqMyServiceHasDataById) + result := newRespMyServiceHasDataById() + retval, err := p.handler.HasDataById(ctx, args.Id) + if err != nil { + x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing HasDataById: " + err.Error(), err) + return x, x } - var sb strings.Builder - - sb.WriteString("reqBadServiceBar({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqBadServiceBar) setDefaults() *reqBadServiceBar { - return x -} - -type respBadServiceBar struct { - Success *int32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` + result.Success = &retval + return result, nil } -// Compile time interface enforcer -var _ thrift.Struct = (*respBadServiceBar)(nil) -var _ thrift.WritableResult = (*respBadServiceBar)(nil) -// Deprecated: BadServiceBarResultDeprecated is deprecated, since it is supposed to be internal. -type BadServiceBarResultDeprecated = respBadServiceBar -func newRespBadServiceBar() *respBadServiceBar { - return (&respBadServiceBar{}).setDefaults() +type procFuncMyServiceGoGetDataById struct { + handler MyService } +// Compile time interface enforcer +var _ thrift.ProcessorFunction = (*procFuncMyServiceGoGetDataById)(nil) -func (x *respBadServiceBar) GetSuccess() int32 { - if !x.IsSetSuccess() { - return 0 +func (p *procFuncMyServiceGoGetDataById) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { + args := newReqMyServiceGoGetDataById() + if err := args.Read(iprot); err != nil { + return nil, err } - return *x.Success -} - -func (x *respBadServiceBar) SetSuccessNonCompat(value int32) *respBadServiceBar { - x.Success = &value - return x -} - -func (x *respBadServiceBar) SetSuccess(value *int32) *respBadServiceBar { - x.Success = value - return x -} - -func (x *respBadServiceBar) IsSetSuccess() bool { - return x != nil && x.Success != nil + iprot.ReadMessageEnd() + return args, nil } -func (x *respBadServiceBar) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil +func (p *procFuncMyServiceGoGetDataById) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { + var err2 error + messageType := thrift.REPLY + switch result.(type) { + case thrift.ApplicationException: + messageType = thrift.EXCEPTION } - if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + if err2 = oprot.WriteMessageBegin("getDataById", messageType, seqId); err2 != nil { + err = err2 } - - item := *x.Success - if err := p.WriteI32(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 } - return nil -} - -func (x *respBadServiceBar) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadI32() -if err != nil { return err } - x.Success = &result - return nil -} - -func (x *respBadServiceBar) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) +func (p *procFuncMyServiceGoGetDataById) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { + args := reqStruct.(*reqMyServiceGoGetDataById) + result := newRespMyServiceGoGetDataById() + retval, err := p.handler.GoGetDataById(ctx, args.Id) + if err != nil { + x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing GoGetDataById: " + err.Error(), err) + return x, x } - return fmt.Sprintf("%v", x.Success) -} - - - -func (x *respBadServiceBar) Exception() thrift.WritableException { - return nil + result.Success = &retval + return result, nil } -func (x *respBadServiceBar) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respBadServiceBar"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } +type procFuncMyServicePutDataById struct { + handler MyService +} +// Compile time interface enforcer +var _ thrift.ProcessorFunction = (*procFuncMyServicePutDataById)(nil) - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) +func (p *procFuncMyServicePutDataById) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { + args := newReqMyServicePutDataById() + if err := args.Read(iprot); err != nil { + return nil, err } - return nil + iprot.ReadMessageEnd() + return args, nil } -func (x *respBadServiceBar) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) +func (p *procFuncMyServicePutDataById) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { + var err2 error + messageType := thrift.REPLY + switch result.(type) { + case thrift.ApplicationException: + messageType = thrift.EXCEPTION } - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.I32)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } + if err2 = oprot.WriteMessageBegin("putDataById", messageType, seqId); err2 != nil { + err = err2 } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 } - - return nil + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + return err } -func (x *respBadServiceBar) String() string { - if x == nil { - return "" +func (p *procFuncMyServicePutDataById) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { + args := reqStruct.(*reqMyServicePutDataById) + result := newRespMyServicePutDataById() + err := p.handler.PutDataById(ctx, args.Id, args.Data) + if err != nil { + x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing PutDataById: " + err.Error(), err) + return x, x } - var sb strings.Builder - - sb.WriteString("respBadServiceBar({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respBadServiceBar) setDefaults() *respBadServiceBar { - return x + return result, nil } - -type BadServiceProcessor struct { - processorFunctionMap map[string]thrift.ProcessorFunction - functionServiceMap map[string]string - handler BadService +type procFuncMyServiceLobDataById struct { + handler MyService } // Compile time interface enforcer -var _ thrift.Processor = (*BadServiceProcessor)(nil) +var _ thrift.ProcessorFunction = (*procFuncMyServiceLobDataById)(nil) -func NewBadServiceProcessor(handler BadService) *BadServiceProcessor { - p := &BadServiceProcessor{ - handler: handler, - processorFunctionMap: make(map[string]thrift.ProcessorFunction), - functionServiceMap: make(map[string]string), +func (p *procFuncMyServiceLobDataById) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { + args := newReqMyServiceLobDataById() + if err := args.Read(iprot); err != nil { + return nil, err } - p.AddToProcessorFunctionMap("bar", &procFuncBadServiceBar{handler: handler}) - p.AddToFunctionServiceMap("bar", "BadService") - - return p -} - -func (p *BadServiceProcessor) AddToProcessorFunctionMap(key string, processorFunction thrift.ProcessorFunction) { - p.processorFunctionMap[key] = processorFunction -} - -func (p *BadServiceProcessor) AddToFunctionServiceMap(key, service string) { - p.functionServiceMap[key] = service + iprot.ReadMessageEnd() + return args, nil } -func (p *BadServiceProcessor) GetProcessorFunction(key string) (processor thrift.ProcessorFunction) { - return p.processorFunctionMap[key] -} +func (p *procFuncMyServiceLobDataById) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { + var err2 error + messageType := thrift.REPLY + switch result.(type) { + case thrift.ApplicationException: + messageType = thrift.EXCEPTION + } -func (p *BadServiceProcessor) ProcessorFunctionMap() map[string]thrift.ProcessorFunction { - return p.processorFunctionMap + if err2 = oprot.WriteMessageBegin("lobDataById", messageType, seqId); err2 != nil { + err = err2 + } + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + return err } -func (p *BadServiceProcessor) FunctionServiceMap() map[string]string { - return p.functionServiceMap -} +func (p *procFuncMyServiceLobDataById) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { + args := reqStruct.(*reqMyServiceLobDataById) + err := p.handler.LobDataById(ctx, args.Id, args.Data) + if err != nil { + x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing LobDataById: " + err.Error(), err) + return x, x + } -func (p *BadServiceProcessor) GetThriftMetadata() *metadata.ThriftMetadata { - return GetThriftMetadataForService("module.BadService") + return nil, nil } -type procFuncBadServiceBar struct { - handler BadService +type procFuncMyServiceGoDoNothing struct { + handler MyService } // Compile time interface enforcer -var _ thrift.ProcessorFunction = (*procFuncBadServiceBar)(nil) +var _ thrift.ProcessorFunction = (*procFuncMyServiceGoDoNothing)(nil) -func (p *procFuncBadServiceBar) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { - args := newReqBadServiceBar() +func (p *procFuncMyServiceGoDoNothing) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { + args := newReqMyServiceGoDoNothing() if err := args.Read(iprot); err != nil { return nil, err } @@ -3726,7 +621,7 @@ func (p *procFuncBadServiceBar) Read(iprot thrift.Decoder) (thrift.Struct, thrif return args, nil } -func (p *procFuncBadServiceBar) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { +func (p *procFuncMyServiceGoDoNothing) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { var err2 error messageType := thrift.REPLY switch result.(type) { @@ -3734,7 +629,7 @@ func (p *procFuncBadServiceBar) Write(seqId int32, result thrift.WritableStruct, messageType = thrift.EXCEPTION } - if err2 = oprot.WriteMessageBegin("bar", messageType, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin("doNothing", messageType, seqId); err2 != nil { err = err2 } if err2 = result.Write(oprot); err == nil && err2 != nil { @@ -3749,649 +644,705 @@ func (p *procFuncBadServiceBar) Write(seqId int32, result thrift.WritableStruct, return err } -func (p *procFuncBadServiceBar) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { - result := newRespBadServiceBar() - retval, err := p.handler.Bar(ctx) +func (p *procFuncMyServiceGoDoNothing) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { + result := newRespMyServiceGoDoNothing() + err := p.handler.GoDoNothing(ctx) if err != nil { - x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing Bar: " + err.Error(), err) + x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing GoDoNothing: " + err.Error(), err) return x, x } - result.Success = &retval return result, nil } -type FooBarBazService interface { - FooStructured(ctx context.Context) (error) - BarNonStructured(ctx context.Context) (error) - Baz(ctx context.Context) (error) +type MyServicePrioParent interface { + Ping(ctx context.Context) (error) + Pong(ctx context.Context) (error) } -type FooBarBazServiceChannelClientInterface interface { +type MyServicePrioParentChannelClientInterface interface { thrift.ClientInterface - FooBarBazService + MyServicePrioParent } -type FooBarBazServiceClientInterface interface { +type MyServicePrioParentClientInterface interface { thrift.ClientInterface - FooStructured() (error) - BarNonStructured() (error) - Baz() (error) + Ping() (error) + Pong() (error) } -type FooBarBazServiceContextClientInterface interface { - FooBarBazServiceClientInterface - FooStructuredContext(ctx context.Context) (error) - BarNonStructuredContext(ctx context.Context) (error) - BazContext(ctx context.Context) (error) +type MyServicePrioParentContextClientInterface interface { + MyServicePrioParentClientInterface + PingContext(ctx context.Context) (error) + PongContext(ctx context.Context) (error) } -type FooBarBazServiceChannelClient struct { +type MyServicePrioParentChannelClient struct { ch thrift.RequestChannel } // Compile time interface enforcer -var _ FooBarBazServiceChannelClientInterface = (*FooBarBazServiceChannelClient)(nil) +var _ MyServicePrioParentChannelClientInterface = (*MyServicePrioParentChannelClient)(nil) -func NewFooBarBazServiceChannelClient(channel thrift.RequestChannel) *FooBarBazServiceChannelClient { - return &FooBarBazServiceChannelClient{ +func NewMyServicePrioParentChannelClient(channel thrift.RequestChannel) *MyServicePrioParentChannelClient { + return &MyServicePrioParentChannelClient{ ch: channel, } } -func (c *FooBarBazServiceChannelClient) Close() error { +func (c *MyServicePrioParentChannelClient) Close() error { return c.ch.Close() } -type FooBarBazServiceClient struct { - chClient *FooBarBazServiceChannelClient +type MyServicePrioParentClient struct { + chClient *MyServicePrioParentChannelClient } // Compile time interface enforcer -var _ FooBarBazServiceClientInterface = (*FooBarBazServiceClient)(nil) -var _ FooBarBazServiceContextClientInterface = (*FooBarBazServiceClient)(nil) +var _ MyServicePrioParentClientInterface = (*MyServicePrioParentClient)(nil) +var _ MyServicePrioParentContextClientInterface = (*MyServicePrioParentClient)(nil) -func NewFooBarBazServiceClient(prot thrift.Protocol) *FooBarBazServiceClient { - return &FooBarBazServiceClient{ - chClient: NewFooBarBazServiceChannelClient( +func NewMyServicePrioParentClient(prot thrift.Protocol) *MyServicePrioParentClient { + return &MyServicePrioParentClient{ + chClient: NewMyServicePrioParentChannelClient( thrift.NewSerialChannel(prot), ), } } -func (c *FooBarBazServiceClient) Close() error { +func (c *MyServicePrioParentClient) Close() error { return c.chClient.Close() } -func (c *FooBarBazServiceChannelClient) FooStructured(ctx context.Context) (error) { - in := &reqFooBarBazServiceFooStructured{ +func (c *MyServicePrioParentChannelClient) Ping(ctx context.Context) (error) { + in := &reqMyServicePrioParentPing{ } - out := newRespFooBarBazServiceFooStructured() - err := c.ch.Call(ctx, "foo", in, out) + out := newRespMyServicePrioParentPing() + err := c.ch.Call(ctx, "ping", in, out) if err != nil { return err } return nil } -func (c *FooBarBazServiceClient) FooStructured() (error) { - return c.chClient.FooStructured(context.Background()) +func (c *MyServicePrioParentClient) Ping() (error) { + return c.chClient.Ping(context.Background()) } -func (c *FooBarBazServiceClient) FooStructuredContext(ctx context.Context) (error) { - return c.chClient.FooStructured(ctx) +func (c *MyServicePrioParentClient) PingContext(ctx context.Context) (error) { + return c.chClient.Ping(ctx) } -func (c *FooBarBazServiceChannelClient) BarNonStructured(ctx context.Context) (error) { - in := &reqFooBarBazServiceBarNonStructured{ +func (c *MyServicePrioParentChannelClient) Pong(ctx context.Context) (error) { + in := &reqMyServicePrioParentPong{ } - out := newRespFooBarBazServiceBarNonStructured() - err := c.ch.Call(ctx, "bar", in, out) + out := newRespMyServicePrioParentPong() + err := c.ch.Call(ctx, "pong", in, out) if err != nil { return err } return nil } -func (c *FooBarBazServiceClient) BarNonStructured() (error) { - return c.chClient.BarNonStructured(context.Background()) +func (c *MyServicePrioParentClient) Pong() (error) { + return c.chClient.Pong(context.Background()) } -func (c *FooBarBazServiceClient) BarNonStructuredContext(ctx context.Context) (error) { - return c.chClient.BarNonStructured(ctx) +func (c *MyServicePrioParentClient) PongContext(ctx context.Context) (error) { + return c.chClient.Pong(ctx) } -func (c *FooBarBazServiceChannelClient) Baz(ctx context.Context) (error) { - in := &reqFooBarBazServiceBaz{ - } - out := newRespFooBarBazServiceBaz() - err := c.ch.Call(ctx, "baz", in, out) - if err != nil { - return err + +type MyServicePrioParentProcessor struct { + processorFunctionMap map[string]thrift.ProcessorFunction + functionServiceMap map[string]string + handler MyServicePrioParent +} +// Compile time interface enforcer +var _ thrift.Processor = (*MyServicePrioParentProcessor)(nil) + +func NewMyServicePrioParentProcessor(handler MyServicePrioParent) *MyServicePrioParentProcessor { + p := &MyServicePrioParentProcessor{ + handler: handler, + processorFunctionMap: make(map[string]thrift.ProcessorFunction), + functionServiceMap: make(map[string]string), } - return nil + p.AddToProcessorFunctionMap("ping", &procFuncMyServicePrioParentPing{handler: handler}) + p.AddToProcessorFunctionMap("pong", &procFuncMyServicePrioParentPong{handler: handler}) + p.AddToFunctionServiceMap("ping", "MyServicePrioParent") + p.AddToFunctionServiceMap("pong", "MyServicePrioParent") + + return p +} + +func (p *MyServicePrioParentProcessor) AddToProcessorFunctionMap(key string, processorFunction thrift.ProcessorFunction) { + p.processorFunctionMap[key] = processorFunction } -func (c *FooBarBazServiceClient) Baz() (error) { - return c.chClient.Baz(context.Background()) +func (p *MyServicePrioParentProcessor) AddToFunctionServiceMap(key, service string) { + p.functionServiceMap[key] = service } -func (c *FooBarBazServiceClient) BazContext(ctx context.Context) (error) { - return c.chClient.Baz(ctx) +func (p *MyServicePrioParentProcessor) GetProcessorFunction(key string) (processor thrift.ProcessorFunction) { + return p.processorFunctionMap[key] } -type reqFooBarBazServiceFooStructured struct { +func (p *MyServicePrioParentProcessor) ProcessorFunctionMap() map[string]thrift.ProcessorFunction { + return p.processorFunctionMap } -// Compile time interface enforcer -var _ thrift.Struct = (*reqFooBarBazServiceFooStructured)(nil) -// Deprecated: FooBarBazServiceFooStructuredArgsDeprecated is deprecated, since it is supposed to be internal. -type FooBarBazServiceFooStructuredArgsDeprecated = reqFooBarBazServiceFooStructured +func (p *MyServicePrioParentProcessor) FunctionServiceMap() map[string]string { + return p.functionServiceMap +} -func newReqFooBarBazServiceFooStructured() *reqFooBarBazServiceFooStructured { - return (&reqFooBarBazServiceFooStructured{}).setDefaults() +func (p *MyServicePrioParentProcessor) GetThriftMetadata() *metadata.ThriftMetadata { + return GetThriftMetadataForService("module.MyServicePrioParent") } +type procFuncMyServicePrioParentPing struct { + handler MyServicePrioParent +} +// Compile time interface enforcer +var _ thrift.ProcessorFunction = (*procFuncMyServicePrioParentPing)(nil) -func (x *reqFooBarBazServiceFooStructured) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqFooBarBazServiceFooStructured"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) +func (p *procFuncMyServicePrioParentPing) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { + args := newReqMyServicePrioParentPing() + if err := args.Read(iprot); err != nil { + return nil, err } + iprot.ReadMessageEnd() + return args, nil +} - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) +func (p *procFuncMyServicePrioParentPing) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { + var err2 error + messageType := thrift.REPLY + switch result.(type) { + case thrift.ApplicationException: + messageType = thrift.EXCEPTION } - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + if err2 = oprot.WriteMessageBegin("ping", messageType, seqId); err2 != nil { + err = err2 } - return nil + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + return err } -func (x *reqFooBarBazServiceFooStructured) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) +func (p *procFuncMyServicePrioParentPing) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { + result := newRespMyServicePrioParentPing() + err := p.handler.Ping(ctx) + if err != nil { + x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing Ping: " + err.Error(), err) + return x, x } - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } + return result, nil +} - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - if fieldReadErr != nil { - return fieldReadErr - } +type procFuncMyServicePrioParentPong struct { + handler MyServicePrioParent +} +// Compile time interface enforcer +var _ thrift.ProcessorFunction = (*procFuncMyServicePrioParentPong)(nil) - if err := p.ReadFieldEnd(); err != nil { - return err - } +func (p *procFuncMyServicePrioParentPong) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { + args := newReqMyServicePrioParentPong() + if err := args.Read(iprot); err != nil { + return nil, err } + iprot.ReadMessageEnd() + return args, nil +} - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) +func (p *procFuncMyServicePrioParentPong) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { + var err2 error + messageType := thrift.REPLY + switch result.(type) { + case thrift.ApplicationException: + messageType = thrift.EXCEPTION } - return nil + if err2 = oprot.WriteMessageBegin("pong", messageType, seqId); err2 != nil { + err = err2 + } + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + return err } -func (x *reqFooBarBazServiceFooStructured) String() string { - if x == nil { - return "" +func (p *procFuncMyServicePrioParentPong) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { + result := newRespMyServicePrioParentPong() + err := p.handler.Pong(ctx) + if err != nil { + x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing Pong: " + err.Error(), err) + return x, x } - var sb strings.Builder + return result, nil +} - sb.WriteString("reqFooBarBazServiceFooStructured({") - sb.WriteString("})") - return sb.String() -} -func (x *reqFooBarBazServiceFooStructured) setDefaults() *reqFooBarBazServiceFooStructured { - return x -} +type MyServicePrioChild interface { + // Inherited/extended service + MyServicePrioParent -type respFooBarBazServiceFooStructured struct { + Pang(ctx context.Context) (error) } -// Compile time interface enforcer -var _ thrift.Struct = (*respFooBarBazServiceFooStructured)(nil) -var _ thrift.WritableResult = (*respFooBarBazServiceFooStructured)(nil) -// Deprecated: FooBarBazServiceFooStructuredResultDeprecated is deprecated, since it is supposed to be internal. -type FooBarBazServiceFooStructuredResultDeprecated = respFooBarBazServiceFooStructured +type MyServicePrioChildChannelClientInterface interface { + thrift.ClientInterface + MyServicePrioChild +} -func newRespFooBarBazServiceFooStructured() *respFooBarBazServiceFooStructured { - return (&respFooBarBazServiceFooStructured{}).setDefaults() +type MyServicePrioChildClientInterface interface { + thrift.ClientInterface + Pang() (error) } +type MyServicePrioChildContextClientInterface interface { + MyServicePrioChildClientInterface + // Inherited/extended service + MyServicePrioParentContextClientInterface + PangContext(ctx context.Context) (error) +} -func (x *respFooBarBazServiceFooStructured) Exception() thrift.WritableException { - return nil +type MyServicePrioChildChannelClient struct { + // Inherited/extended service + *MyServicePrioParentChannelClient + ch thrift.RequestChannel } +// Compile time interface enforcer +var _ MyServicePrioChildChannelClientInterface = (*MyServicePrioChildChannelClient)(nil) -func (x *respFooBarBazServiceFooStructured) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respFooBarBazServiceFooStructured"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) +func NewMyServicePrioChildChannelClient(channel thrift.RequestChannel) *MyServicePrioChildChannelClient { + return &MyServicePrioChildChannelClient{ + MyServicePrioParentChannelClient: NewMyServicePrioParentChannelClient(channel), + ch: channel, } +} +func (c *MyServicePrioChildChannelClient) Close() error { + return c.ch.Close() +} - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil +type MyServicePrioChildClient struct { + // Inherited/extended service + *MyServicePrioParentClient + chClient *MyServicePrioChildChannelClient } +// Compile time interface enforcer +var _ MyServicePrioChildClientInterface = (*MyServicePrioChildClient)(nil) +var _ MyServicePrioChildContextClientInterface = (*MyServicePrioChildClient)(nil) -func (x *respFooBarBazServiceFooStructured) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) +func NewMyServicePrioChildClient(prot thrift.Protocol) *MyServicePrioChildClient { + return &MyServicePrioChildClient{ + MyServicePrioParentClient: NewMyServicePrioParentClient(prot), + chClient: NewMyServicePrioChildChannelClient( + thrift.NewSerialChannel(prot), + ), } +} - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } +func (c *MyServicePrioChildClient) Close() error { + return c.chClient.Close() +} - if err := p.ReadFieldEnd(); err != nil { - return err - } +func (c *MyServicePrioChildChannelClient) Pang(ctx context.Context) (error) { + in := &reqMyServicePrioChildPang{ } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + out := newRespMyServicePrioChildPang() + err := c.ch.Call(ctx, "pang", in, out) + if err != nil { + return err } - return nil } -func (x *respFooBarBazServiceFooStructured) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respFooBarBazServiceFooStructured({") - sb.WriteString("})") - - return sb.String() -} -func (x *respFooBarBazServiceFooStructured) setDefaults() *respFooBarBazServiceFooStructured { - return x +func (c *MyServicePrioChildClient) Pang() (error) { + return c.chClient.Pang(context.Background()) } -type reqFooBarBazServiceBarNonStructured struct { +func (c *MyServicePrioChildClient) PangContext(ctx context.Context) (error) { + return c.chClient.Pang(ctx) } -// Compile time interface enforcer -var _ thrift.Struct = (*reqFooBarBazServiceBarNonStructured)(nil) -// Deprecated: FooBarBazServiceBarNonStructuredArgsDeprecated is deprecated, since it is supposed to be internal. -type FooBarBazServiceBarNonStructuredArgsDeprecated = reqFooBarBazServiceBarNonStructured -func newReqFooBarBazServiceBarNonStructured() *reqFooBarBazServiceBarNonStructured { - return (&reqFooBarBazServiceBarNonStructured{}).setDefaults() +type MyServicePrioChildProcessor struct { + // Inherited/extended processor + *MyServicePrioParentProcessor } +// Compile time interface enforcer +var _ thrift.Processor = (*MyServicePrioChildProcessor)(nil) +func NewMyServicePrioChildProcessor(handler MyServicePrioChild) *MyServicePrioChildProcessor { + p := &MyServicePrioChildProcessor{ + NewMyServicePrioParentProcessor(handler), + } + p.AddToProcessorFunctionMap("pang", &procFuncMyServicePrioChildPang{handler: handler}) + p.AddToFunctionServiceMap("pang", "MyServicePrioChild") + return p +} -func (x *reqFooBarBazServiceBarNonStructured) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqFooBarBazServiceBarNonStructured"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } +func (p *MyServicePrioChildProcessor) GetThriftMetadata() *metadata.ThriftMetadata { + return GetThriftMetadataForService("module.MyServicePrioChild") +} - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } +type procFuncMyServicePrioChildPang struct { + handler MyServicePrioChild +} +// Compile time interface enforcer +var _ thrift.ProcessorFunction = (*procFuncMyServicePrioChildPang)(nil) - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) +func (p *procFuncMyServicePrioChildPang) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { + args := newReqMyServicePrioChildPang() + if err := args.Read(iprot); err != nil { + return nil, err } - return nil + iprot.ReadMessageEnd() + return args, nil } -func (x *reqFooBarBazServiceBarNonStructured) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) +func (p *procFuncMyServicePrioChildPang) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { + var err2 error + messageType := thrift.REPLY + switch result.(type) { + case thrift.ApplicationException: + messageType = thrift.EXCEPTION } - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } + if err2 = oprot.WriteMessageBegin("pang", messageType, seqId); err2 != nil { + err = err2 } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 } - - return nil + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } + return err } -func (x *reqFooBarBazServiceBarNonStructured) String() string { - if x == nil { - return "" +func (p *procFuncMyServicePrioChildPang) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { + result := newRespMyServicePrioChildPang() + err := p.handler.Pang(ctx) + if err != nil { + x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing Pang: " + err.Error(), err) + return x, x } - var sb strings.Builder + return result, nil +} - sb.WriteString("reqFooBarBazServiceBarNonStructured({") - sb.WriteString("})") - return sb.String() +type BadService interface { + Bar(ctx context.Context) (int32, error) } -func (x *reqFooBarBazServiceBarNonStructured) setDefaults() *reqFooBarBazServiceBarNonStructured { - return x + +type BadServiceChannelClientInterface interface { + thrift.ClientInterface + BadService } -type respFooBarBazServiceBarNonStructured struct { +type BadServiceClientInterface interface { + thrift.ClientInterface + Bar() (int32, error) } -// Compile time interface enforcer -var _ thrift.Struct = (*respFooBarBazServiceBarNonStructured)(nil) -var _ thrift.WritableResult = (*respFooBarBazServiceBarNonStructured)(nil) -// Deprecated: FooBarBazServiceBarNonStructuredResultDeprecated is deprecated, since it is supposed to be internal. -type FooBarBazServiceBarNonStructuredResultDeprecated = respFooBarBazServiceBarNonStructured +type BadServiceContextClientInterface interface { + BadServiceClientInterface + BarContext(ctx context.Context) (int32, error) +} -func newRespFooBarBazServiceBarNonStructured() *respFooBarBazServiceBarNonStructured { - return (&respFooBarBazServiceBarNonStructured{}).setDefaults() +type BadServiceChannelClient struct { + ch thrift.RequestChannel } +// Compile time interface enforcer +var _ BadServiceChannelClientInterface = (*BadServiceChannelClient)(nil) +func NewBadServiceChannelClient(channel thrift.RequestChannel) *BadServiceChannelClient { + return &BadServiceChannelClient{ + ch: channel, + } +} +func (c *BadServiceChannelClient) Close() error { + return c.ch.Close() +} -func (x *respFooBarBazServiceBarNonStructured) Exception() thrift.WritableException { - return nil +type BadServiceClient struct { + chClient *BadServiceChannelClient } +// Compile time interface enforcer +var _ BadServiceClientInterface = (*BadServiceClient)(nil) +var _ BadServiceContextClientInterface = (*BadServiceClient)(nil) -func (x *respFooBarBazServiceBarNonStructured) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respFooBarBazServiceBarNonStructured"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) +func NewBadServiceClient(prot thrift.Protocol) *BadServiceClient { + return &BadServiceClient{ + chClient: NewBadServiceChannelClient( + thrift.NewSerialChannel(prot), + ), } +} +func (c *BadServiceClient) Close() error { + return c.chClient.Close() +} - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) +func (c *BadServiceChannelClient) Bar(ctx context.Context) (int32, error) { + in := &reqBadServiceBar{ } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + out := newRespBadServiceBar() + err := c.ch.Call(ctx, "bar", in, out) + if err != nil { + return 0, err } - return nil + return out.GetSuccess(), nil } -func (x *respFooBarBazServiceBarNonStructured) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } +func (c *BadServiceClient) Bar() (int32, error) { + return c.chClient.Bar(context.Background()) +} - if err := p.ReadFieldEnd(); err != nil { - return err - } - } +func (c *BadServiceClient) BarContext(ctx context.Context) (int32, error) { + return c.chClient.Bar(ctx) +} - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - return nil +type BadServiceProcessor struct { + processorFunctionMap map[string]thrift.ProcessorFunction + functionServiceMap map[string]string + handler BadService } +// Compile time interface enforcer +var _ thrift.Processor = (*BadServiceProcessor)(nil) -func (x *respFooBarBazServiceBarNonStructured) String() string { - if x == nil { - return "" +func NewBadServiceProcessor(handler BadService) *BadServiceProcessor { + p := &BadServiceProcessor{ + handler: handler, + processorFunctionMap: make(map[string]thrift.ProcessorFunction), + functionServiceMap: make(map[string]string), } + p.AddToProcessorFunctionMap("bar", &procFuncBadServiceBar{handler: handler}) + p.AddToFunctionServiceMap("bar", "BadService") - var sb strings.Builder + return p +} - sb.WriteString("respFooBarBazServiceBarNonStructured({") - sb.WriteString("})") +func (p *BadServiceProcessor) AddToProcessorFunctionMap(key string, processorFunction thrift.ProcessorFunction) { + p.processorFunctionMap[key] = processorFunction +} - return sb.String() +func (p *BadServiceProcessor) AddToFunctionServiceMap(key, service string) { + p.functionServiceMap[key] = service } -func (x *respFooBarBazServiceBarNonStructured) setDefaults() *respFooBarBazServiceBarNonStructured { - return x + +func (p *BadServiceProcessor) GetProcessorFunction(key string) (processor thrift.ProcessorFunction) { + return p.processorFunctionMap[key] } -type reqFooBarBazServiceBaz struct { +func (p *BadServiceProcessor) ProcessorFunctionMap() map[string]thrift.ProcessorFunction { + return p.processorFunctionMap } -// Compile time interface enforcer -var _ thrift.Struct = (*reqFooBarBazServiceBaz)(nil) -// Deprecated: FooBarBazServiceBazArgsDeprecated is deprecated, since it is supposed to be internal. -type FooBarBazServiceBazArgsDeprecated = reqFooBarBazServiceBaz +func (p *BadServiceProcessor) FunctionServiceMap() map[string]string { + return p.functionServiceMap +} -func newReqFooBarBazServiceBaz() *reqFooBarBazServiceBaz { - return (&reqFooBarBazServiceBaz{}).setDefaults() +func (p *BadServiceProcessor) GetThriftMetadata() *metadata.ThriftMetadata { + return GetThriftMetadataForService("module.BadService") } +type procFuncBadServiceBar struct { + handler BadService +} +// Compile time interface enforcer +var _ thrift.ProcessorFunction = (*procFuncBadServiceBar)(nil) -func (x *reqFooBarBazServiceBaz) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqFooBarBazServiceBaz"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) +func (p *procFuncBadServiceBar) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { + args := newReqBadServiceBar() + if err := args.Read(iprot); err != nil { + return nil, err } + iprot.ReadMessageEnd() + return args, nil +} - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) +func (p *procFuncBadServiceBar) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { + var err2 error + messageType := thrift.REPLY + switch result.(type) { + case thrift.ApplicationException: + messageType = thrift.EXCEPTION } - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + if err2 = oprot.WriteMessageBegin("bar", messageType, seqId); err2 != nil { + err = err2 } - return nil -} - -func (x *reqFooBarBazServiceBaz) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 } - - return nil + return err } -func (x *reqFooBarBazServiceBaz) String() string { - if x == nil { - return "" +func (p *procFuncBadServiceBar) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { + result := newRespBadServiceBar() + retval, err := p.handler.Bar(ctx) + if err != nil { + x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing Bar: " + err.Error(), err) + return x, x } - var sb strings.Builder + result.Success = &retval + return result, nil +} - sb.WriteString("reqFooBarBazServiceBaz({") - sb.WriteString("})") - return sb.String() +type FooBarBazService interface { + FooStructured(ctx context.Context) (error) + BarNonStructured(ctx context.Context) (error) + Baz(ctx context.Context) (error) } -func (x *reqFooBarBazServiceBaz) setDefaults() *reqFooBarBazServiceBaz { - return x + +type FooBarBazServiceChannelClientInterface interface { + thrift.ClientInterface + FooBarBazService } -type respFooBarBazServiceBaz struct { +type FooBarBazServiceClientInterface interface { + thrift.ClientInterface + FooStructured() (error) + BarNonStructured() (error) + Baz() (error) } -// Compile time interface enforcer -var _ thrift.Struct = (*respFooBarBazServiceBaz)(nil) -var _ thrift.WritableResult = (*respFooBarBazServiceBaz)(nil) -// Deprecated: FooBarBazServiceBazResultDeprecated is deprecated, since it is supposed to be internal. -type FooBarBazServiceBazResultDeprecated = respFooBarBazServiceBaz +type FooBarBazServiceContextClientInterface interface { + FooBarBazServiceClientInterface + FooStructuredContext(ctx context.Context) (error) + BarNonStructuredContext(ctx context.Context) (error) + BazContext(ctx context.Context) (error) +} -func newRespFooBarBazServiceBaz() *respFooBarBazServiceBaz { - return (&respFooBarBazServiceBaz{}).setDefaults() +type FooBarBazServiceChannelClient struct { + ch thrift.RequestChannel } +// Compile time interface enforcer +var _ FooBarBazServiceChannelClientInterface = (*FooBarBazServiceChannelClient)(nil) +func NewFooBarBazServiceChannelClient(channel thrift.RequestChannel) *FooBarBazServiceChannelClient { + return &FooBarBazServiceChannelClient{ + ch: channel, + } +} +func (c *FooBarBazServiceChannelClient) Close() error { + return c.ch.Close() +} -func (x *respFooBarBazServiceBaz) Exception() thrift.WritableException { - return nil +type FooBarBazServiceClient struct { + chClient *FooBarBazServiceChannelClient } +// Compile time interface enforcer +var _ FooBarBazServiceClientInterface = (*FooBarBazServiceClient)(nil) +var _ FooBarBazServiceContextClientInterface = (*FooBarBazServiceClient)(nil) -func (x *respFooBarBazServiceBaz) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respFooBarBazServiceBaz"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) +func NewFooBarBazServiceClient(prot thrift.Protocol) *FooBarBazServiceClient { + return &FooBarBazServiceClient{ + chClient: NewFooBarBazServiceChannelClient( + thrift.NewSerialChannel(prot), + ), } +} +func (c *FooBarBazServiceClient) Close() error { + return c.chClient.Close() +} - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) +func (c *FooBarBazServiceChannelClient) FooStructured(ctx context.Context) (error) { + in := &reqFooBarBazServiceFooStructured{ } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + out := newRespFooBarBazServiceFooStructured() + err := c.ch.Call(ctx, "foo", in, out) + if err != nil { + return err } return nil } -func (x *respFooBarBazServiceBaz) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } +func (c *FooBarBazServiceClient) FooStructured() (error) { + return c.chClient.FooStructured(context.Background()) +} - if fieldReadErr != nil { - return fieldReadErr - } +func (c *FooBarBazServiceClient) FooStructuredContext(ctx context.Context) (error) { + return c.chClient.FooStructured(ctx) +} - if err := p.ReadFieldEnd(); err != nil { - return err - } +func (c *FooBarBazServiceChannelClient) BarNonStructured(ctx context.Context) (error) { + in := &reqFooBarBazServiceBarNonStructured{ } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + out := newRespFooBarBazServiceBarNonStructured() + err := c.ch.Call(ctx, "bar", in, out) + if err != nil { + return err } - return nil } -func (x *respFooBarBazServiceBaz) String() string { - if x == nil { - return "" - } - - var sb strings.Builder +func (c *FooBarBazServiceClient) BarNonStructured() (error) { + return c.chClient.BarNonStructured(context.Background()) +} - sb.WriteString("respFooBarBazServiceBaz({") - sb.WriteString("})") +func (c *FooBarBazServiceClient) BarNonStructuredContext(ctx context.Context) (error) { + return c.chClient.BarNonStructured(ctx) +} - return sb.String() +func (c *FooBarBazServiceChannelClient) Baz(ctx context.Context) (error) { + in := &reqFooBarBazServiceBaz{ + } + out := newRespFooBarBazServiceBaz() + err := c.ch.Call(ctx, "baz", in, out) + if err != nil { + return err + } + return nil } -func (x *respFooBarBazServiceBaz) setDefaults() *respFooBarBazServiceBaz { - return x + +func (c *FooBarBazServiceClient) Baz() (error) { + return c.chClient.Baz(context.Background()) } +func (c *FooBarBazServiceClient) BazContext(ctx context.Context) (error) { + return c.chClient.Baz(ctx) +} type FooBarBazServiceProcessor struct { diff --git a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/module/types.go b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/module/types.go index 6e5063a0b45..701ddf6f45d 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/module/types.go +++ b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/module/types.go @@ -1240,6 +1240,3052 @@ func (x *SecretStruct) setDefaults() *SecretStruct { } +// Service req/resp structs (below) +type reqMyServicePing struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyServicePing)(nil) + +// Deprecated: MyServicePingArgsDeprecated is deprecated, since it is supposed to be internal. +type MyServicePingArgsDeprecated = reqMyServicePing + +func newReqMyServicePing() *reqMyServicePing { + return (&reqMyServicePing{}).setDefaults() +} + + + +func (x *reqMyServicePing) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyServicePing"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyServicePing) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyServicePing) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyServicePing({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyServicePing) setDefaults() *reqMyServicePing { + return x +} + +type respMyServicePing struct { + MyExcept *MyException `thrift:"myExcept,1,optional" json:"myExcept,omitempty" db:"myExcept"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyServicePing)(nil) +var _ thrift.WritableResult = (*respMyServicePing)(nil) + +// Deprecated: MyServicePingResultDeprecated is deprecated, since it is supposed to be internal. +type MyServicePingResultDeprecated = respMyServicePing + +func newRespMyServicePing() *respMyServicePing { + return (&respMyServicePing{}).setDefaults() +} + +func (x *respMyServicePing) GetMyExcept() *MyException { + if !x.IsSetMyExcept() { + return nil + } + return x.MyExcept +} + +func (x *respMyServicePing) SetMyExceptNonCompat(value *MyException) *respMyServicePing { + x.MyExcept = value + return x +} + +func (x *respMyServicePing) SetMyExcept(value *MyException) *respMyServicePing { + x.MyExcept = value + return x +} + +func (x *respMyServicePing) IsSetMyExcept() bool { + return x != nil && x.MyExcept != nil +} + +func (x *respMyServicePing) writeField1(p thrift.Encoder) error { // MyExcept + if !x.IsSetMyExcept() { + return nil + } + + if err := p.WriteFieldBegin("myExcept", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.MyExcept + if err := item.Write(p); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respMyServicePing) readField1(p thrift.Decoder) error { // MyExcept + result := NewMyException() +err := result.Read(p) +if err != nil { + return err +} + + x.MyExcept = result + return nil +} + +func (x *respMyServicePing) toString1() string { // MyExcept + return fmt.Sprintf("%v", x.MyExcept) +} + +// Deprecated: Use newRespMyServicePing().GetMyExcept() instead. +func (x *respMyServicePing) DefaultGetMyExcept() *MyException { + if !x.IsSetMyExcept() { + return NewMyException() + } + return x.MyExcept +} + + + +func (x *respMyServicePing) Exception() thrift.WritableException { + if x.MyExcept != nil { + return x.MyExcept + } + return nil +} + +func (x *respMyServicePing) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyServicePing"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyServicePing) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.STRUCT)): // myExcept + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyServicePing) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyServicePing({") + sb.WriteString(fmt.Sprintf("MyExcept:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *respMyServicePing) setDefaults() *respMyServicePing { + return x +} + +type reqMyServiceGetRandomData struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyServiceGetRandomData)(nil) + +// Deprecated: MyServiceGetRandomDataArgsDeprecated is deprecated, since it is supposed to be internal. +type MyServiceGetRandomDataArgsDeprecated = reqMyServiceGetRandomData + +func newReqMyServiceGetRandomData() *reqMyServiceGetRandomData { + return (&reqMyServiceGetRandomData{}).setDefaults() +} + + + +func (x *reqMyServiceGetRandomData) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyServiceGetRandomData"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceGetRandomData) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyServiceGetRandomData) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyServiceGetRandomData({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyServiceGetRandomData) setDefaults() *reqMyServiceGetRandomData { + return x +} + +type respMyServiceGetRandomData struct { + Success *string `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyServiceGetRandomData)(nil) +var _ thrift.WritableResult = (*respMyServiceGetRandomData)(nil) + +// Deprecated: MyServiceGetRandomDataResultDeprecated is deprecated, since it is supposed to be internal. +type MyServiceGetRandomDataResultDeprecated = respMyServiceGetRandomData + +func newRespMyServiceGetRandomData() *respMyServiceGetRandomData { + return (&respMyServiceGetRandomData{}).setDefaults() +} + +func (x *respMyServiceGetRandomData) GetSuccess() string { + if !x.IsSetSuccess() { + return "" + } + return *x.Success +} + +func (x *respMyServiceGetRandomData) SetSuccessNonCompat(value string) *respMyServiceGetRandomData { + x.Success = &value + return x +} + +func (x *respMyServiceGetRandomData) SetSuccess(value *string) *respMyServiceGetRandomData { + x.Success = value + return x +} + +func (x *respMyServiceGetRandomData) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respMyServiceGetRandomData) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.STRING, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteString(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respMyServiceGetRandomData) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadString() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respMyServiceGetRandomData) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respMyServiceGetRandomData) Exception() thrift.WritableException { + return nil +} + +func (x *respMyServiceGetRandomData) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyServiceGetRandomData"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyServiceGetRandomData) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.STRING)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyServiceGetRandomData) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyServiceGetRandomData({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respMyServiceGetRandomData) setDefaults() *respMyServiceGetRandomData { + return x +} + +type reqMyServiceHasDataById struct { + Id int64 `thrift:"id,1" json:"id" db:"id"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyServiceHasDataById)(nil) + +// Deprecated: MyServiceHasDataByIdArgsDeprecated is deprecated, since it is supposed to be internal. +type MyServiceHasDataByIdArgsDeprecated = reqMyServiceHasDataById + +func newReqMyServiceHasDataById() *reqMyServiceHasDataById { + return (&reqMyServiceHasDataById{}).setDefaults() +} + +func (x *reqMyServiceHasDataById) GetId() int64 { + return x.Id +} + +func (x *reqMyServiceHasDataById) SetIdNonCompat(value int64) *reqMyServiceHasDataById { + x.Id = value + return x +} + +func (x *reqMyServiceHasDataById) SetId(value int64) *reqMyServiceHasDataById { + x.Id = value + return x +} + +func (x *reqMyServiceHasDataById) writeField1(p thrift.Encoder) error { // Id + if err := p.WriteFieldBegin("id", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Id + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceHasDataById) readField1(p thrift.Decoder) error { // Id + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Id = result + return nil +} + +func (x *reqMyServiceHasDataById) toString1() string { // Id + return fmt.Sprintf("%v", x.Id) +} + + + +func (x *reqMyServiceHasDataById) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyServiceHasDataById"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceHasDataById) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // id + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyServiceHasDataById) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyServiceHasDataById({") + sb.WriteString(fmt.Sprintf("Id:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyServiceHasDataById) setDefaults() *reqMyServiceHasDataById { + return x. + SetIdNonCompat(0) +} + +type respMyServiceHasDataById struct { + Success *bool `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyServiceHasDataById)(nil) +var _ thrift.WritableResult = (*respMyServiceHasDataById)(nil) + +// Deprecated: MyServiceHasDataByIdResultDeprecated is deprecated, since it is supposed to be internal. +type MyServiceHasDataByIdResultDeprecated = respMyServiceHasDataById + +func newRespMyServiceHasDataById() *respMyServiceHasDataById { + return (&respMyServiceHasDataById{}).setDefaults() +} + +func (x *respMyServiceHasDataById) GetSuccess() bool { + if !x.IsSetSuccess() { + return false + } + return *x.Success +} + +func (x *respMyServiceHasDataById) SetSuccessNonCompat(value bool) *respMyServiceHasDataById { + x.Success = &value + return x +} + +func (x *respMyServiceHasDataById) SetSuccess(value *bool) *respMyServiceHasDataById { + x.Success = value + return x +} + +func (x *respMyServiceHasDataById) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respMyServiceHasDataById) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.BOOL, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteBool(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respMyServiceHasDataById) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadBool() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respMyServiceHasDataById) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respMyServiceHasDataById) Exception() thrift.WritableException { + return nil +} + +func (x *respMyServiceHasDataById) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyServiceHasDataById"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyServiceHasDataById) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.BOOL)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyServiceHasDataById) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyServiceHasDataById({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respMyServiceHasDataById) setDefaults() *respMyServiceHasDataById { + return x +} + +type reqMyServiceGoGetDataById struct { + Id int64 `thrift:"id,1" json:"id" db:"id"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyServiceGoGetDataById)(nil) + +// Deprecated: MyServiceGoGetDataByIdArgsDeprecated is deprecated, since it is supposed to be internal. +type MyServiceGoGetDataByIdArgsDeprecated = reqMyServiceGoGetDataById + +func newReqMyServiceGoGetDataById() *reqMyServiceGoGetDataById { + return (&reqMyServiceGoGetDataById{}).setDefaults() +} + +func (x *reqMyServiceGoGetDataById) GetId() int64 { + return x.Id +} + +func (x *reqMyServiceGoGetDataById) SetIdNonCompat(value int64) *reqMyServiceGoGetDataById { + x.Id = value + return x +} + +func (x *reqMyServiceGoGetDataById) SetId(value int64) *reqMyServiceGoGetDataById { + x.Id = value + return x +} + +func (x *reqMyServiceGoGetDataById) writeField1(p thrift.Encoder) error { // Id + if err := p.WriteFieldBegin("id", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Id + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceGoGetDataById) readField1(p thrift.Decoder) error { // Id + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Id = result + return nil +} + +func (x *reqMyServiceGoGetDataById) toString1() string { // Id + return fmt.Sprintf("%v", x.Id) +} + + + +func (x *reqMyServiceGoGetDataById) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyServiceGoGetDataById"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceGoGetDataById) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // id + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyServiceGoGetDataById) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyServiceGoGetDataById({") + sb.WriteString(fmt.Sprintf("Id:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyServiceGoGetDataById) setDefaults() *reqMyServiceGoGetDataById { + return x. + SetIdNonCompat(0) +} + +type respMyServiceGoGetDataById struct { + Success *string `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyServiceGoGetDataById)(nil) +var _ thrift.WritableResult = (*respMyServiceGoGetDataById)(nil) + +// Deprecated: MyServiceGoGetDataByIdResultDeprecated is deprecated, since it is supposed to be internal. +type MyServiceGoGetDataByIdResultDeprecated = respMyServiceGoGetDataById + +func newRespMyServiceGoGetDataById() *respMyServiceGoGetDataById { + return (&respMyServiceGoGetDataById{}).setDefaults() +} + +func (x *respMyServiceGoGetDataById) GetSuccess() string { + if !x.IsSetSuccess() { + return "" + } + return *x.Success +} + +func (x *respMyServiceGoGetDataById) SetSuccessNonCompat(value string) *respMyServiceGoGetDataById { + x.Success = &value + return x +} + +func (x *respMyServiceGoGetDataById) SetSuccess(value *string) *respMyServiceGoGetDataById { + x.Success = value + return x +} + +func (x *respMyServiceGoGetDataById) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respMyServiceGoGetDataById) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.STRING, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteString(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respMyServiceGoGetDataById) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadString() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respMyServiceGoGetDataById) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respMyServiceGoGetDataById) Exception() thrift.WritableException { + return nil +} + +func (x *respMyServiceGoGetDataById) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyServiceGoGetDataById"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyServiceGoGetDataById) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.STRING)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyServiceGoGetDataById) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyServiceGoGetDataById({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respMyServiceGoGetDataById) setDefaults() *respMyServiceGoGetDataById { + return x +} + +type reqMyServicePutDataById struct { + Id int64 `thrift:"id,1" json:"id" db:"id"` + Data string `thrift:"data,2" json:"data" db:"data"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyServicePutDataById)(nil) + +// Deprecated: MyServicePutDataByIdArgsDeprecated is deprecated, since it is supposed to be internal. +type MyServicePutDataByIdArgsDeprecated = reqMyServicePutDataById + +func newReqMyServicePutDataById() *reqMyServicePutDataById { + return (&reqMyServicePutDataById{}).setDefaults() +} + +func (x *reqMyServicePutDataById) GetId() int64 { + return x.Id +} + +func (x *reqMyServicePutDataById) GetData() string { + return x.Data +} + +func (x *reqMyServicePutDataById) SetIdNonCompat(value int64) *reqMyServicePutDataById { + x.Id = value + return x +} + +func (x *reqMyServicePutDataById) SetId(value int64) *reqMyServicePutDataById { + x.Id = value + return x +} + +func (x *reqMyServicePutDataById) SetDataNonCompat(value string) *reqMyServicePutDataById { + x.Data = value + return x +} + +func (x *reqMyServicePutDataById) SetData(value string) *reqMyServicePutDataById { + x.Data = value + return x +} + +func (x *reqMyServicePutDataById) writeField1(p thrift.Encoder) error { // Id + if err := p.WriteFieldBegin("id", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Id + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqMyServicePutDataById) writeField2(p thrift.Encoder) error { // Data + if err := p.WriteFieldBegin("data", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Data + if err := p.WriteString(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqMyServicePutDataById) readField1(p thrift.Decoder) error { // Id + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Id = result + return nil +} + +func (x *reqMyServicePutDataById) readField2(p thrift.Decoder) error { // Data + result, err := p.ReadString() +if err != nil { + return err +} + + x.Data = result + return nil +} + +func (x *reqMyServicePutDataById) toString1() string { // Id + return fmt.Sprintf("%v", x.Id) +} + +func (x *reqMyServicePutDataById) toString2() string { // Data + return fmt.Sprintf("%v", x.Data) +} + + + +func (x *reqMyServicePutDataById) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyServicePutDataById"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + if err := x.writeField2(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyServicePutDataById) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // id + fieldReadErr = x.readField1(p) + case (id == 2 && wireType == thrift.Type(thrift.STRING)): // data + fieldReadErr = x.readField2(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyServicePutDataById) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyServicePutDataById({") + sb.WriteString(fmt.Sprintf("Id:%s ", x.toString1())) + sb.WriteString(fmt.Sprintf("Data:%s", x.toString2())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyServicePutDataById) setDefaults() *reqMyServicePutDataById { + return x. + SetIdNonCompat(0). + SetDataNonCompat("") +} + +type respMyServicePutDataById struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyServicePutDataById)(nil) +var _ thrift.WritableResult = (*respMyServicePutDataById)(nil) + +// Deprecated: MyServicePutDataByIdResultDeprecated is deprecated, since it is supposed to be internal. +type MyServicePutDataByIdResultDeprecated = respMyServicePutDataById + +func newRespMyServicePutDataById() *respMyServicePutDataById { + return (&respMyServicePutDataById{}).setDefaults() +} + + + +func (x *respMyServicePutDataById) Exception() thrift.WritableException { + return nil +} + +func (x *respMyServicePutDataById) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyServicePutDataById"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyServicePutDataById) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyServicePutDataById) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyServicePutDataById({") + sb.WriteString("})") + + return sb.String() +} +func (x *respMyServicePutDataById) setDefaults() *respMyServicePutDataById { + return x +} + +type reqMyServiceLobDataById struct { + Id int64 `thrift:"id,1" json:"id" db:"id"` + Data string `thrift:"data,2" json:"data" db:"data"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyServiceLobDataById)(nil) + +// Deprecated: MyServiceLobDataByIdArgsDeprecated is deprecated, since it is supposed to be internal. +type MyServiceLobDataByIdArgsDeprecated = reqMyServiceLobDataById + +func newReqMyServiceLobDataById() *reqMyServiceLobDataById { + return (&reqMyServiceLobDataById{}).setDefaults() +} + +func (x *reqMyServiceLobDataById) GetId() int64 { + return x.Id +} + +func (x *reqMyServiceLobDataById) GetData() string { + return x.Data +} + +func (x *reqMyServiceLobDataById) SetIdNonCompat(value int64) *reqMyServiceLobDataById { + x.Id = value + return x +} + +func (x *reqMyServiceLobDataById) SetId(value int64) *reqMyServiceLobDataById { + x.Id = value + return x +} + +func (x *reqMyServiceLobDataById) SetDataNonCompat(value string) *reqMyServiceLobDataById { + x.Data = value + return x +} + +func (x *reqMyServiceLobDataById) SetData(value string) *reqMyServiceLobDataById { + x.Data = value + return x +} + +func (x *reqMyServiceLobDataById) writeField1(p thrift.Encoder) error { // Id + if err := p.WriteFieldBegin("id", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Id + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceLobDataById) writeField2(p thrift.Encoder) error { // Data + if err := p.WriteFieldBegin("data", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Data + if err := p.WriteString(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceLobDataById) readField1(p thrift.Decoder) error { // Id + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Id = result + return nil +} + +func (x *reqMyServiceLobDataById) readField2(p thrift.Decoder) error { // Data + result, err := p.ReadString() +if err != nil { + return err +} + + x.Data = result + return nil +} + +func (x *reqMyServiceLobDataById) toString1() string { // Id + return fmt.Sprintf("%v", x.Id) +} + +func (x *reqMyServiceLobDataById) toString2() string { // Data + return fmt.Sprintf("%v", x.Data) +} + + + +func (x *reqMyServiceLobDataById) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyServiceLobDataById"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + if err := x.writeField2(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceLobDataById) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // id + fieldReadErr = x.readField1(p) + case (id == 2 && wireType == thrift.Type(thrift.STRING)): // data + fieldReadErr = x.readField2(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyServiceLobDataById) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyServiceLobDataById({") + sb.WriteString(fmt.Sprintf("Id:%s ", x.toString1())) + sb.WriteString(fmt.Sprintf("Data:%s", x.toString2())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyServiceLobDataById) setDefaults() *reqMyServiceLobDataById { + return x. + SetIdNonCompat(0). + SetDataNonCompat("") +} + +type respMyServiceLobDataById struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyServiceLobDataById)(nil) +var _ thrift.WritableResult = (*respMyServiceLobDataById)(nil) + +// Deprecated: MyServiceLobDataByIdResultDeprecated is deprecated, since it is supposed to be internal. +type MyServiceLobDataByIdResultDeprecated = respMyServiceLobDataById + +func newRespMyServiceLobDataById() *respMyServiceLobDataById { + return (&respMyServiceLobDataById{}).setDefaults() +} + + + +func (x *respMyServiceLobDataById) Exception() thrift.WritableException { + return nil +} + +func (x *respMyServiceLobDataById) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyServiceLobDataById"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyServiceLobDataById) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyServiceLobDataById) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyServiceLobDataById({") + sb.WriteString("})") + + return sb.String() +} +func (x *respMyServiceLobDataById) setDefaults() *respMyServiceLobDataById { + return x +} + +type reqMyServiceGoDoNothing struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyServiceGoDoNothing)(nil) + +// Deprecated: MyServiceGoDoNothingArgsDeprecated is deprecated, since it is supposed to be internal. +type MyServiceGoDoNothingArgsDeprecated = reqMyServiceGoDoNothing + +func newReqMyServiceGoDoNothing() *reqMyServiceGoDoNothing { + return (&reqMyServiceGoDoNothing{}).setDefaults() +} + + + +func (x *reqMyServiceGoDoNothing) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyServiceGoDoNothing"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceGoDoNothing) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyServiceGoDoNothing) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyServiceGoDoNothing({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyServiceGoDoNothing) setDefaults() *reqMyServiceGoDoNothing { + return x +} + +type respMyServiceGoDoNothing struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyServiceGoDoNothing)(nil) +var _ thrift.WritableResult = (*respMyServiceGoDoNothing)(nil) + +// Deprecated: MyServiceGoDoNothingResultDeprecated is deprecated, since it is supposed to be internal. +type MyServiceGoDoNothingResultDeprecated = respMyServiceGoDoNothing + +func newRespMyServiceGoDoNothing() *respMyServiceGoDoNothing { + return (&respMyServiceGoDoNothing{}).setDefaults() +} + + + +func (x *respMyServiceGoDoNothing) Exception() thrift.WritableException { + return nil +} + +func (x *respMyServiceGoDoNothing) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyServiceGoDoNothing"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyServiceGoDoNothing) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyServiceGoDoNothing) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyServiceGoDoNothing({") + sb.WriteString("})") + + return sb.String() +} +func (x *respMyServiceGoDoNothing) setDefaults() *respMyServiceGoDoNothing { + return x +} + +type reqMyServicePrioParentPing struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyServicePrioParentPing)(nil) + +// Deprecated: MyServicePrioParentPingArgsDeprecated is deprecated, since it is supposed to be internal. +type MyServicePrioParentPingArgsDeprecated = reqMyServicePrioParentPing + +func newReqMyServicePrioParentPing() *reqMyServicePrioParentPing { + return (&reqMyServicePrioParentPing{}).setDefaults() +} + + + +func (x *reqMyServicePrioParentPing) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyServicePrioParentPing"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyServicePrioParentPing) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyServicePrioParentPing) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyServicePrioParentPing({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyServicePrioParentPing) setDefaults() *reqMyServicePrioParentPing { + return x +} + +type respMyServicePrioParentPing struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyServicePrioParentPing)(nil) +var _ thrift.WritableResult = (*respMyServicePrioParentPing)(nil) + +// Deprecated: MyServicePrioParentPingResultDeprecated is deprecated, since it is supposed to be internal. +type MyServicePrioParentPingResultDeprecated = respMyServicePrioParentPing + +func newRespMyServicePrioParentPing() *respMyServicePrioParentPing { + return (&respMyServicePrioParentPing{}).setDefaults() +} + + + +func (x *respMyServicePrioParentPing) Exception() thrift.WritableException { + return nil +} + +func (x *respMyServicePrioParentPing) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyServicePrioParentPing"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyServicePrioParentPing) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyServicePrioParentPing) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyServicePrioParentPing({") + sb.WriteString("})") + + return sb.String() +} +func (x *respMyServicePrioParentPing) setDefaults() *respMyServicePrioParentPing { + return x +} + +type reqMyServicePrioParentPong struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyServicePrioParentPong)(nil) + +// Deprecated: MyServicePrioParentPongArgsDeprecated is deprecated, since it is supposed to be internal. +type MyServicePrioParentPongArgsDeprecated = reqMyServicePrioParentPong + +func newReqMyServicePrioParentPong() *reqMyServicePrioParentPong { + return (&reqMyServicePrioParentPong{}).setDefaults() +} + + + +func (x *reqMyServicePrioParentPong) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyServicePrioParentPong"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyServicePrioParentPong) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyServicePrioParentPong) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyServicePrioParentPong({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyServicePrioParentPong) setDefaults() *reqMyServicePrioParentPong { + return x +} + +type respMyServicePrioParentPong struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyServicePrioParentPong)(nil) +var _ thrift.WritableResult = (*respMyServicePrioParentPong)(nil) + +// Deprecated: MyServicePrioParentPongResultDeprecated is deprecated, since it is supposed to be internal. +type MyServicePrioParentPongResultDeprecated = respMyServicePrioParentPong + +func newRespMyServicePrioParentPong() *respMyServicePrioParentPong { + return (&respMyServicePrioParentPong{}).setDefaults() +} + + + +func (x *respMyServicePrioParentPong) Exception() thrift.WritableException { + return nil +} + +func (x *respMyServicePrioParentPong) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyServicePrioParentPong"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyServicePrioParentPong) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyServicePrioParentPong) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyServicePrioParentPong({") + sb.WriteString("})") + + return sb.String() +} +func (x *respMyServicePrioParentPong) setDefaults() *respMyServicePrioParentPong { + return x +} + +type reqMyServicePrioChildPang struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyServicePrioChildPang)(nil) + +// Deprecated: MyServicePrioChildPangArgsDeprecated is deprecated, since it is supposed to be internal. +type MyServicePrioChildPangArgsDeprecated = reqMyServicePrioChildPang + +func newReqMyServicePrioChildPang() *reqMyServicePrioChildPang { + return (&reqMyServicePrioChildPang{}).setDefaults() +} + + + +func (x *reqMyServicePrioChildPang) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyServicePrioChildPang"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyServicePrioChildPang) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyServicePrioChildPang) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyServicePrioChildPang({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyServicePrioChildPang) setDefaults() *reqMyServicePrioChildPang { + return x +} + +type respMyServicePrioChildPang struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyServicePrioChildPang)(nil) +var _ thrift.WritableResult = (*respMyServicePrioChildPang)(nil) + +// Deprecated: MyServicePrioChildPangResultDeprecated is deprecated, since it is supposed to be internal. +type MyServicePrioChildPangResultDeprecated = respMyServicePrioChildPang + +func newRespMyServicePrioChildPang() *respMyServicePrioChildPang { + return (&respMyServicePrioChildPang{}).setDefaults() +} + + + +func (x *respMyServicePrioChildPang) Exception() thrift.WritableException { + return nil +} + +func (x *respMyServicePrioChildPang) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyServicePrioChildPang"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyServicePrioChildPang) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyServicePrioChildPang) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyServicePrioChildPang({") + sb.WriteString("})") + + return sb.String() +} +func (x *respMyServicePrioChildPang) setDefaults() *respMyServicePrioChildPang { + return x +} + +type reqBadServiceBar struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqBadServiceBar)(nil) + +// Deprecated: BadServiceBarArgsDeprecated is deprecated, since it is supposed to be internal. +type BadServiceBarArgsDeprecated = reqBadServiceBar + +func newReqBadServiceBar() *reqBadServiceBar { + return (&reqBadServiceBar{}).setDefaults() +} + + + +func (x *reqBadServiceBar) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqBadServiceBar"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqBadServiceBar) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqBadServiceBar) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqBadServiceBar({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqBadServiceBar) setDefaults() *reqBadServiceBar { + return x +} + +type respBadServiceBar struct { + Success *int32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respBadServiceBar)(nil) +var _ thrift.WritableResult = (*respBadServiceBar)(nil) + +// Deprecated: BadServiceBarResultDeprecated is deprecated, since it is supposed to be internal. +type BadServiceBarResultDeprecated = respBadServiceBar + +func newRespBadServiceBar() *respBadServiceBar { + return (&respBadServiceBar{}).setDefaults() +} + +func (x *respBadServiceBar) GetSuccess() int32 { + if !x.IsSetSuccess() { + return 0 + } + return *x.Success +} + +func (x *respBadServiceBar) SetSuccessNonCompat(value int32) *respBadServiceBar { + x.Success = &value + return x +} + +func (x *respBadServiceBar) SetSuccess(value *int32) *respBadServiceBar { + x.Success = value + return x +} + +func (x *respBadServiceBar) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respBadServiceBar) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteI32(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respBadServiceBar) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadI32() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respBadServiceBar) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respBadServiceBar) Exception() thrift.WritableException { + return nil +} + +func (x *respBadServiceBar) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respBadServiceBar"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respBadServiceBar) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.I32)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respBadServiceBar) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respBadServiceBar({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respBadServiceBar) setDefaults() *respBadServiceBar { + return x +} + +type reqFooBarBazServiceFooStructured struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqFooBarBazServiceFooStructured)(nil) + +// Deprecated: FooBarBazServiceFooStructuredArgsDeprecated is deprecated, since it is supposed to be internal. +type FooBarBazServiceFooStructuredArgsDeprecated = reqFooBarBazServiceFooStructured + +func newReqFooBarBazServiceFooStructured() *reqFooBarBazServiceFooStructured { + return (&reqFooBarBazServiceFooStructured{}).setDefaults() +} + + + +func (x *reqFooBarBazServiceFooStructured) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqFooBarBazServiceFooStructured"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqFooBarBazServiceFooStructured) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqFooBarBazServiceFooStructured) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqFooBarBazServiceFooStructured({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqFooBarBazServiceFooStructured) setDefaults() *reqFooBarBazServiceFooStructured { + return x +} + +type respFooBarBazServiceFooStructured struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respFooBarBazServiceFooStructured)(nil) +var _ thrift.WritableResult = (*respFooBarBazServiceFooStructured)(nil) + +// Deprecated: FooBarBazServiceFooStructuredResultDeprecated is deprecated, since it is supposed to be internal. +type FooBarBazServiceFooStructuredResultDeprecated = respFooBarBazServiceFooStructured + +func newRespFooBarBazServiceFooStructured() *respFooBarBazServiceFooStructured { + return (&respFooBarBazServiceFooStructured{}).setDefaults() +} + + + +func (x *respFooBarBazServiceFooStructured) Exception() thrift.WritableException { + return nil +} + +func (x *respFooBarBazServiceFooStructured) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respFooBarBazServiceFooStructured"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respFooBarBazServiceFooStructured) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respFooBarBazServiceFooStructured) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respFooBarBazServiceFooStructured({") + sb.WriteString("})") + + return sb.String() +} +func (x *respFooBarBazServiceFooStructured) setDefaults() *respFooBarBazServiceFooStructured { + return x +} + +type reqFooBarBazServiceBarNonStructured struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqFooBarBazServiceBarNonStructured)(nil) + +// Deprecated: FooBarBazServiceBarNonStructuredArgsDeprecated is deprecated, since it is supposed to be internal. +type FooBarBazServiceBarNonStructuredArgsDeprecated = reqFooBarBazServiceBarNonStructured + +func newReqFooBarBazServiceBarNonStructured() *reqFooBarBazServiceBarNonStructured { + return (&reqFooBarBazServiceBarNonStructured{}).setDefaults() +} + + + +func (x *reqFooBarBazServiceBarNonStructured) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqFooBarBazServiceBarNonStructured"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqFooBarBazServiceBarNonStructured) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqFooBarBazServiceBarNonStructured) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqFooBarBazServiceBarNonStructured({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqFooBarBazServiceBarNonStructured) setDefaults() *reqFooBarBazServiceBarNonStructured { + return x +} + +type respFooBarBazServiceBarNonStructured struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respFooBarBazServiceBarNonStructured)(nil) +var _ thrift.WritableResult = (*respFooBarBazServiceBarNonStructured)(nil) + +// Deprecated: FooBarBazServiceBarNonStructuredResultDeprecated is deprecated, since it is supposed to be internal. +type FooBarBazServiceBarNonStructuredResultDeprecated = respFooBarBazServiceBarNonStructured + +func newRespFooBarBazServiceBarNonStructured() *respFooBarBazServiceBarNonStructured { + return (&respFooBarBazServiceBarNonStructured{}).setDefaults() +} + + + +func (x *respFooBarBazServiceBarNonStructured) Exception() thrift.WritableException { + return nil +} + +func (x *respFooBarBazServiceBarNonStructured) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respFooBarBazServiceBarNonStructured"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respFooBarBazServiceBarNonStructured) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respFooBarBazServiceBarNonStructured) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respFooBarBazServiceBarNonStructured({") + sb.WriteString("})") + + return sb.String() +} +func (x *respFooBarBazServiceBarNonStructured) setDefaults() *respFooBarBazServiceBarNonStructured { + return x +} + +type reqFooBarBazServiceBaz struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqFooBarBazServiceBaz)(nil) + +// Deprecated: FooBarBazServiceBazArgsDeprecated is deprecated, since it is supposed to be internal. +type FooBarBazServiceBazArgsDeprecated = reqFooBarBazServiceBaz + +func newReqFooBarBazServiceBaz() *reqFooBarBazServiceBaz { + return (&reqFooBarBazServiceBaz{}).setDefaults() +} + + + +func (x *reqFooBarBazServiceBaz) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqFooBarBazServiceBaz"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqFooBarBazServiceBaz) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqFooBarBazServiceBaz) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqFooBarBazServiceBaz({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqFooBarBazServiceBaz) setDefaults() *reqFooBarBazServiceBaz { + return x +} + +type respFooBarBazServiceBaz struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respFooBarBazServiceBaz)(nil) +var _ thrift.WritableResult = (*respFooBarBazServiceBaz)(nil) + +// Deprecated: FooBarBazServiceBazResultDeprecated is deprecated, since it is supposed to be internal. +type FooBarBazServiceBazResultDeprecated = respFooBarBazServiceBaz + +func newRespFooBarBazServiceBaz() *respFooBarBazServiceBaz { + return (&respFooBarBazServiceBaz{}).setDefaults() +} + + + +func (x *respFooBarBazServiceBaz) Exception() thrift.WritableException { + return nil +} + +func (x *respFooBarBazServiceBaz) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respFooBarBazServiceBaz"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respFooBarBazServiceBaz) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respFooBarBazServiceBaz) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respFooBarBazServiceBaz({") + sb.WriteString("})") + + return sb.String() +} +func (x *respFooBarBazServiceBaz) setDefaults() *respFooBarBazServiceBaz { + return x +} + + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/cpp/types.go b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/cpp/types.go index b7608402504..fde8434e68b 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/cpp/types.go +++ b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/cpp/types.go @@ -2282,6 +2282,7 @@ func (x *GenerateDeprecatedHeaderClientMethods) setDefaults() *GenerateDeprecate } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/go/types.go b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/go/types.go index 9d6a80812e3..628e19ddd57 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/go/types.go +++ b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/go/types.go @@ -284,6 +284,7 @@ func (x *Tag) setDefaults() *Tag { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/hack/types.go b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/hack/types.go index 25397ae334e..42eacb139df 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/hack/types.go +++ b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/hack/types.go @@ -1464,6 +1464,7 @@ func (x *ModuleInternal) setDefaults() *ModuleInternal { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/scope/types.go b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/scope/types.go index c2871133501..c8a6b005a41 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/scope/types.go +++ b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/scope/types.go @@ -1380,6 +1380,7 @@ func (x *Definition) setDefaults() *Definition { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/thrift/types.go b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/thrift/types.go index 85cadd20f65..ba562235211 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/thrift/types.go +++ b/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/thrift/types.go @@ -1804,6 +1804,7 @@ func (x *AllowReservedFilename) setDefaults() *AllowReservedFilename { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/basic/out/go/gen-go/module/svcs.go b/thrift/compiler/test/fixtures/basic/out/go/gen-go/module/svcs.go index 46a5ec720a4..03f550a94ad 100644 --- a/thrift/compiler/test/fixtures/basic/out/go/gen-go/module/svcs.go +++ b/thrift/compiler/test/fixtures/basic/out/go/gen-go/module/svcs.go @@ -97,178 +97,6 @@ func (c *FooServiceClient) SimpleRPCContext(ctx context.Context) (error) { return c.chClient.SimpleRPC(ctx) } -type reqFooServiceSimpleRPC struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqFooServiceSimpleRPC)(nil) - -// Deprecated: FooServiceSimpleRPCArgsDeprecated is deprecated, since it is supposed to be internal. -type FooServiceSimpleRPCArgsDeprecated = reqFooServiceSimpleRPC - -func newReqFooServiceSimpleRPC() *reqFooServiceSimpleRPC { - return (&reqFooServiceSimpleRPC{}).setDefaults() -} - - - -func (x *reqFooServiceSimpleRPC) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqFooServiceSimpleRPC"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqFooServiceSimpleRPC) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqFooServiceSimpleRPC) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqFooServiceSimpleRPC({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqFooServiceSimpleRPC) setDefaults() *reqFooServiceSimpleRPC { - return x -} - -type respFooServiceSimpleRPC struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respFooServiceSimpleRPC)(nil) -var _ thrift.WritableResult = (*respFooServiceSimpleRPC)(nil) - -// Deprecated: FooServiceSimpleRPCResultDeprecated is deprecated, since it is supposed to be internal. -type FooServiceSimpleRPCResultDeprecated = respFooServiceSimpleRPC - -func newRespFooServiceSimpleRPC() *respFooServiceSimpleRPC { - return (&respFooServiceSimpleRPC{}).setDefaults() -} - - - -func (x *respFooServiceSimpleRPC) Exception() thrift.WritableException { - return nil -} - -func (x *respFooServiceSimpleRPC) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respFooServiceSimpleRPC"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respFooServiceSimpleRPC) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respFooServiceSimpleRPC) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respFooServiceSimpleRPC({") - sb.WriteString("})") - - return sb.String() -} -func (x *respFooServiceSimpleRPC) setDefaults() *respFooServiceSimpleRPC { - return x -} - - type FooServiceProcessor struct { processorFunctionMap map[string]thrift.ProcessorFunction @@ -439,301 +267,6 @@ func (c *FB303ServiceClient) SimpleRPCContext(ctx context.Context, intParameter return c.chClient.SimpleRPC(ctx, intParameter) } -type reqFB303ServiceSimpleRPC struct { - IntParameter int32 `thrift:"int_parameter,1" json:"int_parameter" db:"int_parameter"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqFB303ServiceSimpleRPC)(nil) - -// Deprecated: FB303ServiceSimpleRPCArgsDeprecated is deprecated, since it is supposed to be internal. -type FB303ServiceSimpleRPCArgsDeprecated = reqFB303ServiceSimpleRPC - -func newReqFB303ServiceSimpleRPC() *reqFB303ServiceSimpleRPC { - return (&reqFB303ServiceSimpleRPC{}).setDefaults() -} - -func (x *reqFB303ServiceSimpleRPC) GetIntParameter() int32 { - return x.IntParameter -} - -func (x *reqFB303ServiceSimpleRPC) SetIntParameterNonCompat(value int32) *reqFB303ServiceSimpleRPC { - x.IntParameter = value - return x -} - -func (x *reqFB303ServiceSimpleRPC) SetIntParameter(value int32) *reqFB303ServiceSimpleRPC { - x.IntParameter = value - return x -} - -func (x *reqFB303ServiceSimpleRPC) writeField1(p thrift.Encoder) error { // IntParameter - if err := p.WriteFieldBegin("int_parameter", thrift.I32, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.IntParameter - if err := p.WriteI32(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqFB303ServiceSimpleRPC) readField1(p thrift.Decoder) error { // IntParameter - result, err := p.ReadI32() -if err != nil { - return err -} - - x.IntParameter = result - return nil -} - -func (x *reqFB303ServiceSimpleRPC) toString1() string { // IntParameter - return fmt.Sprintf("%v", x.IntParameter) -} - - - -func (x *reqFB303ServiceSimpleRPC) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqFB303ServiceSimpleRPC"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqFB303ServiceSimpleRPC) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I32)): // int_parameter - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqFB303ServiceSimpleRPC) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqFB303ServiceSimpleRPC({") - sb.WriteString(fmt.Sprintf("IntParameter:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqFB303ServiceSimpleRPC) setDefaults() *reqFB303ServiceSimpleRPC { - return x. - SetIntParameterNonCompat(0) -} - -type respFB303ServiceSimpleRPC struct { - Success *ReservedKeyword `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respFB303ServiceSimpleRPC)(nil) -var _ thrift.WritableResult = (*respFB303ServiceSimpleRPC)(nil) - -// Deprecated: FB303ServiceSimpleRPCResultDeprecated is deprecated, since it is supposed to be internal. -type FB303ServiceSimpleRPCResultDeprecated = respFB303ServiceSimpleRPC - -func newRespFB303ServiceSimpleRPC() *respFB303ServiceSimpleRPC { - return (&respFB303ServiceSimpleRPC{}).setDefaults() -} - -func (x *respFB303ServiceSimpleRPC) GetSuccess() *ReservedKeyword { - if !x.IsSetSuccess() { - return nil - } - return x.Success -} - -func (x *respFB303ServiceSimpleRPC) SetSuccessNonCompat(value *ReservedKeyword) *respFB303ServiceSimpleRPC { - x.Success = value - return x -} - -func (x *respFB303ServiceSimpleRPC) SetSuccess(value *ReservedKeyword) *respFB303ServiceSimpleRPC { - x.Success = value - return x -} - -func (x *respFB303ServiceSimpleRPC) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respFB303ServiceSimpleRPC) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Success - if err := item.Write(p); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respFB303ServiceSimpleRPC) readField0(p thrift.Decoder) error { // Success - result := NewReservedKeyword() -err := result.Read(p) -if err != nil { - return err -} - - x.Success = result - return nil -} - -func (x *respFB303ServiceSimpleRPC) toString0() string { // Success - return fmt.Sprintf("%v", x.Success) -} - -// Deprecated: Use newRespFB303ServiceSimpleRPC().GetSuccess() instead. -func (x *respFB303ServiceSimpleRPC) DefaultGetSuccess() *ReservedKeyword { - if !x.IsSetSuccess() { - return NewReservedKeyword() - } - return x.Success -} - - - -func (x *respFB303ServiceSimpleRPC) Exception() thrift.WritableException { - return nil -} - -func (x *respFB303ServiceSimpleRPC) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respFB303ServiceSimpleRPC"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respFB303ServiceSimpleRPC) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.STRUCT)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respFB303ServiceSimpleRPC) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respFB303ServiceSimpleRPC({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respFB303ServiceSimpleRPC) setDefaults() *respFB303ServiceSimpleRPC { - return x -} - - type FB303ServiceProcessor struct { processorFunctionMap map[string]thrift.ProcessorFunction @@ -1106,2697 +639,78 @@ func (c *MyServiceClient) RpcSkippedCodegenContext(ctx context.Context) (error) return c.chClient.RpcSkippedCodegen(ctx) } -type reqMyServicePing struct { + +type MyServiceProcessor struct { + processorFunctionMap map[string]thrift.ProcessorFunction + functionServiceMap map[string]string + handler MyService } // Compile time interface enforcer -var _ thrift.Struct = (*reqMyServicePing)(nil) +var _ thrift.Processor = (*MyServiceProcessor)(nil) -// Deprecated: MyServicePingArgsDeprecated is deprecated, since it is supposed to be internal. -type MyServicePingArgsDeprecated = reqMyServicePing +func NewMyServiceProcessor(handler MyService) *MyServiceProcessor { + p := &MyServiceProcessor{ + handler: handler, + processorFunctionMap: make(map[string]thrift.ProcessorFunction), + functionServiceMap: make(map[string]string), + } + p.AddToProcessorFunctionMap("ping", &procFuncMyServicePing{handler: handler}) + p.AddToProcessorFunctionMap("getRandomData", &procFuncMyServiceGetRandomData{handler: handler}) + p.AddToProcessorFunctionMap("sink", &procFuncMyServiceSink{handler: handler}) + p.AddToProcessorFunctionMap("putDataById", &procFuncMyServicePutDataById{handler: handler}) + p.AddToProcessorFunctionMap("hasDataById", &procFuncMyServiceHasDataById{handler: handler}) + p.AddToProcessorFunctionMap("getDataById", &procFuncMyServiceGetDataById{handler: handler}) + p.AddToProcessorFunctionMap("deleteDataById", &procFuncMyServiceDeleteDataById{handler: handler}) + p.AddToProcessorFunctionMap("lobDataById", &procFuncMyServiceLobDataById{handler: handler}) + p.AddToProcessorFunctionMap("invalid_return_for_hack", &procFuncMyServiceInvalidReturnForHack{handler: handler}) + p.AddToProcessorFunctionMap("rpc_skipped_codegen", &procFuncMyServiceRpcSkippedCodegen{handler: handler}) + p.AddToFunctionServiceMap("ping", "MyService") + p.AddToFunctionServiceMap("getRandomData", "MyService") + p.AddToFunctionServiceMap("sink", "MyService") + p.AddToFunctionServiceMap("putDataById", "MyService") + p.AddToFunctionServiceMap("hasDataById", "MyService") + p.AddToFunctionServiceMap("getDataById", "MyService") + p.AddToFunctionServiceMap("deleteDataById", "MyService") + p.AddToFunctionServiceMap("lobDataById", "MyService") + p.AddToFunctionServiceMap("invalid_return_for_hack", "MyService") + p.AddToFunctionServiceMap("rpc_skipped_codegen", "MyService") -func newReqMyServicePing() *reqMyServicePing { - return (&reqMyServicePing{}).setDefaults() + return p } +func (p *MyServiceProcessor) AddToProcessorFunctionMap(key string, processorFunction thrift.ProcessorFunction) { + p.processorFunctionMap[key] = processorFunction +} +func (p *MyServiceProcessor) AddToFunctionServiceMap(key, service string) { + p.functionServiceMap[key] = service +} -func (x *reqMyServicePing) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyServicePing"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyServicePing) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqMyServicePing) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqMyServicePing({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyServicePing) setDefaults() *reqMyServicePing { - return x -} - -type respMyServicePing struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyServicePing)(nil) -var _ thrift.WritableResult = (*respMyServicePing)(nil) - -// Deprecated: MyServicePingResultDeprecated is deprecated, since it is supposed to be internal. -type MyServicePingResultDeprecated = respMyServicePing - -func newRespMyServicePing() *respMyServicePing { - return (&respMyServicePing{}).setDefaults() -} - - - -func (x *respMyServicePing) Exception() thrift.WritableException { - return nil -} - -func (x *respMyServicePing) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyServicePing"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respMyServicePing) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respMyServicePing) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyServicePing({") - sb.WriteString("})") - - return sb.String() -} -func (x *respMyServicePing) setDefaults() *respMyServicePing { - return x -} - -type reqMyServiceGetRandomData struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqMyServiceGetRandomData)(nil) - -// Deprecated: MyServiceGetRandomDataArgsDeprecated is deprecated, since it is supposed to be internal. -type MyServiceGetRandomDataArgsDeprecated = reqMyServiceGetRandomData - -func newReqMyServiceGetRandomData() *reqMyServiceGetRandomData { - return (&reqMyServiceGetRandomData{}).setDefaults() -} - - - -func (x *reqMyServiceGetRandomData) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyServiceGetRandomData"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceGetRandomData) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqMyServiceGetRandomData) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqMyServiceGetRandomData({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyServiceGetRandomData) setDefaults() *reqMyServiceGetRandomData { - return x -} - -type respMyServiceGetRandomData struct { - Success *string `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyServiceGetRandomData)(nil) -var _ thrift.WritableResult = (*respMyServiceGetRandomData)(nil) - -// Deprecated: MyServiceGetRandomDataResultDeprecated is deprecated, since it is supposed to be internal. -type MyServiceGetRandomDataResultDeprecated = respMyServiceGetRandomData - -func newRespMyServiceGetRandomData() *respMyServiceGetRandomData { - return (&respMyServiceGetRandomData{}).setDefaults() -} - -func (x *respMyServiceGetRandomData) GetSuccess() string { - if !x.IsSetSuccess() { - return "" - } - return *x.Success -} - -func (x *respMyServiceGetRandomData) SetSuccessNonCompat(value string) *respMyServiceGetRandomData { - x.Success = &value - return x -} - -func (x *respMyServiceGetRandomData) SetSuccess(value *string) *respMyServiceGetRandomData { - x.Success = value - return x -} - -func (x *respMyServiceGetRandomData) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respMyServiceGetRandomData) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.STRING, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteString(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respMyServiceGetRandomData) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadString() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respMyServiceGetRandomData) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respMyServiceGetRandomData) Exception() thrift.WritableException { - return nil -} - -func (x *respMyServiceGetRandomData) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyServiceGetRandomData"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respMyServiceGetRandomData) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.STRING)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respMyServiceGetRandomData) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyServiceGetRandomData({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respMyServiceGetRandomData) setDefaults() *respMyServiceGetRandomData { - return x -} - -type reqMyServiceSink struct { - Sink int64 `thrift:"sink,1" json:"sink" db:"sink"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqMyServiceSink)(nil) - -// Deprecated: MyServiceSinkArgsDeprecated is deprecated, since it is supposed to be internal. -type MyServiceSinkArgsDeprecated = reqMyServiceSink - -func newReqMyServiceSink() *reqMyServiceSink { - return (&reqMyServiceSink{}).setDefaults() -} - -func (x *reqMyServiceSink) GetSink() int64 { - return x.Sink -} - -func (x *reqMyServiceSink) SetSinkNonCompat(value int64) *reqMyServiceSink { - x.Sink = value - return x -} - -func (x *reqMyServiceSink) SetSink(value int64) *reqMyServiceSink { - x.Sink = value - return x -} - -func (x *reqMyServiceSink) writeField1(p thrift.Encoder) error { // Sink - if err := p.WriteFieldBegin("sink", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Sink - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceSink) readField1(p thrift.Decoder) error { // Sink - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Sink = result - return nil -} - -func (x *reqMyServiceSink) toString1() string { // Sink - return fmt.Sprintf("%v", x.Sink) -} - - - -func (x *reqMyServiceSink) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyServiceSink"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceSink) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // sink - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqMyServiceSink) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqMyServiceSink({") - sb.WriteString(fmt.Sprintf("Sink:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyServiceSink) setDefaults() *reqMyServiceSink { - return x. - SetSinkNonCompat(0) -} - -type respMyServiceSink struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyServiceSink)(nil) -var _ thrift.WritableResult = (*respMyServiceSink)(nil) - -// Deprecated: MyServiceSinkResultDeprecated is deprecated, since it is supposed to be internal. -type MyServiceSinkResultDeprecated = respMyServiceSink - -func newRespMyServiceSink() *respMyServiceSink { - return (&respMyServiceSink{}).setDefaults() -} - - - -func (x *respMyServiceSink) Exception() thrift.WritableException { - return nil -} - -func (x *respMyServiceSink) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyServiceSink"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respMyServiceSink) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respMyServiceSink) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyServiceSink({") - sb.WriteString("})") - - return sb.String() -} -func (x *respMyServiceSink) setDefaults() *respMyServiceSink { - return x -} - -type reqMyServicePutDataById struct { - Id int64 `thrift:"id,1" json:"id" db:"id"` - Data string `thrift:"data,2" json:"data" db:"data"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqMyServicePutDataById)(nil) - -// Deprecated: MyServicePutDataByIdArgsDeprecated is deprecated, since it is supposed to be internal. -type MyServicePutDataByIdArgsDeprecated = reqMyServicePutDataById - -func newReqMyServicePutDataById() *reqMyServicePutDataById { - return (&reqMyServicePutDataById{}).setDefaults() -} - -func (x *reqMyServicePutDataById) GetId() int64 { - return x.Id -} - -func (x *reqMyServicePutDataById) GetData() string { - return x.Data -} - -func (x *reqMyServicePutDataById) SetIdNonCompat(value int64) *reqMyServicePutDataById { - x.Id = value - return x -} - -func (x *reqMyServicePutDataById) SetId(value int64) *reqMyServicePutDataById { - x.Id = value - return x -} - -func (x *reqMyServicePutDataById) SetDataNonCompat(value string) *reqMyServicePutDataById { - x.Data = value - return x -} - -func (x *reqMyServicePutDataById) SetData(value string) *reqMyServicePutDataById { - x.Data = value - return x -} - -func (x *reqMyServicePutDataById) writeField1(p thrift.Encoder) error { // Id - if err := p.WriteFieldBegin("id", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Id - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqMyServicePutDataById) writeField2(p thrift.Encoder) error { // Data - if err := p.WriteFieldBegin("data", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Data - if err := p.WriteString(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqMyServicePutDataById) readField1(p thrift.Decoder) error { // Id - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Id = result - return nil -} - -func (x *reqMyServicePutDataById) readField2(p thrift.Decoder) error { // Data - result, err := p.ReadString() -if err != nil { - return err -} - - x.Data = result - return nil -} - -func (x *reqMyServicePutDataById) toString1() string { // Id - return fmt.Sprintf("%v", x.Id) -} - -func (x *reqMyServicePutDataById) toString2() string { // Data - return fmt.Sprintf("%v", x.Data) -} - - - -func (x *reqMyServicePutDataById) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyServicePutDataById"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - if err := x.writeField2(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyServicePutDataById) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // id - fieldReadErr = x.readField1(p) - case (id == 2 && wireType == thrift.Type(thrift.STRING)): // data - fieldReadErr = x.readField2(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqMyServicePutDataById) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqMyServicePutDataById({") - sb.WriteString(fmt.Sprintf("Id:%s ", x.toString1())) - sb.WriteString(fmt.Sprintf("Data:%s", x.toString2())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyServicePutDataById) setDefaults() *reqMyServicePutDataById { - return x. - SetIdNonCompat(0). - SetDataNonCompat("") -} - -type respMyServicePutDataById struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyServicePutDataById)(nil) -var _ thrift.WritableResult = (*respMyServicePutDataById)(nil) - -// Deprecated: MyServicePutDataByIdResultDeprecated is deprecated, since it is supposed to be internal. -type MyServicePutDataByIdResultDeprecated = respMyServicePutDataById - -func newRespMyServicePutDataById() *respMyServicePutDataById { - return (&respMyServicePutDataById{}).setDefaults() -} - - - -func (x *respMyServicePutDataById) Exception() thrift.WritableException { - return nil -} - -func (x *respMyServicePutDataById) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyServicePutDataById"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respMyServicePutDataById) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respMyServicePutDataById) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyServicePutDataById({") - sb.WriteString("})") - - return sb.String() -} -func (x *respMyServicePutDataById) setDefaults() *respMyServicePutDataById { - return x -} - -type reqMyServiceHasDataById struct { - Id int64 `thrift:"id,1" json:"id" db:"id"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqMyServiceHasDataById)(nil) - -// Deprecated: MyServiceHasDataByIdArgsDeprecated is deprecated, since it is supposed to be internal. -type MyServiceHasDataByIdArgsDeprecated = reqMyServiceHasDataById - -func newReqMyServiceHasDataById() *reqMyServiceHasDataById { - return (&reqMyServiceHasDataById{}).setDefaults() -} - -func (x *reqMyServiceHasDataById) GetId() int64 { - return x.Id -} - -func (x *reqMyServiceHasDataById) SetIdNonCompat(value int64) *reqMyServiceHasDataById { - x.Id = value - return x -} - -func (x *reqMyServiceHasDataById) SetId(value int64) *reqMyServiceHasDataById { - x.Id = value - return x -} - -func (x *reqMyServiceHasDataById) writeField1(p thrift.Encoder) error { // Id - if err := p.WriteFieldBegin("id", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Id - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceHasDataById) readField1(p thrift.Decoder) error { // Id - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Id = result - return nil -} - -func (x *reqMyServiceHasDataById) toString1() string { // Id - return fmt.Sprintf("%v", x.Id) -} - - - -func (x *reqMyServiceHasDataById) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyServiceHasDataById"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceHasDataById) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // id - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqMyServiceHasDataById) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqMyServiceHasDataById({") - sb.WriteString(fmt.Sprintf("Id:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyServiceHasDataById) setDefaults() *reqMyServiceHasDataById { - return x. - SetIdNonCompat(0) -} - -type respMyServiceHasDataById struct { - Success *bool `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyServiceHasDataById)(nil) -var _ thrift.WritableResult = (*respMyServiceHasDataById)(nil) - -// Deprecated: MyServiceHasDataByIdResultDeprecated is deprecated, since it is supposed to be internal. -type MyServiceHasDataByIdResultDeprecated = respMyServiceHasDataById - -func newRespMyServiceHasDataById() *respMyServiceHasDataById { - return (&respMyServiceHasDataById{}).setDefaults() -} - -func (x *respMyServiceHasDataById) GetSuccess() bool { - if !x.IsSetSuccess() { - return false - } - return *x.Success -} - -func (x *respMyServiceHasDataById) SetSuccessNonCompat(value bool) *respMyServiceHasDataById { - x.Success = &value - return x -} - -func (x *respMyServiceHasDataById) SetSuccess(value *bool) *respMyServiceHasDataById { - x.Success = value - return x -} - -func (x *respMyServiceHasDataById) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respMyServiceHasDataById) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.BOOL, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteBool(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respMyServiceHasDataById) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadBool() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respMyServiceHasDataById) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respMyServiceHasDataById) Exception() thrift.WritableException { - return nil -} - -func (x *respMyServiceHasDataById) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyServiceHasDataById"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respMyServiceHasDataById) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.BOOL)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respMyServiceHasDataById) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyServiceHasDataById({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respMyServiceHasDataById) setDefaults() *respMyServiceHasDataById { - return x -} - -type reqMyServiceGetDataById struct { - Id int64 `thrift:"id,1" json:"id" db:"id"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqMyServiceGetDataById)(nil) - -// Deprecated: MyServiceGetDataByIdArgsDeprecated is deprecated, since it is supposed to be internal. -type MyServiceGetDataByIdArgsDeprecated = reqMyServiceGetDataById - -func newReqMyServiceGetDataById() *reqMyServiceGetDataById { - return (&reqMyServiceGetDataById{}).setDefaults() -} - -func (x *reqMyServiceGetDataById) GetId() int64 { - return x.Id -} - -func (x *reqMyServiceGetDataById) SetIdNonCompat(value int64) *reqMyServiceGetDataById { - x.Id = value - return x -} - -func (x *reqMyServiceGetDataById) SetId(value int64) *reqMyServiceGetDataById { - x.Id = value - return x -} - -func (x *reqMyServiceGetDataById) writeField1(p thrift.Encoder) error { // Id - if err := p.WriteFieldBegin("id", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Id - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceGetDataById) readField1(p thrift.Decoder) error { // Id - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Id = result - return nil -} - -func (x *reqMyServiceGetDataById) toString1() string { // Id - return fmt.Sprintf("%v", x.Id) -} - - - -func (x *reqMyServiceGetDataById) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyServiceGetDataById"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceGetDataById) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // id - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqMyServiceGetDataById) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqMyServiceGetDataById({") - sb.WriteString(fmt.Sprintf("Id:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyServiceGetDataById) setDefaults() *reqMyServiceGetDataById { - return x. - SetIdNonCompat(0) -} - -type respMyServiceGetDataById struct { - Success *string `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyServiceGetDataById)(nil) -var _ thrift.WritableResult = (*respMyServiceGetDataById)(nil) - -// Deprecated: MyServiceGetDataByIdResultDeprecated is deprecated, since it is supposed to be internal. -type MyServiceGetDataByIdResultDeprecated = respMyServiceGetDataById - -func newRespMyServiceGetDataById() *respMyServiceGetDataById { - return (&respMyServiceGetDataById{}).setDefaults() -} - -func (x *respMyServiceGetDataById) GetSuccess() string { - if !x.IsSetSuccess() { - return "" - } - return *x.Success -} - -func (x *respMyServiceGetDataById) SetSuccessNonCompat(value string) *respMyServiceGetDataById { - x.Success = &value - return x -} - -func (x *respMyServiceGetDataById) SetSuccess(value *string) *respMyServiceGetDataById { - x.Success = value - return x -} - -func (x *respMyServiceGetDataById) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respMyServiceGetDataById) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.STRING, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteString(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respMyServiceGetDataById) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadString() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respMyServiceGetDataById) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respMyServiceGetDataById) Exception() thrift.WritableException { - return nil -} - -func (x *respMyServiceGetDataById) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyServiceGetDataById"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respMyServiceGetDataById) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.STRING)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respMyServiceGetDataById) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyServiceGetDataById({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respMyServiceGetDataById) setDefaults() *respMyServiceGetDataById { - return x -} - -type reqMyServiceDeleteDataById struct { - Id int64 `thrift:"id,1" json:"id" db:"id"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqMyServiceDeleteDataById)(nil) - -// Deprecated: MyServiceDeleteDataByIdArgsDeprecated is deprecated, since it is supposed to be internal. -type MyServiceDeleteDataByIdArgsDeprecated = reqMyServiceDeleteDataById - -func newReqMyServiceDeleteDataById() *reqMyServiceDeleteDataById { - return (&reqMyServiceDeleteDataById{}).setDefaults() -} - -func (x *reqMyServiceDeleteDataById) GetId() int64 { - return x.Id -} - -func (x *reqMyServiceDeleteDataById) SetIdNonCompat(value int64) *reqMyServiceDeleteDataById { - x.Id = value - return x -} - -func (x *reqMyServiceDeleteDataById) SetId(value int64) *reqMyServiceDeleteDataById { - x.Id = value - return x -} - -func (x *reqMyServiceDeleteDataById) writeField1(p thrift.Encoder) error { // Id - if err := p.WriteFieldBegin("id", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Id - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceDeleteDataById) readField1(p thrift.Decoder) error { // Id - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Id = result - return nil -} - -func (x *reqMyServiceDeleteDataById) toString1() string { // Id - return fmt.Sprintf("%v", x.Id) -} - - - -func (x *reqMyServiceDeleteDataById) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyServiceDeleteDataById"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceDeleteDataById) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // id - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqMyServiceDeleteDataById) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqMyServiceDeleteDataById({") - sb.WriteString(fmt.Sprintf("Id:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyServiceDeleteDataById) setDefaults() *reqMyServiceDeleteDataById { - return x. - SetIdNonCompat(0) -} - -type respMyServiceDeleteDataById struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyServiceDeleteDataById)(nil) -var _ thrift.WritableResult = (*respMyServiceDeleteDataById)(nil) - -// Deprecated: MyServiceDeleteDataByIdResultDeprecated is deprecated, since it is supposed to be internal. -type MyServiceDeleteDataByIdResultDeprecated = respMyServiceDeleteDataById - -func newRespMyServiceDeleteDataById() *respMyServiceDeleteDataById { - return (&respMyServiceDeleteDataById{}).setDefaults() -} - - - -func (x *respMyServiceDeleteDataById) Exception() thrift.WritableException { - return nil -} - -func (x *respMyServiceDeleteDataById) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyServiceDeleteDataById"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respMyServiceDeleteDataById) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respMyServiceDeleteDataById) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyServiceDeleteDataById({") - sb.WriteString("})") - - return sb.String() -} -func (x *respMyServiceDeleteDataById) setDefaults() *respMyServiceDeleteDataById { - return x -} - -type reqMyServiceLobDataById struct { - Id int64 `thrift:"id,1" json:"id" db:"id"` - Data string `thrift:"data,2" json:"data" db:"data"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqMyServiceLobDataById)(nil) - -// Deprecated: MyServiceLobDataByIdArgsDeprecated is deprecated, since it is supposed to be internal. -type MyServiceLobDataByIdArgsDeprecated = reqMyServiceLobDataById - -func newReqMyServiceLobDataById() *reqMyServiceLobDataById { - return (&reqMyServiceLobDataById{}).setDefaults() -} - -func (x *reqMyServiceLobDataById) GetId() int64 { - return x.Id -} - -func (x *reqMyServiceLobDataById) GetData() string { - return x.Data -} - -func (x *reqMyServiceLobDataById) SetIdNonCompat(value int64) *reqMyServiceLobDataById { - x.Id = value - return x -} - -func (x *reqMyServiceLobDataById) SetId(value int64) *reqMyServiceLobDataById { - x.Id = value - return x -} - -func (x *reqMyServiceLobDataById) SetDataNonCompat(value string) *reqMyServiceLobDataById { - x.Data = value - return x -} - -func (x *reqMyServiceLobDataById) SetData(value string) *reqMyServiceLobDataById { - x.Data = value - return x -} - -func (x *reqMyServiceLobDataById) writeField1(p thrift.Encoder) error { // Id - if err := p.WriteFieldBegin("id", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Id - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceLobDataById) writeField2(p thrift.Encoder) error { // Data - if err := p.WriteFieldBegin("data", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Data - if err := p.WriteString(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceLobDataById) readField1(p thrift.Decoder) error { // Id - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Id = result - return nil -} - -func (x *reqMyServiceLobDataById) readField2(p thrift.Decoder) error { // Data - result, err := p.ReadString() -if err != nil { - return err -} - - x.Data = result - return nil -} - -func (x *reqMyServiceLobDataById) toString1() string { // Id - return fmt.Sprintf("%v", x.Id) -} - -func (x *reqMyServiceLobDataById) toString2() string { // Data - return fmt.Sprintf("%v", x.Data) -} - - - -func (x *reqMyServiceLobDataById) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyServiceLobDataById"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - if err := x.writeField2(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceLobDataById) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // id - fieldReadErr = x.readField1(p) - case (id == 2 && wireType == thrift.Type(thrift.STRING)): // data - fieldReadErr = x.readField2(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqMyServiceLobDataById) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqMyServiceLobDataById({") - sb.WriteString(fmt.Sprintf("Id:%s ", x.toString1())) - sb.WriteString(fmt.Sprintf("Data:%s", x.toString2())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyServiceLobDataById) setDefaults() *reqMyServiceLobDataById { - return x. - SetIdNonCompat(0). - SetDataNonCompat("") -} - -type respMyServiceLobDataById struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyServiceLobDataById)(nil) -var _ thrift.WritableResult = (*respMyServiceLobDataById)(nil) - -// Deprecated: MyServiceLobDataByIdResultDeprecated is deprecated, since it is supposed to be internal. -type MyServiceLobDataByIdResultDeprecated = respMyServiceLobDataById - -func newRespMyServiceLobDataById() *respMyServiceLobDataById { - return (&respMyServiceLobDataById{}).setDefaults() -} - - - -func (x *respMyServiceLobDataById) Exception() thrift.WritableException { - return nil -} - -func (x *respMyServiceLobDataById) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyServiceLobDataById"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respMyServiceLobDataById) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respMyServiceLobDataById) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyServiceLobDataById({") - sb.WriteString("})") - - return sb.String() -} -func (x *respMyServiceLobDataById) setDefaults() *respMyServiceLobDataById { - return x -} - -type reqMyServiceInvalidReturnForHack struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqMyServiceInvalidReturnForHack)(nil) - -// Deprecated: MyServiceInvalidReturnForHackArgsDeprecated is deprecated, since it is supposed to be internal. -type MyServiceInvalidReturnForHackArgsDeprecated = reqMyServiceInvalidReturnForHack - -func newReqMyServiceInvalidReturnForHack() *reqMyServiceInvalidReturnForHack { - return (&reqMyServiceInvalidReturnForHack{}).setDefaults() -} - - - -func (x *reqMyServiceInvalidReturnForHack) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyServiceInvalidReturnForHack"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceInvalidReturnForHack) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqMyServiceInvalidReturnForHack) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqMyServiceInvalidReturnForHack({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyServiceInvalidReturnForHack) setDefaults() *reqMyServiceInvalidReturnForHack { - return x -} - -type respMyServiceInvalidReturnForHack struct { - Success []float32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyServiceInvalidReturnForHack)(nil) -var _ thrift.WritableResult = (*respMyServiceInvalidReturnForHack)(nil) - -// Deprecated: MyServiceInvalidReturnForHackResultDeprecated is deprecated, since it is supposed to be internal. -type MyServiceInvalidReturnForHackResultDeprecated = respMyServiceInvalidReturnForHack - -func newRespMyServiceInvalidReturnForHack() *respMyServiceInvalidReturnForHack { - return (&respMyServiceInvalidReturnForHack{}).setDefaults() -} - -func (x *respMyServiceInvalidReturnForHack) GetSuccess() []float32 { - if !x.IsSetSuccess() { - return make([]float32, 0) - } - return x.Success -} - -func (x *respMyServiceInvalidReturnForHack) SetSuccessNonCompat(value []float32) *respMyServiceInvalidReturnForHack { - x.Success = value - return x -} - -func (x *respMyServiceInvalidReturnForHack) SetSuccess(value []float32) *respMyServiceInvalidReturnForHack { - x.Success = value - return x -} - -func (x *respMyServiceInvalidReturnForHack) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respMyServiceInvalidReturnForHack) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.SET, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Success - if err := p.WriteSetBegin(thrift.FLOAT, len(item)); err != nil { - return thrift.PrependError("error writing set begin: ", err) -} -for _, v := range item { - { - item := v - if err := p.WriteFloat(item); err != nil { - return err -} - } -} -if err := p.WriteSetEnd(); err != nil { - return thrift.PrependError("error writing set end: ", err) -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respMyServiceInvalidReturnForHack) readField0(p thrift.Decoder) error { // Success - _ /* elemType */, size, err := p.ReadSetBegin() -if err != nil { - return thrift.PrependError("error reading set begin: ", err) -} - -setResult := make([]float32, 0, size) -for i := 0; i < size; i++ { - var elem float32 - { - result, err := p.ReadFloat() -if err != nil { - return err -} - elem = result - } - setResult = append(setResult, elem) -} - -if err := p.ReadSetEnd(); err != nil { - return thrift.PrependError("error reading set end: ", err) -} -result := setResult - - x.Success = result - return nil -} - -func (x *respMyServiceInvalidReturnForHack) toString0() string { // Success - return fmt.Sprintf("%v", x.Success) -} - - - -func (x *respMyServiceInvalidReturnForHack) Exception() thrift.WritableException { - return nil -} - -func (x *respMyServiceInvalidReturnForHack) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyServiceInvalidReturnForHack"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respMyServiceInvalidReturnForHack) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.SET)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respMyServiceInvalidReturnForHack) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyServiceInvalidReturnForHack({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respMyServiceInvalidReturnForHack) setDefaults() *respMyServiceInvalidReturnForHack { - return x -} - -type reqMyServiceRpcSkippedCodegen struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqMyServiceRpcSkippedCodegen)(nil) - -// Deprecated: MyServiceRpcSkippedCodegenArgsDeprecated is deprecated, since it is supposed to be internal. -type MyServiceRpcSkippedCodegenArgsDeprecated = reqMyServiceRpcSkippedCodegen - -func newReqMyServiceRpcSkippedCodegen() *reqMyServiceRpcSkippedCodegen { - return (&reqMyServiceRpcSkippedCodegen{}).setDefaults() -} - - - -func (x *reqMyServiceRpcSkippedCodegen) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyServiceRpcSkippedCodegen"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceRpcSkippedCodegen) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqMyServiceRpcSkippedCodegen) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqMyServiceRpcSkippedCodegen({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyServiceRpcSkippedCodegen) setDefaults() *reqMyServiceRpcSkippedCodegen { - return x -} - -type respMyServiceRpcSkippedCodegen struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyServiceRpcSkippedCodegen)(nil) -var _ thrift.WritableResult = (*respMyServiceRpcSkippedCodegen)(nil) - -// Deprecated: MyServiceRpcSkippedCodegenResultDeprecated is deprecated, since it is supposed to be internal. -type MyServiceRpcSkippedCodegenResultDeprecated = respMyServiceRpcSkippedCodegen - -func newRespMyServiceRpcSkippedCodegen() *respMyServiceRpcSkippedCodegen { - return (&respMyServiceRpcSkippedCodegen{}).setDefaults() -} - - - -func (x *respMyServiceRpcSkippedCodegen) Exception() thrift.WritableException { - return nil -} - -func (x *respMyServiceRpcSkippedCodegen) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyServiceRpcSkippedCodegen"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respMyServiceRpcSkippedCodegen) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respMyServiceRpcSkippedCodegen) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyServiceRpcSkippedCodegen({") - sb.WriteString("})") - - return sb.String() -} -func (x *respMyServiceRpcSkippedCodegen) setDefaults() *respMyServiceRpcSkippedCodegen { - return x -} - - - -type MyServiceProcessor struct { - processorFunctionMap map[string]thrift.ProcessorFunction - functionServiceMap map[string]string - handler MyService -} -// Compile time interface enforcer -var _ thrift.Processor = (*MyServiceProcessor)(nil) - -func NewMyServiceProcessor(handler MyService) *MyServiceProcessor { - p := &MyServiceProcessor{ - handler: handler, - processorFunctionMap: make(map[string]thrift.ProcessorFunction), - functionServiceMap: make(map[string]string), - } - p.AddToProcessorFunctionMap("ping", &procFuncMyServicePing{handler: handler}) - p.AddToProcessorFunctionMap("getRandomData", &procFuncMyServiceGetRandomData{handler: handler}) - p.AddToProcessorFunctionMap("sink", &procFuncMyServiceSink{handler: handler}) - p.AddToProcessorFunctionMap("putDataById", &procFuncMyServicePutDataById{handler: handler}) - p.AddToProcessorFunctionMap("hasDataById", &procFuncMyServiceHasDataById{handler: handler}) - p.AddToProcessorFunctionMap("getDataById", &procFuncMyServiceGetDataById{handler: handler}) - p.AddToProcessorFunctionMap("deleteDataById", &procFuncMyServiceDeleteDataById{handler: handler}) - p.AddToProcessorFunctionMap("lobDataById", &procFuncMyServiceLobDataById{handler: handler}) - p.AddToProcessorFunctionMap("invalid_return_for_hack", &procFuncMyServiceInvalidReturnForHack{handler: handler}) - p.AddToProcessorFunctionMap("rpc_skipped_codegen", &procFuncMyServiceRpcSkippedCodegen{handler: handler}) - p.AddToFunctionServiceMap("ping", "MyService") - p.AddToFunctionServiceMap("getRandomData", "MyService") - p.AddToFunctionServiceMap("sink", "MyService") - p.AddToFunctionServiceMap("putDataById", "MyService") - p.AddToFunctionServiceMap("hasDataById", "MyService") - p.AddToFunctionServiceMap("getDataById", "MyService") - p.AddToFunctionServiceMap("deleteDataById", "MyService") - p.AddToFunctionServiceMap("lobDataById", "MyService") - p.AddToFunctionServiceMap("invalid_return_for_hack", "MyService") - p.AddToFunctionServiceMap("rpc_skipped_codegen", "MyService") - - return p -} - -func (p *MyServiceProcessor) AddToProcessorFunctionMap(key string, processorFunction thrift.ProcessorFunction) { - p.processorFunctionMap[key] = processorFunction -} - -func (p *MyServiceProcessor) AddToFunctionServiceMap(key, service string) { - p.functionServiceMap[key] = service -} - -func (p *MyServiceProcessor) GetProcessorFunction(key string) (processor thrift.ProcessorFunction) { - return p.processorFunctionMap[key] -} - -func (p *MyServiceProcessor) ProcessorFunctionMap() map[string]thrift.ProcessorFunction { - return p.processorFunctionMap -} - -func (p *MyServiceProcessor) FunctionServiceMap() map[string]string { - return p.functionServiceMap -} - -func (p *MyServiceProcessor) GetThriftMetadata() *metadata.ThriftMetadata { - return GetThriftMetadataForService("module.MyService") -} - - -type procFuncMyServicePing struct { - handler MyService -} -// Compile time interface enforcer -var _ thrift.ProcessorFunction = (*procFuncMyServicePing)(nil) - -func (p *procFuncMyServicePing) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { - args := newReqMyServicePing() - if err := args.Read(iprot); err != nil { - return nil, err - } - iprot.ReadMessageEnd() - return args, nil -} - -func (p *procFuncMyServicePing) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { - var err2 error - messageType := thrift.REPLY - switch result.(type) { - case thrift.ApplicationException: - messageType = thrift.EXCEPTION - } - - if err2 = oprot.WriteMessageBegin("ping", messageType, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - return err -} - -func (p *procFuncMyServicePing) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { - result := newRespMyServicePing() - err := p.handler.Ping(ctx) - if err != nil { - x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing Ping: " + err.Error(), err) - return x, x - } - - return result, nil -} - - -type procFuncMyServiceGetRandomData struct { - handler MyService -} -// Compile time interface enforcer -var _ thrift.ProcessorFunction = (*procFuncMyServiceGetRandomData)(nil) - -func (p *procFuncMyServiceGetRandomData) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { - args := newReqMyServiceGetRandomData() - if err := args.Read(iprot); err != nil { - return nil, err - } - iprot.ReadMessageEnd() - return args, nil -} - -func (p *procFuncMyServiceGetRandomData) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { - var err2 error - messageType := thrift.REPLY - switch result.(type) { - case thrift.ApplicationException: - messageType = thrift.EXCEPTION - } - - if err2 = oprot.WriteMessageBegin("getRandomData", messageType, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - return err -} - -func (p *procFuncMyServiceGetRandomData) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { - result := newRespMyServiceGetRandomData() - retval, err := p.handler.GetRandomData(ctx) - if err != nil { - x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing GetRandomData: " + err.Error(), err) - return x, x - } - - result.Success = &retval - return result, nil -} - - -type procFuncMyServiceSink struct { - handler MyService -} -// Compile time interface enforcer -var _ thrift.ProcessorFunction = (*procFuncMyServiceSink)(nil) - -func (p *procFuncMyServiceSink) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { - args := newReqMyServiceSink() - if err := args.Read(iprot); err != nil { - return nil, err - } - iprot.ReadMessageEnd() - return args, nil -} - -func (p *procFuncMyServiceSink) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { - var err2 error - messageType := thrift.REPLY - switch result.(type) { - case thrift.ApplicationException: - messageType = thrift.EXCEPTION - } - - if err2 = oprot.WriteMessageBegin("sink", messageType, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - return err -} - -func (p *procFuncMyServiceSink) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { - args := reqStruct.(*reqMyServiceSink) - result := newRespMyServiceSink() - err := p.handler.Sink(ctx, args.Sink) - if err != nil { - x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing Sink: " + err.Error(), err) - return x, x - } - - return result, nil -} - - -type procFuncMyServicePutDataById struct { - handler MyService +func (p *MyServiceProcessor) GetProcessorFunction(key string) (processor thrift.ProcessorFunction) { + return p.processorFunctionMap[key] } -// Compile time interface enforcer -var _ thrift.ProcessorFunction = (*procFuncMyServicePutDataById)(nil) -func (p *procFuncMyServicePutDataById) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { - args := newReqMyServicePutDataById() - if err := args.Read(iprot); err != nil { - return nil, err - } - iprot.ReadMessageEnd() - return args, nil +func (p *MyServiceProcessor) ProcessorFunctionMap() map[string]thrift.ProcessorFunction { + return p.processorFunctionMap } -func (p *procFuncMyServicePutDataById) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { - var err2 error - messageType := thrift.REPLY - switch result.(type) { - case thrift.ApplicationException: - messageType = thrift.EXCEPTION - } - - if err2 = oprot.WriteMessageBegin("putDataById", messageType, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - return err +func (p *MyServiceProcessor) FunctionServiceMap() map[string]string { + return p.functionServiceMap } -func (p *procFuncMyServicePutDataById) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { - args := reqStruct.(*reqMyServicePutDataById) - result := newRespMyServicePutDataById() - err := p.handler.PutDataById(ctx, args.Id, args.Data) - if err != nil { - x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing PutDataById: " + err.Error(), err) - return x, x - } - - return result, nil +func (p *MyServiceProcessor) GetThriftMetadata() *metadata.ThriftMetadata { + return GetThriftMetadataForService("module.MyService") } -type procFuncMyServiceHasDataById struct { +type procFuncMyServicePing struct { handler MyService } // Compile time interface enforcer -var _ thrift.ProcessorFunction = (*procFuncMyServiceHasDataById)(nil) +var _ thrift.ProcessorFunction = (*procFuncMyServicePing)(nil) -func (p *procFuncMyServiceHasDataById) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { - args := newReqMyServiceHasDataById() +func (p *procFuncMyServicePing) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { + args := newReqMyServicePing() if err := args.Read(iprot); err != nil { return nil, err } @@ -3804,7 +718,7 @@ func (p *procFuncMyServiceHasDataById) Read(iprot thrift.Decoder) (thrift.Struct return args, nil } -func (p *procFuncMyServiceHasDataById) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { +func (p *procFuncMyServicePing) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { var err2 error messageType := thrift.REPLY switch result.(type) { @@ -3812,7 +726,7 @@ func (p *procFuncMyServiceHasDataById) Write(seqId int32, result thrift.Writable messageType = thrift.EXCEPTION } - if err2 = oprot.WriteMessageBegin("hasDataById", messageType, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin("ping", messageType, seqId); err2 != nil { err = err2 } if err2 = result.Write(oprot); err == nil && err2 != nil { @@ -3827,28 +741,26 @@ func (p *procFuncMyServiceHasDataById) Write(seqId int32, result thrift.Writable return err } -func (p *procFuncMyServiceHasDataById) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { - args := reqStruct.(*reqMyServiceHasDataById) - result := newRespMyServiceHasDataById() - retval, err := p.handler.HasDataById(ctx, args.Id) +func (p *procFuncMyServicePing) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { + result := newRespMyServicePing() + err := p.handler.Ping(ctx) if err != nil { - x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing HasDataById: " + err.Error(), err) + x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing Ping: " + err.Error(), err) return x, x } - result.Success = &retval return result, nil } -type procFuncMyServiceGetDataById struct { +type procFuncMyServiceGetRandomData struct { handler MyService } // Compile time interface enforcer -var _ thrift.ProcessorFunction = (*procFuncMyServiceGetDataById)(nil) +var _ thrift.ProcessorFunction = (*procFuncMyServiceGetRandomData)(nil) -func (p *procFuncMyServiceGetDataById) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { - args := newReqMyServiceGetDataById() +func (p *procFuncMyServiceGetRandomData) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { + args := newReqMyServiceGetRandomData() if err := args.Read(iprot); err != nil { return nil, err } @@ -3856,7 +768,7 @@ func (p *procFuncMyServiceGetDataById) Read(iprot thrift.Decoder) (thrift.Struct return args, nil } -func (p *procFuncMyServiceGetDataById) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { +func (p *procFuncMyServiceGetRandomData) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { var err2 error messageType := thrift.REPLY switch result.(type) { @@ -3864,7 +776,7 @@ func (p *procFuncMyServiceGetDataById) Write(seqId int32, result thrift.Writable messageType = thrift.EXCEPTION } - if err2 = oprot.WriteMessageBegin("getDataById", messageType, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin("getRandomData", messageType, seqId); err2 != nil { err = err2 } if err2 = result.Write(oprot); err == nil && err2 != nil { @@ -3879,12 +791,11 @@ func (p *procFuncMyServiceGetDataById) Write(seqId int32, result thrift.Writable return err } -func (p *procFuncMyServiceGetDataById) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { - args := reqStruct.(*reqMyServiceGetDataById) - result := newRespMyServiceGetDataById() - retval, err := p.handler.GetDataById(ctx, args.Id) +func (p *procFuncMyServiceGetRandomData) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { + result := newRespMyServiceGetRandomData() + retval, err := p.handler.GetRandomData(ctx) if err != nil { - x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing GetDataById: " + err.Error(), err) + x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing GetRandomData: " + err.Error(), err) return x, x } @@ -3893,14 +804,14 @@ func (p *procFuncMyServiceGetDataById) RunContext(ctx context.Context, reqStruct } -type procFuncMyServiceDeleteDataById struct { +type procFuncMyServiceSink struct { handler MyService } // Compile time interface enforcer -var _ thrift.ProcessorFunction = (*procFuncMyServiceDeleteDataById)(nil) +var _ thrift.ProcessorFunction = (*procFuncMyServiceSink)(nil) -func (p *procFuncMyServiceDeleteDataById) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { - args := newReqMyServiceDeleteDataById() +func (p *procFuncMyServiceSink) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { + args := newReqMyServiceSink() if err := args.Read(iprot); err != nil { return nil, err } @@ -3908,7 +819,7 @@ func (p *procFuncMyServiceDeleteDataById) Read(iprot thrift.Decoder) (thrift.Str return args, nil } -func (p *procFuncMyServiceDeleteDataById) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { +func (p *procFuncMyServiceSink) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { var err2 error messageType := thrift.REPLY switch result.(type) { @@ -3916,7 +827,7 @@ func (p *procFuncMyServiceDeleteDataById) Write(seqId int32, result thrift.Writa messageType = thrift.EXCEPTION } - if err2 = oprot.WriteMessageBegin("deleteDataById", messageType, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin("sink", messageType, seqId); err2 != nil { err = err2 } if err2 = result.Write(oprot); err == nil && err2 != nil { @@ -3931,12 +842,12 @@ func (p *procFuncMyServiceDeleteDataById) Write(seqId int32, result thrift.Writa return err } -func (p *procFuncMyServiceDeleteDataById) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { - args := reqStruct.(*reqMyServiceDeleteDataById) - result := newRespMyServiceDeleteDataById() - err := p.handler.DeleteDataById(ctx, args.Id) +func (p *procFuncMyServiceSink) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { + args := reqStruct.(*reqMyServiceSink) + result := newRespMyServiceSink() + err := p.handler.Sink(ctx, args.Sink) if err != nil { - x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing DeleteDataById: " + err.Error(), err) + x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing Sink: " + err.Error(), err) return x, x } @@ -3944,64 +855,14 @@ func (p *procFuncMyServiceDeleteDataById) RunContext(ctx context.Context, reqStr } -type procFuncMyServiceLobDataById struct { - handler MyService -} -// Compile time interface enforcer -var _ thrift.ProcessorFunction = (*procFuncMyServiceLobDataById)(nil) - -func (p *procFuncMyServiceLobDataById) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { - args := newReqMyServiceLobDataById() - if err := args.Read(iprot); err != nil { - return nil, err - } - iprot.ReadMessageEnd() - return args, nil -} - -func (p *procFuncMyServiceLobDataById) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { - var err2 error - messageType := thrift.REPLY - switch result.(type) { - case thrift.ApplicationException: - messageType = thrift.EXCEPTION - } - - if err2 = oprot.WriteMessageBegin("lobDataById", messageType, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - return err -} - -func (p *procFuncMyServiceLobDataById) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { - args := reqStruct.(*reqMyServiceLobDataById) - err := p.handler.LobDataById(ctx, args.Id, args.Data) - if err != nil { - x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing LobDataById: " + err.Error(), err) - return x, x - } - - return nil, nil -} - - -type procFuncMyServiceInvalidReturnForHack struct { +type procFuncMyServicePutDataById struct { handler MyService } // Compile time interface enforcer -var _ thrift.ProcessorFunction = (*procFuncMyServiceInvalidReturnForHack)(nil) - -func (p *procFuncMyServiceInvalidReturnForHack) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { - args := newReqMyServiceInvalidReturnForHack() +var _ thrift.ProcessorFunction = (*procFuncMyServicePutDataById)(nil) + +func (p *procFuncMyServicePutDataById) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { + args := newReqMyServicePutDataById() if err := args.Read(iprot); err != nil { return nil, err } @@ -4009,7 +870,7 @@ func (p *procFuncMyServiceInvalidReturnForHack) Read(iprot thrift.Decoder) (thri return args, nil } -func (p *procFuncMyServiceInvalidReturnForHack) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { +func (p *procFuncMyServicePutDataById) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { var err2 error messageType := thrift.REPLY switch result.(type) { @@ -4017,7 +878,7 @@ func (p *procFuncMyServiceInvalidReturnForHack) Write(seqId int32, result thrift messageType = thrift.EXCEPTION } - if err2 = oprot.WriteMessageBegin("invalid_return_for_hack", messageType, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin("putDataById", messageType, seqId); err2 != nil { err = err2 } if err2 = result.Write(oprot); err == nil && err2 != nil { @@ -4032,27 +893,27 @@ func (p *procFuncMyServiceInvalidReturnForHack) Write(seqId int32, result thrift return err } -func (p *procFuncMyServiceInvalidReturnForHack) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { - result := newRespMyServiceInvalidReturnForHack() - retval, err := p.handler.InvalidReturnForHack(ctx) +func (p *procFuncMyServicePutDataById) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { + args := reqStruct.(*reqMyServicePutDataById) + result := newRespMyServicePutDataById() + err := p.handler.PutDataById(ctx, args.Id, args.Data) if err != nil { - x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing InvalidReturnForHack: " + err.Error(), err) + x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing PutDataById: " + err.Error(), err) return x, x } - result.Success = retval return result, nil } -type procFuncMyServiceRpcSkippedCodegen struct { +type procFuncMyServiceHasDataById struct { handler MyService } // Compile time interface enforcer -var _ thrift.ProcessorFunction = (*procFuncMyServiceRpcSkippedCodegen)(nil) +var _ thrift.ProcessorFunction = (*procFuncMyServiceHasDataById)(nil) -func (p *procFuncMyServiceRpcSkippedCodegen) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { - args := newReqMyServiceRpcSkippedCodegen() +func (p *procFuncMyServiceHasDataById) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { + args := newReqMyServiceHasDataById() if err := args.Read(iprot); err != nil { return nil, err } @@ -4060,7 +921,7 @@ func (p *procFuncMyServiceRpcSkippedCodegen) Read(iprot thrift.Decoder) (thrift. return args, nil } -func (p *procFuncMyServiceRpcSkippedCodegen) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { +func (p *procFuncMyServiceHasDataById) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { var err2 error messageType := thrift.REPLY switch result.(type) { @@ -4068,7 +929,7 @@ func (p *procFuncMyServiceRpcSkippedCodegen) Write(seqId int32, result thrift.Wr messageType = thrift.EXCEPTION } - if err2 = oprot.WriteMessageBegin("rpc_skipped_codegen", messageType, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin("hasDataById", messageType, seqId); err2 != nil { err = err2 } if err2 = result.Write(oprot); err == nil && err2 != nil { @@ -4083,685 +944,370 @@ func (p *procFuncMyServiceRpcSkippedCodegen) Write(seqId int32, result thrift.Wr return err } -func (p *procFuncMyServiceRpcSkippedCodegen) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { - result := newRespMyServiceRpcSkippedCodegen() - err := p.handler.RpcSkippedCodegen(ctx) +func (p *procFuncMyServiceHasDataById) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { + args := reqStruct.(*reqMyServiceHasDataById) + result := newRespMyServiceHasDataById() + retval, err := p.handler.HasDataById(ctx, args.Id) if err != nil { - x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing RpcSkippedCodegen: " + err.Error(), err) + x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing HasDataById: " + err.Error(), err) return x, x } + result.Success = &retval return result, nil } -type DbMixedStackArguments interface { - GetDataByKey0(ctx context.Context, key string) ([]byte, error) - GetDataByKey1(ctx context.Context, key string) ([]byte, error) -} - -type DbMixedStackArgumentsChannelClientInterface interface { - thrift.ClientInterface - DbMixedStackArguments -} - -type DbMixedStackArgumentsClientInterface interface { - thrift.ClientInterface - GetDataByKey0(key string) ([]byte, error) - GetDataByKey1(key string) ([]byte, error) -} - -type DbMixedStackArgumentsContextClientInterface interface { - DbMixedStackArgumentsClientInterface - GetDataByKey0Context(ctx context.Context, key string) ([]byte, error) - GetDataByKey1Context(ctx context.Context, key string) ([]byte, error) -} - -type DbMixedStackArgumentsChannelClient struct { - ch thrift.RequestChannel +type procFuncMyServiceGetDataById struct { + handler MyService } // Compile time interface enforcer -var _ DbMixedStackArgumentsChannelClientInterface = (*DbMixedStackArgumentsChannelClient)(nil) +var _ thrift.ProcessorFunction = (*procFuncMyServiceGetDataById)(nil) -func NewDbMixedStackArgumentsChannelClient(channel thrift.RequestChannel) *DbMixedStackArgumentsChannelClient { - return &DbMixedStackArgumentsChannelClient{ - ch: channel, +func (p *procFuncMyServiceGetDataById) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { + args := newReqMyServiceGetDataById() + if err := args.Read(iprot); err != nil { + return nil, err } + iprot.ReadMessageEnd() + return args, nil } -func (c *DbMixedStackArgumentsChannelClient) Close() error { - return c.ch.Close() -} - -type DbMixedStackArgumentsClient struct { - chClient *DbMixedStackArgumentsChannelClient -} -// Compile time interface enforcer -var _ DbMixedStackArgumentsClientInterface = (*DbMixedStackArgumentsClient)(nil) -var _ DbMixedStackArgumentsContextClientInterface = (*DbMixedStackArgumentsClient)(nil) - -func NewDbMixedStackArgumentsClient(prot thrift.Protocol) *DbMixedStackArgumentsClient { - return &DbMixedStackArgumentsClient{ - chClient: NewDbMixedStackArgumentsChannelClient( - thrift.NewSerialChannel(prot), - ), +func (p *procFuncMyServiceGetDataById) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { + var err2 error + messageType := thrift.REPLY + switch result.(type) { + case thrift.ApplicationException: + messageType = thrift.EXCEPTION } -} - -func (c *DbMixedStackArgumentsClient) Close() error { - return c.chClient.Close() -} -func (c *DbMixedStackArgumentsChannelClient) GetDataByKey0(ctx context.Context, key string) ([]byte, error) { - in := &reqDbMixedStackArgumentsGetDataByKey0{ - Key: key, - } - out := newRespDbMixedStackArgumentsGetDataByKey0() - err := c.ch.Call(ctx, "getDataByKey0", in, out) - if err != nil { - return nil, err + if err2 = oprot.WriteMessageBegin("getDataById", messageType, seqId); err2 != nil { + err = err2 } - return out.GetSuccess(), nil -} - -func (c *DbMixedStackArgumentsClient) GetDataByKey0(key string) ([]byte, error) { - return c.chClient.GetDataByKey0(context.Background(), key) -} - -func (c *DbMixedStackArgumentsClient) GetDataByKey0Context(ctx context.Context, key string) ([]byte, error) { - return c.chClient.GetDataByKey0(ctx, key) -} - -func (c *DbMixedStackArgumentsChannelClient) GetDataByKey1(ctx context.Context, key string) ([]byte, error) { - in := &reqDbMixedStackArgumentsGetDataByKey1{ - Key: key, + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 } - out := newRespDbMixedStackArgumentsGetDataByKey1() - err := c.ch.Call(ctx, "getDataByKey1", in, out) - if err != nil { - return nil, err + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 } - return out.GetSuccess(), nil -} - -func (c *DbMixedStackArgumentsClient) GetDataByKey1(key string) ([]byte, error) { - return c.chClient.GetDataByKey1(context.Background(), key) -} - -func (c *DbMixedStackArgumentsClient) GetDataByKey1Context(ctx context.Context, key string) ([]byte, error) { - return c.chClient.GetDataByKey1(ctx, key) -} - -type reqDbMixedStackArgumentsGetDataByKey0 struct { - Key string `thrift:"key,1" json:"key" db:"key"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqDbMixedStackArgumentsGetDataByKey0)(nil) - -// Deprecated: DbMixedStackArgumentsGetDataByKey0ArgsDeprecated is deprecated, since it is supposed to be internal. -type DbMixedStackArgumentsGetDataByKey0ArgsDeprecated = reqDbMixedStackArgumentsGetDataByKey0 - -func newReqDbMixedStackArgumentsGetDataByKey0() *reqDbMixedStackArgumentsGetDataByKey0 { - return (&reqDbMixedStackArgumentsGetDataByKey0{}).setDefaults() -} - -func (x *reqDbMixedStackArgumentsGetDataByKey0) GetKey() string { - return x.Key -} - -func (x *reqDbMixedStackArgumentsGetDataByKey0) SetKeyNonCompat(value string) *reqDbMixedStackArgumentsGetDataByKey0 { - x.Key = value - return x -} - -func (x *reqDbMixedStackArgumentsGetDataByKey0) SetKey(value string) *reqDbMixedStackArgumentsGetDataByKey0 { - x.Key = value - return x -} - -func (x *reqDbMixedStackArgumentsGetDataByKey0) writeField1(p thrift.Encoder) error { // Key - if err := p.WriteFieldBegin("key", thrift.STRING, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 } - - item := x.Key - if err := p.WriteString(item); err != nil { return err } - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) +func (p *procFuncMyServiceGetDataById) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { + args := reqStruct.(*reqMyServiceGetDataById) + result := newRespMyServiceGetDataById() + retval, err := p.handler.GetDataById(ctx, args.Id) + if err != nil { + x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing GetDataById: " + err.Error(), err) + return x, x } - return nil -} - -func (x *reqDbMixedStackArgumentsGetDataByKey0) readField1(p thrift.Decoder) error { // Key - result, err := p.ReadString() -if err != nil { - return err -} - - x.Key = result - return nil -} -func (x *reqDbMixedStackArgumentsGetDataByKey0) toString1() string { // Key - return fmt.Sprintf("%v", x.Key) + result.Success = &retval + return result, nil } - -func (x *reqDbMixedStackArgumentsGetDataByKey0) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqDbMixedStackArgumentsGetDataByKey0"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil +type procFuncMyServiceDeleteDataById struct { + handler MyService } +// Compile time interface enforcer +var _ thrift.ProcessorFunction = (*procFuncMyServiceDeleteDataById)(nil) -func (x *reqDbMixedStackArgumentsGetDataByKey0) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.STRING)): // key - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) +func (p *procFuncMyServiceDeleteDataById) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { + args := newReqMyServiceDeleteDataById() + if err := args.Read(iprot); err != nil { + return nil, err } - - return nil + iprot.ReadMessageEnd() + return args, nil } -func (x *reqDbMixedStackArgumentsGetDataByKey0) String() string { - if x == nil { - return "" +func (p *procFuncMyServiceDeleteDataById) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { + var err2 error + messageType := thrift.REPLY + switch result.(type) { + case thrift.ApplicationException: + messageType = thrift.EXCEPTION } - var sb strings.Builder - - sb.WriteString("reqDbMixedStackArgumentsGetDataByKey0({") - sb.WriteString(fmt.Sprintf("Key:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqDbMixedStackArgumentsGetDataByKey0) setDefaults() *reqDbMixedStackArgumentsGetDataByKey0 { - return x. - SetKeyNonCompat("") -} - -type respDbMixedStackArgumentsGetDataByKey0 struct { - Success []byte `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respDbMixedStackArgumentsGetDataByKey0)(nil) -var _ thrift.WritableResult = (*respDbMixedStackArgumentsGetDataByKey0)(nil) - -// Deprecated: DbMixedStackArgumentsGetDataByKey0ResultDeprecated is deprecated, since it is supposed to be internal. -type DbMixedStackArgumentsGetDataByKey0ResultDeprecated = respDbMixedStackArgumentsGetDataByKey0 - -func newRespDbMixedStackArgumentsGetDataByKey0() *respDbMixedStackArgumentsGetDataByKey0 { - return (&respDbMixedStackArgumentsGetDataByKey0{}).setDefaults() -} - -func (x *respDbMixedStackArgumentsGetDataByKey0) GetSuccess() []byte { - if !x.IsSetSuccess() { - return []byte("") + if err2 = oprot.WriteMessageBegin("deleteDataById", messageType, seqId); err2 != nil { + err = err2 } - return x.Success -} - -func (x *respDbMixedStackArgumentsGetDataByKey0) SetSuccessNonCompat(value []byte) *respDbMixedStackArgumentsGetDataByKey0 { - x.Success = value - return x -} - -func (x *respDbMixedStackArgumentsGetDataByKey0) SetSuccess(value []byte) *respDbMixedStackArgumentsGetDataByKey0 { - x.Success = value - return x -} - -func (x *respDbMixedStackArgumentsGetDataByKey0) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respDbMixedStackArgumentsGetDataByKey0) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 } - - if err := p.WriteFieldBegin("success", thrift.STRING, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 } - - item := x.Success - if err := p.WriteBinary(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 } - return nil -} - -func (x *respDbMixedStackArgumentsGetDataByKey0) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadBinary() -if err != nil { return err } - x.Success = result - return nil -} +func (p *procFuncMyServiceDeleteDataById) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { + args := reqStruct.(*reqMyServiceDeleteDataById) + result := newRespMyServiceDeleteDataById() + err := p.handler.DeleteDataById(ctx, args.Id) + if err != nil { + x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing DeleteDataById: " + err.Error(), err) + return x, x + } -func (x *respDbMixedStackArgumentsGetDataByKey0) toString0() string { // Success - return fmt.Sprintf("%v", x.Success) + return result, nil } - -func (x *respDbMixedStackArgumentsGetDataByKey0) Exception() thrift.WritableException { - return nil +type procFuncMyServiceLobDataById struct { + handler MyService } +// Compile time interface enforcer +var _ thrift.ProcessorFunction = (*procFuncMyServiceLobDataById)(nil) -func (x *respDbMixedStackArgumentsGetDataByKey0) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respDbMixedStackArgumentsGetDataByKey0"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err +func (p *procFuncMyServiceLobDataById) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { + args := newReqMyServiceLobDataById() + if err := args.Read(iprot); err != nil { + return nil, err } + iprot.ReadMessageEnd() + return args, nil +} - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) +func (p *procFuncMyServiceLobDataById) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { + var err2 error + messageType := thrift.REPLY + switch result.(type) { + case thrift.ApplicationException: + messageType = thrift.EXCEPTION } - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + if err2 = oprot.WriteMessageBegin("lobDataById", messageType, seqId); err2 != nil { + err = err2 } - return nil -} - -func (x *respDbMixedStackArgumentsGetDataByKey0) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.STRING)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 } - - return nil + return err } -func (x *respDbMixedStackArgumentsGetDataByKey0) String() string { - if x == nil { - return "" +func (p *procFuncMyServiceLobDataById) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { + args := reqStruct.(*reqMyServiceLobDataById) + err := p.handler.LobDataById(ctx, args.Id, args.Data) + if err != nil { + x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing LobDataById: " + err.Error(), err) + return x, x } - var sb strings.Builder - - sb.WriteString("respDbMixedStackArgumentsGetDataByKey0({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respDbMixedStackArgumentsGetDataByKey0) setDefaults() *respDbMixedStackArgumentsGetDataByKey0 { - return x -} - -type reqDbMixedStackArgumentsGetDataByKey1 struct { - Key string `thrift:"key,1" json:"key" db:"key"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqDbMixedStackArgumentsGetDataByKey1)(nil) - -// Deprecated: DbMixedStackArgumentsGetDataByKey1ArgsDeprecated is deprecated, since it is supposed to be internal. -type DbMixedStackArgumentsGetDataByKey1ArgsDeprecated = reqDbMixedStackArgumentsGetDataByKey1 - -func newReqDbMixedStackArgumentsGetDataByKey1() *reqDbMixedStackArgumentsGetDataByKey1 { - return (&reqDbMixedStackArgumentsGetDataByKey1{}).setDefaults() + return nil, nil } -func (x *reqDbMixedStackArgumentsGetDataByKey1) GetKey() string { - return x.Key -} -func (x *reqDbMixedStackArgumentsGetDataByKey1) SetKeyNonCompat(value string) *reqDbMixedStackArgumentsGetDataByKey1 { - x.Key = value - return x +type procFuncMyServiceInvalidReturnForHack struct { + handler MyService } +// Compile time interface enforcer +var _ thrift.ProcessorFunction = (*procFuncMyServiceInvalidReturnForHack)(nil) -func (x *reqDbMixedStackArgumentsGetDataByKey1) SetKey(value string) *reqDbMixedStackArgumentsGetDataByKey1 { - x.Key = value - return x +func (p *procFuncMyServiceInvalidReturnForHack) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { + args := newReqMyServiceInvalidReturnForHack() + if err := args.Read(iprot); err != nil { + return nil, err + } + iprot.ReadMessageEnd() + return args, nil } -func (x *reqDbMixedStackArgumentsGetDataByKey1) writeField1(p thrift.Encoder) error { // Key - if err := p.WriteFieldBegin("key", thrift.STRING, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) +func (p *procFuncMyServiceInvalidReturnForHack) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { + var err2 error + messageType := thrift.REPLY + switch result.(type) { + case thrift.ApplicationException: + messageType = thrift.EXCEPTION } - item := x.Key - if err := p.WriteString(item); err != nil { + if err2 = oprot.WriteMessageBegin("invalid_return_for_hack", messageType, seqId); err2 != nil { + err = err2 + } + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 + } return err } - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) +func (p *procFuncMyServiceInvalidReturnForHack) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { + result := newRespMyServiceInvalidReturnForHack() + retval, err := p.handler.InvalidReturnForHack(ctx) + if err != nil { + x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing InvalidReturnForHack: " + err.Error(), err) + return x, x } - return nil -} -func (x *reqDbMixedStackArgumentsGetDataByKey1) readField1(p thrift.Decoder) error { // Key - result, err := p.ReadString() -if err != nil { - return err + result.Success = retval + return result, nil } - x.Key = result - return nil -} -func (x *reqDbMixedStackArgumentsGetDataByKey1) toString1() string { // Key - return fmt.Sprintf("%v", x.Key) +type procFuncMyServiceRpcSkippedCodegen struct { + handler MyService } +// Compile time interface enforcer +var _ thrift.ProcessorFunction = (*procFuncMyServiceRpcSkippedCodegen)(nil) - - -func (x *reqDbMixedStackArgumentsGetDataByKey1) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqDbMixedStackArgumentsGetDataByKey1"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err +func (p *procFuncMyServiceRpcSkippedCodegen) Read(iprot thrift.Decoder) (thrift.Struct, thrift.Exception) { + args := newReqMyServiceRpcSkippedCodegen() + if err := args.Read(iprot); err != nil { + return nil, err } + iprot.ReadMessageEnd() + return args, nil +} - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) +func (p *procFuncMyServiceRpcSkippedCodegen) Write(seqId int32, result thrift.WritableStruct, oprot thrift.Encoder) (err thrift.Exception) { + var err2 error + messageType := thrift.REPLY + switch result.(type) { + case thrift.ApplicationException: + messageType = thrift.EXCEPTION } - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + if err2 = oprot.WriteMessageBegin("rpc_skipped_codegen", messageType, seqId); err2 != nil { + err = err2 } - return nil -} - -func (x *reqDbMixedStackArgumentsGetDataByKey1) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.STRING)): // key - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + if err2 = oprot.Flush(); err == nil && err2 != nil { + err = err2 } - - return nil + return err } -func (x *reqDbMixedStackArgumentsGetDataByKey1) String() string { - if x == nil { - return "" +func (p *procFuncMyServiceRpcSkippedCodegen) RunContext(ctx context.Context, reqStruct thrift.Struct) (thrift.WritableStruct, thrift.ApplicationException) { + result := newRespMyServiceRpcSkippedCodegen() + err := p.handler.RpcSkippedCodegen(ctx) + if err != nil { + x := thrift.NewApplicationExceptionCause(thrift.INTERNAL_ERROR, "Internal error processing RpcSkippedCodegen: " + err.Error(), err) + return x, x } - var sb strings.Builder - - sb.WriteString("reqDbMixedStackArgumentsGetDataByKey1({") - sb.WriteString(fmt.Sprintf("Key:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqDbMixedStackArgumentsGetDataByKey1) setDefaults() *reqDbMixedStackArgumentsGetDataByKey1 { - return x. - SetKeyNonCompat("") -} - -type respDbMixedStackArgumentsGetDataByKey1 struct { - Success []byte `thrift:"success,0,optional" json:"success,omitempty" db:"success"` + return result, nil } -// Compile time interface enforcer -var _ thrift.Struct = (*respDbMixedStackArgumentsGetDataByKey1)(nil) -var _ thrift.WritableResult = (*respDbMixedStackArgumentsGetDataByKey1)(nil) -// Deprecated: DbMixedStackArgumentsGetDataByKey1ResultDeprecated is deprecated, since it is supposed to be internal. -type DbMixedStackArgumentsGetDataByKey1ResultDeprecated = respDbMixedStackArgumentsGetDataByKey1 -func newRespDbMixedStackArgumentsGetDataByKey1() *respDbMixedStackArgumentsGetDataByKey1 { - return (&respDbMixedStackArgumentsGetDataByKey1{}).setDefaults() -} - -func (x *respDbMixedStackArgumentsGetDataByKey1) GetSuccess() []byte { - if !x.IsSetSuccess() { - return []byte("") - } - return x.Success +type DbMixedStackArguments interface { + GetDataByKey0(ctx context.Context, key string) ([]byte, error) + GetDataByKey1(ctx context.Context, key string) ([]byte, error) } -func (x *respDbMixedStackArgumentsGetDataByKey1) SetSuccessNonCompat(value []byte) *respDbMixedStackArgumentsGetDataByKey1 { - x.Success = value - return x +type DbMixedStackArgumentsChannelClientInterface interface { + thrift.ClientInterface + DbMixedStackArguments } -func (x *respDbMixedStackArgumentsGetDataByKey1) SetSuccess(value []byte) *respDbMixedStackArgumentsGetDataByKey1 { - x.Success = value - return x +type DbMixedStackArgumentsClientInterface interface { + thrift.ClientInterface + GetDataByKey0(key string) ([]byte, error) + GetDataByKey1(key string) ([]byte, error) } -func (x *respDbMixedStackArgumentsGetDataByKey1) IsSetSuccess() bool { - return x != nil && x.Success != nil +type DbMixedStackArgumentsContextClientInterface interface { + DbMixedStackArgumentsClientInterface + GetDataByKey0Context(ctx context.Context, key string) ([]byte, error) + GetDataByKey1Context(ctx context.Context, key string) ([]byte, error) } -func (x *respDbMixedStackArgumentsGetDataByKey1) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.STRING, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Success - if err := p.WriteBinary(item); err != nil { - return err +type DbMixedStackArgumentsChannelClient struct { + ch thrift.RequestChannel } +// Compile time interface enforcer +var _ DbMixedStackArgumentsChannelClientInterface = (*DbMixedStackArgumentsChannelClient)(nil) - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) +func NewDbMixedStackArgumentsChannelClient(channel thrift.RequestChannel) *DbMixedStackArgumentsChannelClient { + return &DbMixedStackArgumentsChannelClient{ + ch: channel, } - return nil } -func (x *respDbMixedStackArgumentsGetDataByKey1) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadBinary() -if err != nil { - return err +func (c *DbMixedStackArgumentsChannelClient) Close() error { + return c.ch.Close() } - x.Success = result - return nil +type DbMixedStackArgumentsClient struct { + chClient *DbMixedStackArgumentsChannelClient } +// Compile time interface enforcer +var _ DbMixedStackArgumentsClientInterface = (*DbMixedStackArgumentsClient)(nil) +var _ DbMixedStackArgumentsContextClientInterface = (*DbMixedStackArgumentsClient)(nil) -func (x *respDbMixedStackArgumentsGetDataByKey1) toString0() string { // Success - return fmt.Sprintf("%v", x.Success) +func NewDbMixedStackArgumentsClient(prot thrift.Protocol) *DbMixedStackArgumentsClient { + return &DbMixedStackArgumentsClient{ + chClient: NewDbMixedStackArgumentsChannelClient( + thrift.NewSerialChannel(prot), + ), + } } - - -func (x *respDbMixedStackArgumentsGetDataByKey1) Exception() thrift.WritableException { - return nil +func (c *DbMixedStackArgumentsClient) Close() error { + return c.chClient.Close() } -func (x *respDbMixedStackArgumentsGetDataByKey1) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respDbMixedStackArgumentsGetDataByKey1"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) +func (c *DbMixedStackArgumentsChannelClient) GetDataByKey0(ctx context.Context, key string) ([]byte, error) { + in := &reqDbMixedStackArgumentsGetDataByKey0{ + Key: key, } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + out := newRespDbMixedStackArgumentsGetDataByKey0() + err := c.ch.Call(ctx, "getDataByKey0", in, out) + if err != nil { + return nil, err } - return nil + return out.GetSuccess(), nil } -func (x *respDbMixedStackArgumentsGetDataByKey1) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.STRING)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } +func (c *DbMixedStackArgumentsClient) GetDataByKey0(key string) ([]byte, error) { + return c.chClient.GetDataByKey0(context.Background(), key) +} - if fieldReadErr != nil { - return fieldReadErr - } +func (c *DbMixedStackArgumentsClient) GetDataByKey0Context(ctx context.Context, key string) ([]byte, error) { + return c.chClient.GetDataByKey0(ctx, key) +} - if err := p.ReadFieldEnd(); err != nil { - return err - } +func (c *DbMixedStackArgumentsChannelClient) GetDataByKey1(ctx context.Context, key string) ([]byte, error) { + in := &reqDbMixedStackArgumentsGetDataByKey1{ + Key: key, } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + out := newRespDbMixedStackArgumentsGetDataByKey1() + err := c.ch.Call(ctx, "getDataByKey1", in, out) + if err != nil { + return nil, err } - - return nil + return out.GetSuccess(), nil } -func (x *respDbMixedStackArgumentsGetDataByKey1) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respDbMixedStackArgumentsGetDataByKey1({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respDbMixedStackArgumentsGetDataByKey1) setDefaults() *respDbMixedStackArgumentsGetDataByKey1 { - return x +func (c *DbMixedStackArgumentsClient) GetDataByKey1(key string) ([]byte, error) { + return c.chClient.GetDataByKey1(context.Background(), key) } +func (c *DbMixedStackArgumentsClient) GetDataByKey1Context(ctx context.Context, key string) ([]byte, error) { + return c.chClient.GetDataByKey1(ctx, key) +} type DbMixedStackArgumentsProcessor struct { diff --git a/thrift/compiler/test/fixtures/basic/out/go/gen-go/module/types.go b/thrift/compiler/test/fixtures/basic/out/go/gen-go/module/types.go index 81a93771658..6c4df5c14c4 100644 --- a/thrift/compiler/test/fixtures/basic/out/go/gen-go/module/types.go +++ b/thrift/compiler/test/fixtures/basic/out/go/gen-go/module/types.go @@ -2575,6 +2575,3458 @@ func (x *UnionToBeRenamed) setDefaults() *UnionToBeRenamed { } +// Service req/resp structs (below) +type reqFooServiceSimpleRPC struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqFooServiceSimpleRPC)(nil) + +// Deprecated: FooServiceSimpleRPCArgsDeprecated is deprecated, since it is supposed to be internal. +type FooServiceSimpleRPCArgsDeprecated = reqFooServiceSimpleRPC + +func newReqFooServiceSimpleRPC() *reqFooServiceSimpleRPC { + return (&reqFooServiceSimpleRPC{}).setDefaults() +} + + + +func (x *reqFooServiceSimpleRPC) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqFooServiceSimpleRPC"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqFooServiceSimpleRPC) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqFooServiceSimpleRPC) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqFooServiceSimpleRPC({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqFooServiceSimpleRPC) setDefaults() *reqFooServiceSimpleRPC { + return x +} + +type respFooServiceSimpleRPC struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respFooServiceSimpleRPC)(nil) +var _ thrift.WritableResult = (*respFooServiceSimpleRPC)(nil) + +// Deprecated: FooServiceSimpleRPCResultDeprecated is deprecated, since it is supposed to be internal. +type FooServiceSimpleRPCResultDeprecated = respFooServiceSimpleRPC + +func newRespFooServiceSimpleRPC() *respFooServiceSimpleRPC { + return (&respFooServiceSimpleRPC{}).setDefaults() +} + + + +func (x *respFooServiceSimpleRPC) Exception() thrift.WritableException { + return nil +} + +func (x *respFooServiceSimpleRPC) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respFooServiceSimpleRPC"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respFooServiceSimpleRPC) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respFooServiceSimpleRPC) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respFooServiceSimpleRPC({") + sb.WriteString("})") + + return sb.String() +} +func (x *respFooServiceSimpleRPC) setDefaults() *respFooServiceSimpleRPC { + return x +} + +type reqFB303ServiceSimpleRPC struct { + IntParameter int32 `thrift:"int_parameter,1" json:"int_parameter" db:"int_parameter"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqFB303ServiceSimpleRPC)(nil) + +// Deprecated: FB303ServiceSimpleRPCArgsDeprecated is deprecated, since it is supposed to be internal. +type FB303ServiceSimpleRPCArgsDeprecated = reqFB303ServiceSimpleRPC + +func newReqFB303ServiceSimpleRPC() *reqFB303ServiceSimpleRPC { + return (&reqFB303ServiceSimpleRPC{}).setDefaults() +} + +func (x *reqFB303ServiceSimpleRPC) GetIntParameter() int32 { + return x.IntParameter +} + +func (x *reqFB303ServiceSimpleRPC) SetIntParameterNonCompat(value int32) *reqFB303ServiceSimpleRPC { + x.IntParameter = value + return x +} + +func (x *reqFB303ServiceSimpleRPC) SetIntParameter(value int32) *reqFB303ServiceSimpleRPC { + x.IntParameter = value + return x +} + +func (x *reqFB303ServiceSimpleRPC) writeField1(p thrift.Encoder) error { // IntParameter + if err := p.WriteFieldBegin("int_parameter", thrift.I32, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.IntParameter + if err := p.WriteI32(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqFB303ServiceSimpleRPC) readField1(p thrift.Decoder) error { // IntParameter + result, err := p.ReadI32() +if err != nil { + return err +} + + x.IntParameter = result + return nil +} + +func (x *reqFB303ServiceSimpleRPC) toString1() string { // IntParameter + return fmt.Sprintf("%v", x.IntParameter) +} + + + +func (x *reqFB303ServiceSimpleRPC) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqFB303ServiceSimpleRPC"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqFB303ServiceSimpleRPC) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I32)): // int_parameter + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqFB303ServiceSimpleRPC) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqFB303ServiceSimpleRPC({") + sb.WriteString(fmt.Sprintf("IntParameter:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqFB303ServiceSimpleRPC) setDefaults() *reqFB303ServiceSimpleRPC { + return x. + SetIntParameterNonCompat(0) +} + +type respFB303ServiceSimpleRPC struct { + Success *ReservedKeyword `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respFB303ServiceSimpleRPC)(nil) +var _ thrift.WritableResult = (*respFB303ServiceSimpleRPC)(nil) + +// Deprecated: FB303ServiceSimpleRPCResultDeprecated is deprecated, since it is supposed to be internal. +type FB303ServiceSimpleRPCResultDeprecated = respFB303ServiceSimpleRPC + +func newRespFB303ServiceSimpleRPC() *respFB303ServiceSimpleRPC { + return (&respFB303ServiceSimpleRPC{}).setDefaults() +} + +func (x *respFB303ServiceSimpleRPC) GetSuccess() *ReservedKeyword { + if !x.IsSetSuccess() { + return nil + } + return x.Success +} + +func (x *respFB303ServiceSimpleRPC) SetSuccessNonCompat(value *ReservedKeyword) *respFB303ServiceSimpleRPC { + x.Success = value + return x +} + +func (x *respFB303ServiceSimpleRPC) SetSuccess(value *ReservedKeyword) *respFB303ServiceSimpleRPC { + x.Success = value + return x +} + +func (x *respFB303ServiceSimpleRPC) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respFB303ServiceSimpleRPC) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Success + if err := item.Write(p); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respFB303ServiceSimpleRPC) readField0(p thrift.Decoder) error { // Success + result := NewReservedKeyword() +err := result.Read(p) +if err != nil { + return err +} + + x.Success = result + return nil +} + +func (x *respFB303ServiceSimpleRPC) toString0() string { // Success + return fmt.Sprintf("%v", x.Success) +} + +// Deprecated: Use newRespFB303ServiceSimpleRPC().GetSuccess() instead. +func (x *respFB303ServiceSimpleRPC) DefaultGetSuccess() *ReservedKeyword { + if !x.IsSetSuccess() { + return NewReservedKeyword() + } + return x.Success +} + + + +func (x *respFB303ServiceSimpleRPC) Exception() thrift.WritableException { + return nil +} + +func (x *respFB303ServiceSimpleRPC) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respFB303ServiceSimpleRPC"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respFB303ServiceSimpleRPC) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.STRUCT)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respFB303ServiceSimpleRPC) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respFB303ServiceSimpleRPC({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respFB303ServiceSimpleRPC) setDefaults() *respFB303ServiceSimpleRPC { + return x +} + +type reqMyServicePing struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyServicePing)(nil) + +// Deprecated: MyServicePingArgsDeprecated is deprecated, since it is supposed to be internal. +type MyServicePingArgsDeprecated = reqMyServicePing + +func newReqMyServicePing() *reqMyServicePing { + return (&reqMyServicePing{}).setDefaults() +} + + + +func (x *reqMyServicePing) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyServicePing"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyServicePing) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyServicePing) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyServicePing({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyServicePing) setDefaults() *reqMyServicePing { + return x +} + +type respMyServicePing struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyServicePing)(nil) +var _ thrift.WritableResult = (*respMyServicePing)(nil) + +// Deprecated: MyServicePingResultDeprecated is deprecated, since it is supposed to be internal. +type MyServicePingResultDeprecated = respMyServicePing + +func newRespMyServicePing() *respMyServicePing { + return (&respMyServicePing{}).setDefaults() +} + + + +func (x *respMyServicePing) Exception() thrift.WritableException { + return nil +} + +func (x *respMyServicePing) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyServicePing"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyServicePing) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyServicePing) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyServicePing({") + sb.WriteString("})") + + return sb.String() +} +func (x *respMyServicePing) setDefaults() *respMyServicePing { + return x +} + +type reqMyServiceGetRandomData struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyServiceGetRandomData)(nil) + +// Deprecated: MyServiceGetRandomDataArgsDeprecated is deprecated, since it is supposed to be internal. +type MyServiceGetRandomDataArgsDeprecated = reqMyServiceGetRandomData + +func newReqMyServiceGetRandomData() *reqMyServiceGetRandomData { + return (&reqMyServiceGetRandomData{}).setDefaults() +} + + + +func (x *reqMyServiceGetRandomData) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyServiceGetRandomData"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceGetRandomData) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyServiceGetRandomData) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyServiceGetRandomData({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyServiceGetRandomData) setDefaults() *reqMyServiceGetRandomData { + return x +} + +type respMyServiceGetRandomData struct { + Success *string `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyServiceGetRandomData)(nil) +var _ thrift.WritableResult = (*respMyServiceGetRandomData)(nil) + +// Deprecated: MyServiceGetRandomDataResultDeprecated is deprecated, since it is supposed to be internal. +type MyServiceGetRandomDataResultDeprecated = respMyServiceGetRandomData + +func newRespMyServiceGetRandomData() *respMyServiceGetRandomData { + return (&respMyServiceGetRandomData{}).setDefaults() +} + +func (x *respMyServiceGetRandomData) GetSuccess() string { + if !x.IsSetSuccess() { + return "" + } + return *x.Success +} + +func (x *respMyServiceGetRandomData) SetSuccessNonCompat(value string) *respMyServiceGetRandomData { + x.Success = &value + return x +} + +func (x *respMyServiceGetRandomData) SetSuccess(value *string) *respMyServiceGetRandomData { + x.Success = value + return x +} + +func (x *respMyServiceGetRandomData) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respMyServiceGetRandomData) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.STRING, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteString(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respMyServiceGetRandomData) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadString() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respMyServiceGetRandomData) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respMyServiceGetRandomData) Exception() thrift.WritableException { + return nil +} + +func (x *respMyServiceGetRandomData) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyServiceGetRandomData"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyServiceGetRandomData) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.STRING)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyServiceGetRandomData) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyServiceGetRandomData({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respMyServiceGetRandomData) setDefaults() *respMyServiceGetRandomData { + return x +} + +type reqMyServiceSink struct { + Sink int64 `thrift:"sink,1" json:"sink" db:"sink"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyServiceSink)(nil) + +// Deprecated: MyServiceSinkArgsDeprecated is deprecated, since it is supposed to be internal. +type MyServiceSinkArgsDeprecated = reqMyServiceSink + +func newReqMyServiceSink() *reqMyServiceSink { + return (&reqMyServiceSink{}).setDefaults() +} + +func (x *reqMyServiceSink) GetSink() int64 { + return x.Sink +} + +func (x *reqMyServiceSink) SetSinkNonCompat(value int64) *reqMyServiceSink { + x.Sink = value + return x +} + +func (x *reqMyServiceSink) SetSink(value int64) *reqMyServiceSink { + x.Sink = value + return x +} + +func (x *reqMyServiceSink) writeField1(p thrift.Encoder) error { // Sink + if err := p.WriteFieldBegin("sink", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Sink + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceSink) readField1(p thrift.Decoder) error { // Sink + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Sink = result + return nil +} + +func (x *reqMyServiceSink) toString1() string { // Sink + return fmt.Sprintf("%v", x.Sink) +} + + + +func (x *reqMyServiceSink) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyServiceSink"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceSink) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // sink + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyServiceSink) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyServiceSink({") + sb.WriteString(fmt.Sprintf("Sink:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyServiceSink) setDefaults() *reqMyServiceSink { + return x. + SetSinkNonCompat(0) +} + +type respMyServiceSink struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyServiceSink)(nil) +var _ thrift.WritableResult = (*respMyServiceSink)(nil) + +// Deprecated: MyServiceSinkResultDeprecated is deprecated, since it is supposed to be internal. +type MyServiceSinkResultDeprecated = respMyServiceSink + +func newRespMyServiceSink() *respMyServiceSink { + return (&respMyServiceSink{}).setDefaults() +} + + + +func (x *respMyServiceSink) Exception() thrift.WritableException { + return nil +} + +func (x *respMyServiceSink) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyServiceSink"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyServiceSink) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyServiceSink) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyServiceSink({") + sb.WriteString("})") + + return sb.String() +} +func (x *respMyServiceSink) setDefaults() *respMyServiceSink { + return x +} + +type reqMyServicePutDataById struct { + Id int64 `thrift:"id,1" json:"id" db:"id"` + Data string `thrift:"data,2" json:"data" db:"data"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyServicePutDataById)(nil) + +// Deprecated: MyServicePutDataByIdArgsDeprecated is deprecated, since it is supposed to be internal. +type MyServicePutDataByIdArgsDeprecated = reqMyServicePutDataById + +func newReqMyServicePutDataById() *reqMyServicePutDataById { + return (&reqMyServicePutDataById{}).setDefaults() +} + +func (x *reqMyServicePutDataById) GetId() int64 { + return x.Id +} + +func (x *reqMyServicePutDataById) GetData() string { + return x.Data +} + +func (x *reqMyServicePutDataById) SetIdNonCompat(value int64) *reqMyServicePutDataById { + x.Id = value + return x +} + +func (x *reqMyServicePutDataById) SetId(value int64) *reqMyServicePutDataById { + x.Id = value + return x +} + +func (x *reqMyServicePutDataById) SetDataNonCompat(value string) *reqMyServicePutDataById { + x.Data = value + return x +} + +func (x *reqMyServicePutDataById) SetData(value string) *reqMyServicePutDataById { + x.Data = value + return x +} + +func (x *reqMyServicePutDataById) writeField1(p thrift.Encoder) error { // Id + if err := p.WriteFieldBegin("id", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Id + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqMyServicePutDataById) writeField2(p thrift.Encoder) error { // Data + if err := p.WriteFieldBegin("data", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Data + if err := p.WriteString(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqMyServicePutDataById) readField1(p thrift.Decoder) error { // Id + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Id = result + return nil +} + +func (x *reqMyServicePutDataById) readField2(p thrift.Decoder) error { // Data + result, err := p.ReadString() +if err != nil { + return err +} + + x.Data = result + return nil +} + +func (x *reqMyServicePutDataById) toString1() string { // Id + return fmt.Sprintf("%v", x.Id) +} + +func (x *reqMyServicePutDataById) toString2() string { // Data + return fmt.Sprintf("%v", x.Data) +} + + + +func (x *reqMyServicePutDataById) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyServicePutDataById"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + if err := x.writeField2(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyServicePutDataById) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // id + fieldReadErr = x.readField1(p) + case (id == 2 && wireType == thrift.Type(thrift.STRING)): // data + fieldReadErr = x.readField2(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyServicePutDataById) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyServicePutDataById({") + sb.WriteString(fmt.Sprintf("Id:%s ", x.toString1())) + sb.WriteString(fmt.Sprintf("Data:%s", x.toString2())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyServicePutDataById) setDefaults() *reqMyServicePutDataById { + return x. + SetIdNonCompat(0). + SetDataNonCompat("") +} + +type respMyServicePutDataById struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyServicePutDataById)(nil) +var _ thrift.WritableResult = (*respMyServicePutDataById)(nil) + +// Deprecated: MyServicePutDataByIdResultDeprecated is deprecated, since it is supposed to be internal. +type MyServicePutDataByIdResultDeprecated = respMyServicePutDataById + +func newRespMyServicePutDataById() *respMyServicePutDataById { + return (&respMyServicePutDataById{}).setDefaults() +} + + + +func (x *respMyServicePutDataById) Exception() thrift.WritableException { + return nil +} + +func (x *respMyServicePutDataById) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyServicePutDataById"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyServicePutDataById) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyServicePutDataById) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyServicePutDataById({") + sb.WriteString("})") + + return sb.String() +} +func (x *respMyServicePutDataById) setDefaults() *respMyServicePutDataById { + return x +} + +type reqMyServiceHasDataById struct { + Id int64 `thrift:"id,1" json:"id" db:"id"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyServiceHasDataById)(nil) + +// Deprecated: MyServiceHasDataByIdArgsDeprecated is deprecated, since it is supposed to be internal. +type MyServiceHasDataByIdArgsDeprecated = reqMyServiceHasDataById + +func newReqMyServiceHasDataById() *reqMyServiceHasDataById { + return (&reqMyServiceHasDataById{}).setDefaults() +} + +func (x *reqMyServiceHasDataById) GetId() int64 { + return x.Id +} + +func (x *reqMyServiceHasDataById) SetIdNonCompat(value int64) *reqMyServiceHasDataById { + x.Id = value + return x +} + +func (x *reqMyServiceHasDataById) SetId(value int64) *reqMyServiceHasDataById { + x.Id = value + return x +} + +func (x *reqMyServiceHasDataById) writeField1(p thrift.Encoder) error { // Id + if err := p.WriteFieldBegin("id", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Id + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceHasDataById) readField1(p thrift.Decoder) error { // Id + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Id = result + return nil +} + +func (x *reqMyServiceHasDataById) toString1() string { // Id + return fmt.Sprintf("%v", x.Id) +} + + + +func (x *reqMyServiceHasDataById) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyServiceHasDataById"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceHasDataById) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // id + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyServiceHasDataById) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyServiceHasDataById({") + sb.WriteString(fmt.Sprintf("Id:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyServiceHasDataById) setDefaults() *reqMyServiceHasDataById { + return x. + SetIdNonCompat(0) +} + +type respMyServiceHasDataById struct { + Success *bool `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyServiceHasDataById)(nil) +var _ thrift.WritableResult = (*respMyServiceHasDataById)(nil) + +// Deprecated: MyServiceHasDataByIdResultDeprecated is deprecated, since it is supposed to be internal. +type MyServiceHasDataByIdResultDeprecated = respMyServiceHasDataById + +func newRespMyServiceHasDataById() *respMyServiceHasDataById { + return (&respMyServiceHasDataById{}).setDefaults() +} + +func (x *respMyServiceHasDataById) GetSuccess() bool { + if !x.IsSetSuccess() { + return false + } + return *x.Success +} + +func (x *respMyServiceHasDataById) SetSuccessNonCompat(value bool) *respMyServiceHasDataById { + x.Success = &value + return x +} + +func (x *respMyServiceHasDataById) SetSuccess(value *bool) *respMyServiceHasDataById { + x.Success = value + return x +} + +func (x *respMyServiceHasDataById) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respMyServiceHasDataById) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.BOOL, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteBool(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respMyServiceHasDataById) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadBool() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respMyServiceHasDataById) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respMyServiceHasDataById) Exception() thrift.WritableException { + return nil +} + +func (x *respMyServiceHasDataById) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyServiceHasDataById"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyServiceHasDataById) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.BOOL)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyServiceHasDataById) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyServiceHasDataById({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respMyServiceHasDataById) setDefaults() *respMyServiceHasDataById { + return x +} + +type reqMyServiceGetDataById struct { + Id int64 `thrift:"id,1" json:"id" db:"id"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyServiceGetDataById)(nil) + +// Deprecated: MyServiceGetDataByIdArgsDeprecated is deprecated, since it is supposed to be internal. +type MyServiceGetDataByIdArgsDeprecated = reqMyServiceGetDataById + +func newReqMyServiceGetDataById() *reqMyServiceGetDataById { + return (&reqMyServiceGetDataById{}).setDefaults() +} + +func (x *reqMyServiceGetDataById) GetId() int64 { + return x.Id +} + +func (x *reqMyServiceGetDataById) SetIdNonCompat(value int64) *reqMyServiceGetDataById { + x.Id = value + return x +} + +func (x *reqMyServiceGetDataById) SetId(value int64) *reqMyServiceGetDataById { + x.Id = value + return x +} + +func (x *reqMyServiceGetDataById) writeField1(p thrift.Encoder) error { // Id + if err := p.WriteFieldBegin("id", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Id + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceGetDataById) readField1(p thrift.Decoder) error { // Id + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Id = result + return nil +} + +func (x *reqMyServiceGetDataById) toString1() string { // Id + return fmt.Sprintf("%v", x.Id) +} + + + +func (x *reqMyServiceGetDataById) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyServiceGetDataById"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceGetDataById) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // id + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyServiceGetDataById) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyServiceGetDataById({") + sb.WriteString(fmt.Sprintf("Id:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyServiceGetDataById) setDefaults() *reqMyServiceGetDataById { + return x. + SetIdNonCompat(0) +} + +type respMyServiceGetDataById struct { + Success *string `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyServiceGetDataById)(nil) +var _ thrift.WritableResult = (*respMyServiceGetDataById)(nil) + +// Deprecated: MyServiceGetDataByIdResultDeprecated is deprecated, since it is supposed to be internal. +type MyServiceGetDataByIdResultDeprecated = respMyServiceGetDataById + +func newRespMyServiceGetDataById() *respMyServiceGetDataById { + return (&respMyServiceGetDataById{}).setDefaults() +} + +func (x *respMyServiceGetDataById) GetSuccess() string { + if !x.IsSetSuccess() { + return "" + } + return *x.Success +} + +func (x *respMyServiceGetDataById) SetSuccessNonCompat(value string) *respMyServiceGetDataById { + x.Success = &value + return x +} + +func (x *respMyServiceGetDataById) SetSuccess(value *string) *respMyServiceGetDataById { + x.Success = value + return x +} + +func (x *respMyServiceGetDataById) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respMyServiceGetDataById) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.STRING, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteString(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respMyServiceGetDataById) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadString() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respMyServiceGetDataById) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respMyServiceGetDataById) Exception() thrift.WritableException { + return nil +} + +func (x *respMyServiceGetDataById) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyServiceGetDataById"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyServiceGetDataById) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.STRING)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyServiceGetDataById) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyServiceGetDataById({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respMyServiceGetDataById) setDefaults() *respMyServiceGetDataById { + return x +} + +type reqMyServiceDeleteDataById struct { + Id int64 `thrift:"id,1" json:"id" db:"id"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyServiceDeleteDataById)(nil) + +// Deprecated: MyServiceDeleteDataByIdArgsDeprecated is deprecated, since it is supposed to be internal. +type MyServiceDeleteDataByIdArgsDeprecated = reqMyServiceDeleteDataById + +func newReqMyServiceDeleteDataById() *reqMyServiceDeleteDataById { + return (&reqMyServiceDeleteDataById{}).setDefaults() +} + +func (x *reqMyServiceDeleteDataById) GetId() int64 { + return x.Id +} + +func (x *reqMyServiceDeleteDataById) SetIdNonCompat(value int64) *reqMyServiceDeleteDataById { + x.Id = value + return x +} + +func (x *reqMyServiceDeleteDataById) SetId(value int64) *reqMyServiceDeleteDataById { + x.Id = value + return x +} + +func (x *reqMyServiceDeleteDataById) writeField1(p thrift.Encoder) error { // Id + if err := p.WriteFieldBegin("id", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Id + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceDeleteDataById) readField1(p thrift.Decoder) error { // Id + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Id = result + return nil +} + +func (x *reqMyServiceDeleteDataById) toString1() string { // Id + return fmt.Sprintf("%v", x.Id) +} + + + +func (x *reqMyServiceDeleteDataById) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyServiceDeleteDataById"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceDeleteDataById) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // id + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyServiceDeleteDataById) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyServiceDeleteDataById({") + sb.WriteString(fmt.Sprintf("Id:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyServiceDeleteDataById) setDefaults() *reqMyServiceDeleteDataById { + return x. + SetIdNonCompat(0) +} + +type respMyServiceDeleteDataById struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyServiceDeleteDataById)(nil) +var _ thrift.WritableResult = (*respMyServiceDeleteDataById)(nil) + +// Deprecated: MyServiceDeleteDataByIdResultDeprecated is deprecated, since it is supposed to be internal. +type MyServiceDeleteDataByIdResultDeprecated = respMyServiceDeleteDataById + +func newRespMyServiceDeleteDataById() *respMyServiceDeleteDataById { + return (&respMyServiceDeleteDataById{}).setDefaults() +} + + + +func (x *respMyServiceDeleteDataById) Exception() thrift.WritableException { + return nil +} + +func (x *respMyServiceDeleteDataById) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyServiceDeleteDataById"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyServiceDeleteDataById) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyServiceDeleteDataById) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyServiceDeleteDataById({") + sb.WriteString("})") + + return sb.String() +} +func (x *respMyServiceDeleteDataById) setDefaults() *respMyServiceDeleteDataById { + return x +} + +type reqMyServiceLobDataById struct { + Id int64 `thrift:"id,1" json:"id" db:"id"` + Data string `thrift:"data,2" json:"data" db:"data"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyServiceLobDataById)(nil) + +// Deprecated: MyServiceLobDataByIdArgsDeprecated is deprecated, since it is supposed to be internal. +type MyServiceLobDataByIdArgsDeprecated = reqMyServiceLobDataById + +func newReqMyServiceLobDataById() *reqMyServiceLobDataById { + return (&reqMyServiceLobDataById{}).setDefaults() +} + +func (x *reqMyServiceLobDataById) GetId() int64 { + return x.Id +} + +func (x *reqMyServiceLobDataById) GetData() string { + return x.Data +} + +func (x *reqMyServiceLobDataById) SetIdNonCompat(value int64) *reqMyServiceLobDataById { + x.Id = value + return x +} + +func (x *reqMyServiceLobDataById) SetId(value int64) *reqMyServiceLobDataById { + x.Id = value + return x +} + +func (x *reqMyServiceLobDataById) SetDataNonCompat(value string) *reqMyServiceLobDataById { + x.Data = value + return x +} + +func (x *reqMyServiceLobDataById) SetData(value string) *reqMyServiceLobDataById { + x.Data = value + return x +} + +func (x *reqMyServiceLobDataById) writeField1(p thrift.Encoder) error { // Id + if err := p.WriteFieldBegin("id", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Id + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceLobDataById) writeField2(p thrift.Encoder) error { // Data + if err := p.WriteFieldBegin("data", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Data + if err := p.WriteString(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceLobDataById) readField1(p thrift.Decoder) error { // Id + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Id = result + return nil +} + +func (x *reqMyServiceLobDataById) readField2(p thrift.Decoder) error { // Data + result, err := p.ReadString() +if err != nil { + return err +} + + x.Data = result + return nil +} + +func (x *reqMyServiceLobDataById) toString1() string { // Id + return fmt.Sprintf("%v", x.Id) +} + +func (x *reqMyServiceLobDataById) toString2() string { // Data + return fmt.Sprintf("%v", x.Data) +} + + + +func (x *reqMyServiceLobDataById) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyServiceLobDataById"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + if err := x.writeField2(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceLobDataById) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // id + fieldReadErr = x.readField1(p) + case (id == 2 && wireType == thrift.Type(thrift.STRING)): // data + fieldReadErr = x.readField2(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyServiceLobDataById) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyServiceLobDataById({") + sb.WriteString(fmt.Sprintf("Id:%s ", x.toString1())) + sb.WriteString(fmt.Sprintf("Data:%s", x.toString2())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyServiceLobDataById) setDefaults() *reqMyServiceLobDataById { + return x. + SetIdNonCompat(0). + SetDataNonCompat("") +} + +type respMyServiceLobDataById struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyServiceLobDataById)(nil) +var _ thrift.WritableResult = (*respMyServiceLobDataById)(nil) + +// Deprecated: MyServiceLobDataByIdResultDeprecated is deprecated, since it is supposed to be internal. +type MyServiceLobDataByIdResultDeprecated = respMyServiceLobDataById + +func newRespMyServiceLobDataById() *respMyServiceLobDataById { + return (&respMyServiceLobDataById{}).setDefaults() +} + + + +func (x *respMyServiceLobDataById) Exception() thrift.WritableException { + return nil +} + +func (x *respMyServiceLobDataById) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyServiceLobDataById"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyServiceLobDataById) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyServiceLobDataById) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyServiceLobDataById({") + sb.WriteString("})") + + return sb.String() +} +func (x *respMyServiceLobDataById) setDefaults() *respMyServiceLobDataById { + return x +} + +type reqMyServiceInvalidReturnForHack struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyServiceInvalidReturnForHack)(nil) + +// Deprecated: MyServiceInvalidReturnForHackArgsDeprecated is deprecated, since it is supposed to be internal. +type MyServiceInvalidReturnForHackArgsDeprecated = reqMyServiceInvalidReturnForHack + +func newReqMyServiceInvalidReturnForHack() *reqMyServiceInvalidReturnForHack { + return (&reqMyServiceInvalidReturnForHack{}).setDefaults() +} + + + +func (x *reqMyServiceInvalidReturnForHack) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyServiceInvalidReturnForHack"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceInvalidReturnForHack) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyServiceInvalidReturnForHack) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyServiceInvalidReturnForHack({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyServiceInvalidReturnForHack) setDefaults() *reqMyServiceInvalidReturnForHack { + return x +} + +type respMyServiceInvalidReturnForHack struct { + Success []float32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyServiceInvalidReturnForHack)(nil) +var _ thrift.WritableResult = (*respMyServiceInvalidReturnForHack)(nil) + +// Deprecated: MyServiceInvalidReturnForHackResultDeprecated is deprecated, since it is supposed to be internal. +type MyServiceInvalidReturnForHackResultDeprecated = respMyServiceInvalidReturnForHack + +func newRespMyServiceInvalidReturnForHack() *respMyServiceInvalidReturnForHack { + return (&respMyServiceInvalidReturnForHack{}).setDefaults() +} + +func (x *respMyServiceInvalidReturnForHack) GetSuccess() []float32 { + if !x.IsSetSuccess() { + return make([]float32, 0) + } + return x.Success +} + +func (x *respMyServiceInvalidReturnForHack) SetSuccessNonCompat(value []float32) *respMyServiceInvalidReturnForHack { + x.Success = value + return x +} + +func (x *respMyServiceInvalidReturnForHack) SetSuccess(value []float32) *respMyServiceInvalidReturnForHack { + x.Success = value + return x +} + +func (x *respMyServiceInvalidReturnForHack) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respMyServiceInvalidReturnForHack) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.SET, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Success + if err := p.WriteSetBegin(thrift.FLOAT, len(item)); err != nil { + return thrift.PrependError("error writing set begin: ", err) +} +for _, v := range item { + { + item := v + if err := p.WriteFloat(item); err != nil { + return err +} + } +} +if err := p.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respMyServiceInvalidReturnForHack) readField0(p thrift.Decoder) error { // Success + _ /* elemType */, size, err := p.ReadSetBegin() +if err != nil { + return thrift.PrependError("error reading set begin: ", err) +} + +setResult := make([]float32, 0, size) +for i := 0; i < size; i++ { + var elem float32 + { + result, err := p.ReadFloat() +if err != nil { + return err +} + elem = result + } + setResult = append(setResult, elem) +} + +if err := p.ReadSetEnd(); err != nil { + return thrift.PrependError("error reading set end: ", err) +} +result := setResult + + x.Success = result + return nil +} + +func (x *respMyServiceInvalidReturnForHack) toString0() string { // Success + return fmt.Sprintf("%v", x.Success) +} + + + +func (x *respMyServiceInvalidReturnForHack) Exception() thrift.WritableException { + return nil +} + +func (x *respMyServiceInvalidReturnForHack) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyServiceInvalidReturnForHack"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyServiceInvalidReturnForHack) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.SET)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyServiceInvalidReturnForHack) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyServiceInvalidReturnForHack({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respMyServiceInvalidReturnForHack) setDefaults() *respMyServiceInvalidReturnForHack { + return x +} + +type reqMyServiceRpcSkippedCodegen struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyServiceRpcSkippedCodegen)(nil) + +// Deprecated: MyServiceRpcSkippedCodegenArgsDeprecated is deprecated, since it is supposed to be internal. +type MyServiceRpcSkippedCodegenArgsDeprecated = reqMyServiceRpcSkippedCodegen + +func newReqMyServiceRpcSkippedCodegen() *reqMyServiceRpcSkippedCodegen { + return (&reqMyServiceRpcSkippedCodegen{}).setDefaults() +} + + + +func (x *reqMyServiceRpcSkippedCodegen) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyServiceRpcSkippedCodegen"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceRpcSkippedCodegen) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyServiceRpcSkippedCodegen) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyServiceRpcSkippedCodegen({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyServiceRpcSkippedCodegen) setDefaults() *reqMyServiceRpcSkippedCodegen { + return x +} + +type respMyServiceRpcSkippedCodegen struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyServiceRpcSkippedCodegen)(nil) +var _ thrift.WritableResult = (*respMyServiceRpcSkippedCodegen)(nil) + +// Deprecated: MyServiceRpcSkippedCodegenResultDeprecated is deprecated, since it is supposed to be internal. +type MyServiceRpcSkippedCodegenResultDeprecated = respMyServiceRpcSkippedCodegen + +func newRespMyServiceRpcSkippedCodegen() *respMyServiceRpcSkippedCodegen { + return (&respMyServiceRpcSkippedCodegen{}).setDefaults() +} + + + +func (x *respMyServiceRpcSkippedCodegen) Exception() thrift.WritableException { + return nil +} + +func (x *respMyServiceRpcSkippedCodegen) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyServiceRpcSkippedCodegen"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyServiceRpcSkippedCodegen) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyServiceRpcSkippedCodegen) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyServiceRpcSkippedCodegen({") + sb.WriteString("})") + + return sb.String() +} +func (x *respMyServiceRpcSkippedCodegen) setDefaults() *respMyServiceRpcSkippedCodegen { + return x +} + +type reqDbMixedStackArgumentsGetDataByKey0 struct { + Key string `thrift:"key,1" json:"key" db:"key"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqDbMixedStackArgumentsGetDataByKey0)(nil) + +// Deprecated: DbMixedStackArgumentsGetDataByKey0ArgsDeprecated is deprecated, since it is supposed to be internal. +type DbMixedStackArgumentsGetDataByKey0ArgsDeprecated = reqDbMixedStackArgumentsGetDataByKey0 + +func newReqDbMixedStackArgumentsGetDataByKey0() *reqDbMixedStackArgumentsGetDataByKey0 { + return (&reqDbMixedStackArgumentsGetDataByKey0{}).setDefaults() +} + +func (x *reqDbMixedStackArgumentsGetDataByKey0) GetKey() string { + return x.Key +} + +func (x *reqDbMixedStackArgumentsGetDataByKey0) SetKeyNonCompat(value string) *reqDbMixedStackArgumentsGetDataByKey0 { + x.Key = value + return x +} + +func (x *reqDbMixedStackArgumentsGetDataByKey0) SetKey(value string) *reqDbMixedStackArgumentsGetDataByKey0 { + x.Key = value + return x +} + +func (x *reqDbMixedStackArgumentsGetDataByKey0) writeField1(p thrift.Encoder) error { // Key + if err := p.WriteFieldBegin("key", thrift.STRING, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Key + if err := p.WriteString(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqDbMixedStackArgumentsGetDataByKey0) readField1(p thrift.Decoder) error { // Key + result, err := p.ReadString() +if err != nil { + return err +} + + x.Key = result + return nil +} + +func (x *reqDbMixedStackArgumentsGetDataByKey0) toString1() string { // Key + return fmt.Sprintf("%v", x.Key) +} + + + +func (x *reqDbMixedStackArgumentsGetDataByKey0) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqDbMixedStackArgumentsGetDataByKey0"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqDbMixedStackArgumentsGetDataByKey0) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.STRING)): // key + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqDbMixedStackArgumentsGetDataByKey0) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqDbMixedStackArgumentsGetDataByKey0({") + sb.WriteString(fmt.Sprintf("Key:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqDbMixedStackArgumentsGetDataByKey0) setDefaults() *reqDbMixedStackArgumentsGetDataByKey0 { + return x. + SetKeyNonCompat("") +} + +type respDbMixedStackArgumentsGetDataByKey0 struct { + Success []byte `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respDbMixedStackArgumentsGetDataByKey0)(nil) +var _ thrift.WritableResult = (*respDbMixedStackArgumentsGetDataByKey0)(nil) + +// Deprecated: DbMixedStackArgumentsGetDataByKey0ResultDeprecated is deprecated, since it is supposed to be internal. +type DbMixedStackArgumentsGetDataByKey0ResultDeprecated = respDbMixedStackArgumentsGetDataByKey0 + +func newRespDbMixedStackArgumentsGetDataByKey0() *respDbMixedStackArgumentsGetDataByKey0 { + return (&respDbMixedStackArgumentsGetDataByKey0{}).setDefaults() +} + +func (x *respDbMixedStackArgumentsGetDataByKey0) GetSuccess() []byte { + if !x.IsSetSuccess() { + return []byte("") + } + return x.Success +} + +func (x *respDbMixedStackArgumentsGetDataByKey0) SetSuccessNonCompat(value []byte) *respDbMixedStackArgumentsGetDataByKey0 { + x.Success = value + return x +} + +func (x *respDbMixedStackArgumentsGetDataByKey0) SetSuccess(value []byte) *respDbMixedStackArgumentsGetDataByKey0 { + x.Success = value + return x +} + +func (x *respDbMixedStackArgumentsGetDataByKey0) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respDbMixedStackArgumentsGetDataByKey0) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.STRING, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Success + if err := p.WriteBinary(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respDbMixedStackArgumentsGetDataByKey0) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadBinary() +if err != nil { + return err +} + + x.Success = result + return nil +} + +func (x *respDbMixedStackArgumentsGetDataByKey0) toString0() string { // Success + return fmt.Sprintf("%v", x.Success) +} + + + +func (x *respDbMixedStackArgumentsGetDataByKey0) Exception() thrift.WritableException { + return nil +} + +func (x *respDbMixedStackArgumentsGetDataByKey0) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respDbMixedStackArgumentsGetDataByKey0"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respDbMixedStackArgumentsGetDataByKey0) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.STRING)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respDbMixedStackArgumentsGetDataByKey0) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respDbMixedStackArgumentsGetDataByKey0({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respDbMixedStackArgumentsGetDataByKey0) setDefaults() *respDbMixedStackArgumentsGetDataByKey0 { + return x +} + +type reqDbMixedStackArgumentsGetDataByKey1 struct { + Key string `thrift:"key,1" json:"key" db:"key"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqDbMixedStackArgumentsGetDataByKey1)(nil) + +// Deprecated: DbMixedStackArgumentsGetDataByKey1ArgsDeprecated is deprecated, since it is supposed to be internal. +type DbMixedStackArgumentsGetDataByKey1ArgsDeprecated = reqDbMixedStackArgumentsGetDataByKey1 + +func newReqDbMixedStackArgumentsGetDataByKey1() *reqDbMixedStackArgumentsGetDataByKey1 { + return (&reqDbMixedStackArgumentsGetDataByKey1{}).setDefaults() +} + +func (x *reqDbMixedStackArgumentsGetDataByKey1) GetKey() string { + return x.Key +} + +func (x *reqDbMixedStackArgumentsGetDataByKey1) SetKeyNonCompat(value string) *reqDbMixedStackArgumentsGetDataByKey1 { + x.Key = value + return x +} + +func (x *reqDbMixedStackArgumentsGetDataByKey1) SetKey(value string) *reqDbMixedStackArgumentsGetDataByKey1 { + x.Key = value + return x +} + +func (x *reqDbMixedStackArgumentsGetDataByKey1) writeField1(p thrift.Encoder) error { // Key + if err := p.WriteFieldBegin("key", thrift.STRING, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Key + if err := p.WriteString(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqDbMixedStackArgumentsGetDataByKey1) readField1(p thrift.Decoder) error { // Key + result, err := p.ReadString() +if err != nil { + return err +} + + x.Key = result + return nil +} + +func (x *reqDbMixedStackArgumentsGetDataByKey1) toString1() string { // Key + return fmt.Sprintf("%v", x.Key) +} + + + +func (x *reqDbMixedStackArgumentsGetDataByKey1) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqDbMixedStackArgumentsGetDataByKey1"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqDbMixedStackArgumentsGetDataByKey1) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.STRING)): // key + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqDbMixedStackArgumentsGetDataByKey1) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqDbMixedStackArgumentsGetDataByKey1({") + sb.WriteString(fmt.Sprintf("Key:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqDbMixedStackArgumentsGetDataByKey1) setDefaults() *reqDbMixedStackArgumentsGetDataByKey1 { + return x. + SetKeyNonCompat("") +} + +type respDbMixedStackArgumentsGetDataByKey1 struct { + Success []byte `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respDbMixedStackArgumentsGetDataByKey1)(nil) +var _ thrift.WritableResult = (*respDbMixedStackArgumentsGetDataByKey1)(nil) + +// Deprecated: DbMixedStackArgumentsGetDataByKey1ResultDeprecated is deprecated, since it is supposed to be internal. +type DbMixedStackArgumentsGetDataByKey1ResultDeprecated = respDbMixedStackArgumentsGetDataByKey1 + +func newRespDbMixedStackArgumentsGetDataByKey1() *respDbMixedStackArgumentsGetDataByKey1 { + return (&respDbMixedStackArgumentsGetDataByKey1{}).setDefaults() +} + +func (x *respDbMixedStackArgumentsGetDataByKey1) GetSuccess() []byte { + if !x.IsSetSuccess() { + return []byte("") + } + return x.Success +} + +func (x *respDbMixedStackArgumentsGetDataByKey1) SetSuccessNonCompat(value []byte) *respDbMixedStackArgumentsGetDataByKey1 { + x.Success = value + return x +} + +func (x *respDbMixedStackArgumentsGetDataByKey1) SetSuccess(value []byte) *respDbMixedStackArgumentsGetDataByKey1 { + x.Success = value + return x +} + +func (x *respDbMixedStackArgumentsGetDataByKey1) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respDbMixedStackArgumentsGetDataByKey1) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.STRING, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Success + if err := p.WriteBinary(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respDbMixedStackArgumentsGetDataByKey1) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadBinary() +if err != nil { + return err +} + + x.Success = result + return nil +} + +func (x *respDbMixedStackArgumentsGetDataByKey1) toString0() string { // Success + return fmt.Sprintf("%v", x.Success) +} + + + +func (x *respDbMixedStackArgumentsGetDataByKey1) Exception() thrift.WritableException { + return nil +} + +func (x *respDbMixedStackArgumentsGetDataByKey1) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respDbMixedStackArgumentsGetDataByKey1"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respDbMixedStackArgumentsGetDataByKey1) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.STRING)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respDbMixedStackArgumentsGetDataByKey1) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respDbMixedStackArgumentsGetDataByKey1({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respDbMixedStackArgumentsGetDataByKey1) setDefaults() *respDbMixedStackArgumentsGetDataByKey1 { + return x +} + + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/hack/types.go b/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/hack/types.go index 25397ae334e..42eacb139df 100644 --- a/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/hack/types.go +++ b/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/hack/types.go @@ -1464,6 +1464,7 @@ func (x *ModuleInternal) setDefaults() *ModuleInternal { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/scope/types.go b/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/scope/types.go index c2871133501..c8a6b005a41 100644 --- a/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/scope/types.go +++ b/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/scope/types.go @@ -1380,6 +1380,7 @@ func (x *Definition) setDefaults() *Definition { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/thrift/types.go b/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/thrift/types.go index 85cadd20f65..ba562235211 100644 --- a/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/thrift/types.go +++ b/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/thrift/types.go @@ -1804,6 +1804,7 @@ func (x *AllowReservedFilename) setDefaults() *AllowReservedFilename { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/module/types.go b/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/module/types.go index 13342c95a89..1253fe42f74 100644 --- a/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/module/types.go +++ b/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/module/types.go @@ -2163,6 +2163,7 @@ func (x *NonCopyableUnion) setDefaults() *NonCopyableUnion { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/cpp/types.go b/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/cpp/types.go index b7608402504..fde8434e68b 100644 --- a/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/cpp/types.go +++ b/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/cpp/types.go @@ -2282,6 +2282,7 @@ func (x *GenerateDeprecatedHeaderClientMethods) setDefaults() *GenerateDeprecate } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/scope/types.go b/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/scope/types.go index c2871133501..c8a6b005a41 100644 --- a/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/scope/types.go +++ b/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/scope/types.go @@ -1380,6 +1380,7 @@ func (x *Definition) setDefaults() *Definition { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/thrift/types.go b/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/thrift/types.go index 85cadd20f65..ba562235211 100644 --- a/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/thrift/types.go +++ b/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/thrift/types.go @@ -1804,6 +1804,7 @@ func (x *AllowReservedFilename) setDefaults() *AllowReservedFilename { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/constants/out/go/gen-go/module/types.go b/thrift/compiler/test/fixtures/constants/out/go/gen-go/module/types.go index 9f762b8f94e..d9aca72dfb3 100644 --- a/thrift/compiler/test/fixtures/constants/out/go/gen-go/module/types.go +++ b/thrift/compiler/test/fixtures/constants/out/go/gen-go/module/types.go @@ -2539,6 +2539,7 @@ func (x *Union2) setDefaults() *Union2 { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/default_values/out/go/gen-go/module/types.go b/thrift/compiler/test/fixtures/default_values/out/go/gen-go/module/types.go index 70318314153..722c9a5bfb9 100644 --- a/thrift/compiler/test/fixtures/default_values/out/go/gen-go/module/types.go +++ b/thrift/compiler/test/fixtures/default_values/out/go/gen-go/module/types.go @@ -1093,6 +1093,7 @@ func (x *StructWithCustomDefaultValues) setDefaults() *StructWithCustomDefaultVa } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/doctext/out/go/gen-go/module/svcs.go b/thrift/compiler/test/fixtures/doctext/out/go/gen-go/module/svcs.go index 35f51a7746c..17f1d80bea9 100644 --- a/thrift/compiler/test/fixtures/doctext/out/go/gen-go/module/svcs.go +++ b/thrift/compiler/test/fixtures/doctext/out/go/gen-go/module/svcs.go @@ -124,681 +124,6 @@ func (c *CClient) ThingContext(ctx context.Context, a int32, b string, c []int32 return c.chClient.Thing(ctx, a, b, c) } -type reqCF struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqCF)(nil) - -// Deprecated: CFArgsDeprecated is deprecated, since it is supposed to be internal. -type CFArgsDeprecated = reqCF - -func newReqCF() *reqCF { - return (&reqCF{}).setDefaults() -} - - - -func (x *reqCF) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqCF"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqCF) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqCF) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqCF({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqCF) setDefaults() *reqCF { - return x -} - -type respCF struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respCF)(nil) -var _ thrift.WritableResult = (*respCF)(nil) - -// Deprecated: CFResultDeprecated is deprecated, since it is supposed to be internal. -type CFResultDeprecated = respCF - -func newRespCF() *respCF { - return (&respCF{}).setDefaults() -} - - - -func (x *respCF) Exception() thrift.WritableException { - return nil -} - -func (x *respCF) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respCF"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respCF) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respCF) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respCF({") - sb.WriteString("})") - - return sb.String() -} -func (x *respCF) setDefaults() *respCF { - return x -} - -type reqCThing struct { - A int32 `thrift:"a,1" json:"a" db:"a"` - B string `thrift:"b,2" json:"b" db:"b"` - C []int32 `thrift:"c,3" json:"c" db:"c"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqCThing)(nil) - -// Deprecated: CThingArgsDeprecated is deprecated, since it is supposed to be internal. -type CThingArgsDeprecated = reqCThing - -func newReqCThing() *reqCThing { - return (&reqCThing{}).setDefaults() -} - -func (x *reqCThing) GetA() int32 { - return x.A -} - -func (x *reqCThing) GetB() string { - return x.B -} - -func (x *reqCThing) GetC() []int32 { - if !x.IsSetC() { - return make([]int32, 0) - } - return x.C -} - -func (x *reqCThing) SetANonCompat(value int32) *reqCThing { - x.A = value - return x -} - -func (x *reqCThing) SetA(value int32) *reqCThing { - x.A = value - return x -} - -func (x *reqCThing) SetBNonCompat(value string) *reqCThing { - x.B = value - return x -} - -func (x *reqCThing) SetB(value string) *reqCThing { - x.B = value - return x -} - -func (x *reqCThing) SetCNonCompat(value []int32) *reqCThing { - x.C = value - return x -} - -func (x *reqCThing) SetC(value []int32) *reqCThing { - x.C = value - return x -} - -func (x *reqCThing) IsSetC() bool { - return x != nil && x.C != nil -} - -func (x *reqCThing) writeField1(p thrift.Encoder) error { // A - if err := p.WriteFieldBegin("a", thrift.I32, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.A - if err := p.WriteI32(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqCThing) writeField2(p thrift.Encoder) error { // B - if err := p.WriteFieldBegin("b", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.B - if err := p.WriteString(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqCThing) writeField3(p thrift.Encoder) error { // C - if err := p.WriteFieldBegin("c", thrift.SET, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.C - if err := p.WriteSetBegin(thrift.I32, len(item)); err != nil { - return thrift.PrependError("error writing set begin: ", err) -} -for _, v := range item { - { - item := v - if err := p.WriteI32(item); err != nil { - return err -} - } -} -if err := p.WriteSetEnd(); err != nil { - return thrift.PrependError("error writing set end: ", err) -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqCThing) readField1(p thrift.Decoder) error { // A - result, err := p.ReadI32() -if err != nil { - return err -} - - x.A = result - return nil -} - -func (x *reqCThing) readField2(p thrift.Decoder) error { // B - result, err := p.ReadString() -if err != nil { - return err -} - - x.B = result - return nil -} - -func (x *reqCThing) readField3(p thrift.Decoder) error { // C - _ /* elemType */, size, err := p.ReadSetBegin() -if err != nil { - return thrift.PrependError("error reading set begin: ", err) -} - -setResult := make([]int32, 0, size) -for i := 0; i < size; i++ { - var elem int32 - { - result, err := p.ReadI32() -if err != nil { - return err -} - elem = result - } - setResult = append(setResult, elem) -} - -if err := p.ReadSetEnd(); err != nil { - return thrift.PrependError("error reading set end: ", err) -} -result := setResult - - x.C = result - return nil -} - -func (x *reqCThing) toString1() string { // A - return fmt.Sprintf("%v", x.A) -} - -func (x *reqCThing) toString2() string { // B - return fmt.Sprintf("%v", x.B) -} - -func (x *reqCThing) toString3() string { // C - return fmt.Sprintf("%v", x.C) -} - - - -func (x *reqCThing) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqCThing"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - if err := x.writeField2(p); err != nil { - return err - } - if err := x.writeField3(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqCThing) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I32)): // a - fieldReadErr = x.readField1(p) - case (id == 2 && wireType == thrift.Type(thrift.STRING)): // b - fieldReadErr = x.readField2(p) - case (id == 3 && wireType == thrift.Type(thrift.SET)): // c - fieldReadErr = x.readField3(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqCThing) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqCThing({") - sb.WriteString(fmt.Sprintf("A:%s ", x.toString1())) - sb.WriteString(fmt.Sprintf("B:%s ", x.toString2())) - sb.WriteString(fmt.Sprintf("C:%s", x.toString3())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqCThing) setDefaults() *reqCThing { - return x. - SetANonCompat(0). - SetBNonCompat(""). - SetCNonCompat(make([]int32, 0)) -} - -type respCThing struct { - Success *string `thrift:"success,0,optional" json:"success,omitempty" db:"success"` - Bang *Bang `thrift:"bang,1,optional" json:"bang,omitempty" db:"bang"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respCThing)(nil) -var _ thrift.WritableResult = (*respCThing)(nil) - -// Deprecated: CThingResultDeprecated is deprecated, since it is supposed to be internal. -type CThingResultDeprecated = respCThing - -func newRespCThing() *respCThing { - return (&respCThing{}).setDefaults() -} - -func (x *respCThing) GetSuccess() string { - if !x.IsSetSuccess() { - return "" - } - return *x.Success -} - -func (x *respCThing) GetBang() *Bang { - if !x.IsSetBang() { - return nil - } - return x.Bang -} - -func (x *respCThing) SetSuccessNonCompat(value string) *respCThing { - x.Success = &value - return x -} - -func (x *respCThing) SetSuccess(value *string) *respCThing { - x.Success = value - return x -} - -func (x *respCThing) SetBangNonCompat(value *Bang) *respCThing { - x.Bang = value - return x -} - -func (x *respCThing) SetBang(value *Bang) *respCThing { - x.Bang = value - return x -} - -func (x *respCThing) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respCThing) IsSetBang() bool { - return x != nil && x.Bang != nil -} - -func (x *respCThing) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.STRING, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteString(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respCThing) writeField1(p thrift.Encoder) error { // Bang - if !x.IsSetBang() { - return nil - } - - if err := p.WriteFieldBegin("bang", thrift.STRUCT, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Bang - if err := item.Write(p); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respCThing) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadString() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respCThing) readField1(p thrift.Decoder) error { // Bang - result := NewBang() -err := result.Read(p) -if err != nil { - return err -} - - x.Bang = result - return nil -} - -func (x *respCThing) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - -func (x *respCThing) toString1() string { // Bang - return fmt.Sprintf("%v", x.Bang) -} - - -// Deprecated: Use newRespCThing().GetBang() instead. -func (x *respCThing) DefaultGetBang() *Bang { - if !x.IsSetBang() { - return NewBang() - } - return x.Bang -} - - - -func (x *respCThing) Exception() thrift.WritableException { - if x.Bang != nil { - return x.Bang - } - return nil -} - -func (x *respCThing) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respCThing"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respCThing) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.STRING)): // success - fieldReadErr = x.readField0(p) - case (id == 1 && wireType == thrift.Type(thrift.STRUCT)): // bang - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respCThing) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respCThing({") - sb.WriteString(fmt.Sprintf("Success:%s ", x.toString0())) - sb.WriteString(fmt.Sprintf("Bang:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *respCThing) setDefaults() *respCThing { - return x -} - - type CProcessor struct { processorFunctionMap map[string]thrift.ProcessorFunction diff --git a/thrift/compiler/test/fixtures/doctext/out/go/gen-go/module/types.go b/thrift/compiler/test/fixtures/doctext/out/go/gen-go/module/types.go index 8e7a64d50e1..a64e1cf3f3a 100644 --- a/thrift/compiler/test/fixtures/doctext/out/go/gen-go/module/types.go +++ b/thrift/compiler/test/fixtures/doctext/out/go/gen-go/module/types.go @@ -606,6 +606,682 @@ func (x *Bang) Error() string { return x.String() } +// Service req/resp structs (below) +type reqCF struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqCF)(nil) + +// Deprecated: CFArgsDeprecated is deprecated, since it is supposed to be internal. +type CFArgsDeprecated = reqCF + +func newReqCF() *reqCF { + return (&reqCF{}).setDefaults() +} + + + +func (x *reqCF) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqCF"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqCF) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqCF) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqCF({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqCF) setDefaults() *reqCF { + return x +} + +type respCF struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respCF)(nil) +var _ thrift.WritableResult = (*respCF)(nil) + +// Deprecated: CFResultDeprecated is deprecated, since it is supposed to be internal. +type CFResultDeprecated = respCF + +func newRespCF() *respCF { + return (&respCF{}).setDefaults() +} + + + +func (x *respCF) Exception() thrift.WritableException { + return nil +} + +func (x *respCF) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respCF"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respCF) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respCF) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respCF({") + sb.WriteString("})") + + return sb.String() +} +func (x *respCF) setDefaults() *respCF { + return x +} + +type reqCThing struct { + A int32 `thrift:"a,1" json:"a" db:"a"` + B string `thrift:"b,2" json:"b" db:"b"` + C []int32 `thrift:"c,3" json:"c" db:"c"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqCThing)(nil) + +// Deprecated: CThingArgsDeprecated is deprecated, since it is supposed to be internal. +type CThingArgsDeprecated = reqCThing + +func newReqCThing() *reqCThing { + return (&reqCThing{}).setDefaults() +} + +func (x *reqCThing) GetA() int32 { + return x.A +} + +func (x *reqCThing) GetB() string { + return x.B +} + +func (x *reqCThing) GetC() []int32 { + if !x.IsSetC() { + return make([]int32, 0) + } + return x.C +} + +func (x *reqCThing) SetANonCompat(value int32) *reqCThing { + x.A = value + return x +} + +func (x *reqCThing) SetA(value int32) *reqCThing { + x.A = value + return x +} + +func (x *reqCThing) SetBNonCompat(value string) *reqCThing { + x.B = value + return x +} + +func (x *reqCThing) SetB(value string) *reqCThing { + x.B = value + return x +} + +func (x *reqCThing) SetCNonCompat(value []int32) *reqCThing { + x.C = value + return x +} + +func (x *reqCThing) SetC(value []int32) *reqCThing { + x.C = value + return x +} + +func (x *reqCThing) IsSetC() bool { + return x != nil && x.C != nil +} + +func (x *reqCThing) writeField1(p thrift.Encoder) error { // A + if err := p.WriteFieldBegin("a", thrift.I32, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.A + if err := p.WriteI32(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqCThing) writeField2(p thrift.Encoder) error { // B + if err := p.WriteFieldBegin("b", thrift.STRING, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.B + if err := p.WriteString(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqCThing) writeField3(p thrift.Encoder) error { // C + if err := p.WriteFieldBegin("c", thrift.SET, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.C + if err := p.WriteSetBegin(thrift.I32, len(item)); err != nil { + return thrift.PrependError("error writing set begin: ", err) +} +for _, v := range item { + { + item := v + if err := p.WriteI32(item); err != nil { + return err +} + } +} +if err := p.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqCThing) readField1(p thrift.Decoder) error { // A + result, err := p.ReadI32() +if err != nil { + return err +} + + x.A = result + return nil +} + +func (x *reqCThing) readField2(p thrift.Decoder) error { // B + result, err := p.ReadString() +if err != nil { + return err +} + + x.B = result + return nil +} + +func (x *reqCThing) readField3(p thrift.Decoder) error { // C + _ /* elemType */, size, err := p.ReadSetBegin() +if err != nil { + return thrift.PrependError("error reading set begin: ", err) +} + +setResult := make([]int32, 0, size) +for i := 0; i < size; i++ { + var elem int32 + { + result, err := p.ReadI32() +if err != nil { + return err +} + elem = result + } + setResult = append(setResult, elem) +} + +if err := p.ReadSetEnd(); err != nil { + return thrift.PrependError("error reading set end: ", err) +} +result := setResult + + x.C = result + return nil +} + +func (x *reqCThing) toString1() string { // A + return fmt.Sprintf("%v", x.A) +} + +func (x *reqCThing) toString2() string { // B + return fmt.Sprintf("%v", x.B) +} + +func (x *reqCThing) toString3() string { // C + return fmt.Sprintf("%v", x.C) +} + + + +func (x *reqCThing) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqCThing"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + if err := x.writeField2(p); err != nil { + return err + } + if err := x.writeField3(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqCThing) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I32)): // a + fieldReadErr = x.readField1(p) + case (id == 2 && wireType == thrift.Type(thrift.STRING)): // b + fieldReadErr = x.readField2(p) + case (id == 3 && wireType == thrift.Type(thrift.SET)): // c + fieldReadErr = x.readField3(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqCThing) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqCThing({") + sb.WriteString(fmt.Sprintf("A:%s ", x.toString1())) + sb.WriteString(fmt.Sprintf("B:%s ", x.toString2())) + sb.WriteString(fmt.Sprintf("C:%s", x.toString3())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqCThing) setDefaults() *reqCThing { + return x. + SetANonCompat(0). + SetBNonCompat(""). + SetCNonCompat(make([]int32, 0)) +} + +type respCThing struct { + Success *string `thrift:"success,0,optional" json:"success,omitempty" db:"success"` + Bang *Bang `thrift:"bang,1,optional" json:"bang,omitempty" db:"bang"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respCThing)(nil) +var _ thrift.WritableResult = (*respCThing)(nil) + +// Deprecated: CThingResultDeprecated is deprecated, since it is supposed to be internal. +type CThingResultDeprecated = respCThing + +func newRespCThing() *respCThing { + return (&respCThing{}).setDefaults() +} + +func (x *respCThing) GetSuccess() string { + if !x.IsSetSuccess() { + return "" + } + return *x.Success +} + +func (x *respCThing) GetBang() *Bang { + if !x.IsSetBang() { + return nil + } + return x.Bang +} + +func (x *respCThing) SetSuccessNonCompat(value string) *respCThing { + x.Success = &value + return x +} + +func (x *respCThing) SetSuccess(value *string) *respCThing { + x.Success = value + return x +} + +func (x *respCThing) SetBangNonCompat(value *Bang) *respCThing { + x.Bang = value + return x +} + +func (x *respCThing) SetBang(value *Bang) *respCThing { + x.Bang = value + return x +} + +func (x *respCThing) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respCThing) IsSetBang() bool { + return x != nil && x.Bang != nil +} + +func (x *respCThing) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.STRING, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteString(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respCThing) writeField1(p thrift.Encoder) error { // Bang + if !x.IsSetBang() { + return nil + } + + if err := p.WriteFieldBegin("bang", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Bang + if err := item.Write(p); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respCThing) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadString() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respCThing) readField1(p thrift.Decoder) error { // Bang + result := NewBang() +err := result.Read(p) +if err != nil { + return err +} + + x.Bang = result + return nil +} + +func (x *respCThing) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + +func (x *respCThing) toString1() string { // Bang + return fmt.Sprintf("%v", x.Bang) +} + + +// Deprecated: Use newRespCThing().GetBang() instead. +func (x *respCThing) DefaultGetBang() *Bang { + if !x.IsSetBang() { + return NewBang() + } + return x.Bang +} + + + +func (x *respCThing) Exception() thrift.WritableException { + if x.Bang != nil { + return x.Bang + } + return nil +} + +func (x *respCThing) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respCThing"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respCThing) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.STRING)): // success + fieldReadErr = x.readField0(p) + case (id == 1 && wireType == thrift.Type(thrift.STRUCT)): // bang + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respCThing) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respCThing({") + sb.WriteString(fmt.Sprintf("Success:%s ", x.toString0())) + sb.WriteString(fmt.Sprintf("Bang:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *respCThing) setDefaults() *respCThing { + return x +} + + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/empty-struct/out/go/gen-go/module/types.go b/thrift/compiler/test/fixtures/empty-struct/out/go/gen-go/module/types.go index dd14414c97b..570963fc020 100644 --- a/thrift/compiler/test/fixtures/empty-struct/out/go/gen-go/module/types.go +++ b/thrift/compiler/test/fixtures/empty-struct/out/go/gen-go/module/types.go @@ -192,6 +192,7 @@ func (x *Nada) setDefaults() *Nada { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/enums/out/go/gen-go/module/types.go b/thrift/compiler/test/fixtures/enums/out/go/gen-go/module/types.go index d0b077e330e..00e442c59df 100644 --- a/thrift/compiler/test/fixtures/enums/out/go/gen-go/module/types.go +++ b/thrift/compiler/test/fixtures/enums/out/go/gen-go/module/types.go @@ -982,6 +982,7 @@ func (x *MyStruct) setDefaults() *MyStruct { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/enums/out/go/gen-go/thrift/annotation/scope/types.go b/thrift/compiler/test/fixtures/enums/out/go/gen-go/thrift/annotation/scope/types.go index c2871133501..c8a6b005a41 100644 --- a/thrift/compiler/test/fixtures/enums/out/go/gen-go/thrift/annotation/scope/types.go +++ b/thrift/compiler/test/fixtures/enums/out/go/gen-go/thrift/annotation/scope/types.go @@ -1380,6 +1380,7 @@ func (x *Definition) setDefaults() *Definition { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/enums/out/go/gen-go/thrift/annotation/thrift/types.go b/thrift/compiler/test/fixtures/enums/out/go/gen-go/thrift/annotation/thrift/types.go index 85cadd20f65..ba562235211 100644 --- a/thrift/compiler/test/fixtures/enums/out/go/gen-go/thrift/annotation/thrift/types.go +++ b/thrift/compiler/test/fixtures/enums/out/go/gen-go/thrift/annotation/thrift/types.go @@ -1804,6 +1804,7 @@ func (x *AllowReservedFilename) setDefaults() *AllowReservedFilename { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/module/svcs.go b/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/module/svcs.go index 8b39b2640a2..cde87ced301 100644 --- a/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/module/svcs.go +++ b/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/module/svcs.go @@ -175,1267 +175,6 @@ func (c *RaiserClient) Get500Context(ctx context.Context) (string, error) { return c.chClient.Get500(ctx) } -type reqRaiserDoBland struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqRaiserDoBland)(nil) - -// Deprecated: RaiserDoBlandArgsDeprecated is deprecated, since it is supposed to be internal. -type RaiserDoBlandArgsDeprecated = reqRaiserDoBland - -func newReqRaiserDoBland() *reqRaiserDoBland { - return (&reqRaiserDoBland{}).setDefaults() -} - - - -func (x *reqRaiserDoBland) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqRaiserDoBland"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqRaiserDoBland) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqRaiserDoBland) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqRaiserDoBland({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqRaiserDoBland) setDefaults() *reqRaiserDoBland { - return x -} - -type respRaiserDoBland struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respRaiserDoBland)(nil) -var _ thrift.WritableResult = (*respRaiserDoBland)(nil) - -// Deprecated: RaiserDoBlandResultDeprecated is deprecated, since it is supposed to be internal. -type RaiserDoBlandResultDeprecated = respRaiserDoBland - -func newRespRaiserDoBland() *respRaiserDoBland { - return (&respRaiserDoBland{}).setDefaults() -} - - - -func (x *respRaiserDoBland) Exception() thrift.WritableException { - return nil -} - -func (x *respRaiserDoBland) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respRaiserDoBland"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respRaiserDoBland) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respRaiserDoBland) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respRaiserDoBland({") - sb.WriteString("})") - - return sb.String() -} -func (x *respRaiserDoBland) setDefaults() *respRaiserDoBland { - return x -} - -type reqRaiserDoRaise struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqRaiserDoRaise)(nil) - -// Deprecated: RaiserDoRaiseArgsDeprecated is deprecated, since it is supposed to be internal. -type RaiserDoRaiseArgsDeprecated = reqRaiserDoRaise - -func newReqRaiserDoRaise() *reqRaiserDoRaise { - return (&reqRaiserDoRaise{}).setDefaults() -} - - - -func (x *reqRaiserDoRaise) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqRaiserDoRaise"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqRaiserDoRaise) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqRaiserDoRaise) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqRaiserDoRaise({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqRaiserDoRaise) setDefaults() *reqRaiserDoRaise { - return x -} - -type respRaiserDoRaise struct { - B *Banal `thrift:"b,1,optional" json:"b,omitempty" db:"b"` - F *Fiery `thrift:"f,2,optional" json:"f,omitempty" db:"f"` - S *Serious `thrift:"s,3,optional" json:"s,omitempty" db:"s"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respRaiserDoRaise)(nil) -var _ thrift.WritableResult = (*respRaiserDoRaise)(nil) - -// Deprecated: RaiserDoRaiseResultDeprecated is deprecated, since it is supposed to be internal. -type RaiserDoRaiseResultDeprecated = respRaiserDoRaise - -func newRespRaiserDoRaise() *respRaiserDoRaise { - return (&respRaiserDoRaise{}).setDefaults() -} - -func (x *respRaiserDoRaise) GetB() *Banal { - if !x.IsSetB() { - return nil - } - return x.B -} - -func (x *respRaiserDoRaise) GetF() *Fiery { - if !x.IsSetF() { - return nil - } - return x.F -} - -func (x *respRaiserDoRaise) GetS() *Serious { - if !x.IsSetS() { - return nil - } - return x.S -} - -func (x *respRaiserDoRaise) SetBNonCompat(value *Banal) *respRaiserDoRaise { - x.B = value - return x -} - -func (x *respRaiserDoRaise) SetB(value *Banal) *respRaiserDoRaise { - x.B = value - return x -} - -func (x *respRaiserDoRaise) SetFNonCompat(value *Fiery) *respRaiserDoRaise { - x.F = value - return x -} - -func (x *respRaiserDoRaise) SetF(value *Fiery) *respRaiserDoRaise { - x.F = value - return x -} - -func (x *respRaiserDoRaise) SetSNonCompat(value *Serious) *respRaiserDoRaise { - x.S = value - return x -} - -func (x *respRaiserDoRaise) SetS(value *Serious) *respRaiserDoRaise { - x.S = value - return x -} - -func (x *respRaiserDoRaise) IsSetB() bool { - return x != nil && x.B != nil -} - -func (x *respRaiserDoRaise) IsSetF() bool { - return x != nil && x.F != nil -} - -func (x *respRaiserDoRaise) IsSetS() bool { - return x != nil && x.S != nil -} - -func (x *respRaiserDoRaise) writeField1(p thrift.Encoder) error { // B - if !x.IsSetB() { - return nil - } - - if err := p.WriteFieldBegin("b", thrift.STRUCT, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.B - if err := item.Write(p); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respRaiserDoRaise) writeField2(p thrift.Encoder) error { // F - if !x.IsSetF() { - return nil - } - - if err := p.WriteFieldBegin("f", thrift.STRUCT, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.F - if err := item.Write(p); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respRaiserDoRaise) writeField3(p thrift.Encoder) error { // S - if !x.IsSetS() { - return nil - } - - if err := p.WriteFieldBegin("s", thrift.STRUCT, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.S - if err := item.Write(p); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respRaiserDoRaise) readField1(p thrift.Decoder) error { // B - result := NewBanal() -err := result.Read(p) -if err != nil { - return err -} - - x.B = result - return nil -} - -func (x *respRaiserDoRaise) readField2(p thrift.Decoder) error { // F - result := NewFiery() -err := result.Read(p) -if err != nil { - return err -} - - x.F = result - return nil -} - -func (x *respRaiserDoRaise) readField3(p thrift.Decoder) error { // S - result := NewSerious() -err := result.Read(p) -if err != nil { - return err -} - - x.S = result - return nil -} - -func (x *respRaiserDoRaise) toString1() string { // B - return fmt.Sprintf("%v", x.B) -} - -func (x *respRaiserDoRaise) toString2() string { // F - return fmt.Sprintf("%v", x.F) -} - -func (x *respRaiserDoRaise) toString3() string { // S - return fmt.Sprintf("%v", x.S) -} - -// Deprecated: Use newRespRaiserDoRaise().GetB() instead. -func (x *respRaiserDoRaise) DefaultGetB() *Banal { - if !x.IsSetB() { - return NewBanal() - } - return x.B -} - -// Deprecated: Use newRespRaiserDoRaise().GetF() instead. -func (x *respRaiserDoRaise) DefaultGetF() *Fiery { - if !x.IsSetF() { - return NewFiery() - } - return x.F -} - -// Deprecated: Use newRespRaiserDoRaise().GetS() instead. -func (x *respRaiserDoRaise) DefaultGetS() *Serious { - if !x.IsSetS() { - return NewSerious() - } - return x.S -} - - - -func (x *respRaiserDoRaise) Exception() thrift.WritableException { - if x.B != nil { - return x.B - } - if x.F != nil { - return x.F - } - if x.S != nil { - return x.S - } - return nil -} - -func (x *respRaiserDoRaise) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respRaiserDoRaise"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - if err := x.writeField2(p); err != nil { - return err - } - if err := x.writeField3(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respRaiserDoRaise) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.STRUCT)): // b - fieldReadErr = x.readField1(p) - case (id == 2 && wireType == thrift.Type(thrift.STRUCT)): // f - fieldReadErr = x.readField2(p) - case (id == 3 && wireType == thrift.Type(thrift.STRUCT)): // s - fieldReadErr = x.readField3(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respRaiserDoRaise) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respRaiserDoRaise({") - sb.WriteString(fmt.Sprintf("B:%s ", x.toString1())) - sb.WriteString(fmt.Sprintf("F:%s ", x.toString2())) - sb.WriteString(fmt.Sprintf("S:%s", x.toString3())) - sb.WriteString("})") - - return sb.String() -} -func (x *respRaiserDoRaise) setDefaults() *respRaiserDoRaise { - return x -} - -type reqRaiserGet200 struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqRaiserGet200)(nil) - -// Deprecated: RaiserGet200ArgsDeprecated is deprecated, since it is supposed to be internal. -type RaiserGet200ArgsDeprecated = reqRaiserGet200 - -func newReqRaiserGet200() *reqRaiserGet200 { - return (&reqRaiserGet200{}).setDefaults() -} - - - -func (x *reqRaiserGet200) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqRaiserGet200"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqRaiserGet200) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqRaiserGet200) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqRaiserGet200({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqRaiserGet200) setDefaults() *reqRaiserGet200 { - return x -} - -type respRaiserGet200 struct { - Success *string `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respRaiserGet200)(nil) -var _ thrift.WritableResult = (*respRaiserGet200)(nil) - -// Deprecated: RaiserGet200ResultDeprecated is deprecated, since it is supposed to be internal. -type RaiserGet200ResultDeprecated = respRaiserGet200 - -func newRespRaiserGet200() *respRaiserGet200 { - return (&respRaiserGet200{}).setDefaults() -} - -func (x *respRaiserGet200) GetSuccess() string { - if !x.IsSetSuccess() { - return "" - } - return *x.Success -} - -func (x *respRaiserGet200) SetSuccessNonCompat(value string) *respRaiserGet200 { - x.Success = &value - return x -} - -func (x *respRaiserGet200) SetSuccess(value *string) *respRaiserGet200 { - x.Success = value - return x -} - -func (x *respRaiserGet200) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respRaiserGet200) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.STRING, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteString(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respRaiserGet200) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadString() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respRaiserGet200) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respRaiserGet200) Exception() thrift.WritableException { - return nil -} - -func (x *respRaiserGet200) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respRaiserGet200"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respRaiserGet200) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.STRING)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respRaiserGet200) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respRaiserGet200({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respRaiserGet200) setDefaults() *respRaiserGet200 { - return x -} - -type reqRaiserGet500 struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqRaiserGet500)(nil) - -// Deprecated: RaiserGet500ArgsDeprecated is deprecated, since it is supposed to be internal. -type RaiserGet500ArgsDeprecated = reqRaiserGet500 - -func newReqRaiserGet500() *reqRaiserGet500 { - return (&reqRaiserGet500{}).setDefaults() -} - - - -func (x *reqRaiserGet500) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqRaiserGet500"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqRaiserGet500) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqRaiserGet500) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqRaiserGet500({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqRaiserGet500) setDefaults() *reqRaiserGet500 { - return x -} - -type respRaiserGet500 struct { - Success *string `thrift:"success,0,optional" json:"success,omitempty" db:"success"` - F *Fiery `thrift:"f,1,optional" json:"f,omitempty" db:"f"` - B *Banal `thrift:"b,2,optional" json:"b,omitempty" db:"b"` - S *Serious `thrift:"s,3,optional" json:"s,omitempty" db:"s"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respRaiserGet500)(nil) -var _ thrift.WritableResult = (*respRaiserGet500)(nil) - -// Deprecated: RaiserGet500ResultDeprecated is deprecated, since it is supposed to be internal. -type RaiserGet500ResultDeprecated = respRaiserGet500 - -func newRespRaiserGet500() *respRaiserGet500 { - return (&respRaiserGet500{}).setDefaults() -} - -func (x *respRaiserGet500) GetSuccess() string { - if !x.IsSetSuccess() { - return "" - } - return *x.Success -} - -func (x *respRaiserGet500) GetF() *Fiery { - if !x.IsSetF() { - return nil - } - return x.F -} - -func (x *respRaiserGet500) GetB() *Banal { - if !x.IsSetB() { - return nil - } - return x.B -} - -func (x *respRaiserGet500) GetS() *Serious { - if !x.IsSetS() { - return nil - } - return x.S -} - -func (x *respRaiserGet500) SetSuccessNonCompat(value string) *respRaiserGet500 { - x.Success = &value - return x -} - -func (x *respRaiserGet500) SetSuccess(value *string) *respRaiserGet500 { - x.Success = value - return x -} - -func (x *respRaiserGet500) SetFNonCompat(value *Fiery) *respRaiserGet500 { - x.F = value - return x -} - -func (x *respRaiserGet500) SetF(value *Fiery) *respRaiserGet500 { - x.F = value - return x -} - -func (x *respRaiserGet500) SetBNonCompat(value *Banal) *respRaiserGet500 { - x.B = value - return x -} - -func (x *respRaiserGet500) SetB(value *Banal) *respRaiserGet500 { - x.B = value - return x -} - -func (x *respRaiserGet500) SetSNonCompat(value *Serious) *respRaiserGet500 { - x.S = value - return x -} - -func (x *respRaiserGet500) SetS(value *Serious) *respRaiserGet500 { - x.S = value - return x -} - -func (x *respRaiserGet500) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respRaiserGet500) IsSetF() bool { - return x != nil && x.F != nil -} - -func (x *respRaiserGet500) IsSetB() bool { - return x != nil && x.B != nil -} - -func (x *respRaiserGet500) IsSetS() bool { - return x != nil && x.S != nil -} - -func (x *respRaiserGet500) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.STRING, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteString(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respRaiserGet500) writeField1(p thrift.Encoder) error { // F - if !x.IsSetF() { - return nil - } - - if err := p.WriteFieldBegin("f", thrift.STRUCT, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.F - if err := item.Write(p); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respRaiserGet500) writeField2(p thrift.Encoder) error { // B - if !x.IsSetB() { - return nil - } - - if err := p.WriteFieldBegin("b", thrift.STRUCT, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.B - if err := item.Write(p); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respRaiserGet500) writeField3(p thrift.Encoder) error { // S - if !x.IsSetS() { - return nil - } - - if err := p.WriteFieldBegin("s", thrift.STRUCT, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.S - if err := item.Write(p); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respRaiserGet500) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadString() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respRaiserGet500) readField1(p thrift.Decoder) error { // F - result := NewFiery() -err := result.Read(p) -if err != nil { - return err -} - - x.F = result - return nil -} - -func (x *respRaiserGet500) readField2(p thrift.Decoder) error { // B - result := NewBanal() -err := result.Read(p) -if err != nil { - return err -} - - x.B = result - return nil -} - -func (x *respRaiserGet500) readField3(p thrift.Decoder) error { // S - result := NewSerious() -err := result.Read(p) -if err != nil { - return err -} - - x.S = result - return nil -} - -func (x *respRaiserGet500) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - -func (x *respRaiserGet500) toString1() string { // F - return fmt.Sprintf("%v", x.F) -} - -func (x *respRaiserGet500) toString2() string { // B - return fmt.Sprintf("%v", x.B) -} - -func (x *respRaiserGet500) toString3() string { // S - return fmt.Sprintf("%v", x.S) -} - - -// Deprecated: Use newRespRaiserGet500().GetF() instead. -func (x *respRaiserGet500) DefaultGetF() *Fiery { - if !x.IsSetF() { - return NewFiery() - } - return x.F -} - -// Deprecated: Use newRespRaiserGet500().GetB() instead. -func (x *respRaiserGet500) DefaultGetB() *Banal { - if !x.IsSetB() { - return NewBanal() - } - return x.B -} - -// Deprecated: Use newRespRaiserGet500().GetS() instead. -func (x *respRaiserGet500) DefaultGetS() *Serious { - if !x.IsSetS() { - return NewSerious() - } - return x.S -} - - - -func (x *respRaiserGet500) Exception() thrift.WritableException { - if x.F != nil { - return x.F - } - if x.B != nil { - return x.B - } - if x.S != nil { - return x.S - } - return nil -} - -func (x *respRaiserGet500) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respRaiserGet500"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - if err := x.writeField1(p); err != nil { - return err - } - if err := x.writeField2(p); err != nil { - return err - } - if err := x.writeField3(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respRaiserGet500) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.STRING)): // success - fieldReadErr = x.readField0(p) - case (id == 1 && wireType == thrift.Type(thrift.STRUCT)): // f - fieldReadErr = x.readField1(p) - case (id == 2 && wireType == thrift.Type(thrift.STRUCT)): // b - fieldReadErr = x.readField2(p) - case (id == 3 && wireType == thrift.Type(thrift.STRUCT)): // s - fieldReadErr = x.readField3(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respRaiserGet500) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respRaiserGet500({") - sb.WriteString(fmt.Sprintf("Success:%s ", x.toString0())) - sb.WriteString(fmt.Sprintf("F:%s ", x.toString1())) - sb.WriteString(fmt.Sprintf("B:%s ", x.toString2())) - sb.WriteString(fmt.Sprintf("S:%s", x.toString3())) - sb.WriteString("})") - - return sb.String() -} -func (x *respRaiserGet500) setDefaults() *respRaiserGet500 { - return x -} - - type RaiserProcessor struct { processorFunctionMap map[string]thrift.ProcessorFunction diff --git a/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/module/types.go b/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/module/types.go index 0a27e5155f8..392b8dac239 100644 --- a/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/module/types.go +++ b/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/module/types.go @@ -1135,6 +1135,1268 @@ func (x *Banal) Error() string { return x.String() } +// Service req/resp structs (below) +type reqRaiserDoBland struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqRaiserDoBland)(nil) + +// Deprecated: RaiserDoBlandArgsDeprecated is deprecated, since it is supposed to be internal. +type RaiserDoBlandArgsDeprecated = reqRaiserDoBland + +func newReqRaiserDoBland() *reqRaiserDoBland { + return (&reqRaiserDoBland{}).setDefaults() +} + + + +func (x *reqRaiserDoBland) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqRaiserDoBland"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqRaiserDoBland) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqRaiserDoBland) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqRaiserDoBland({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqRaiserDoBland) setDefaults() *reqRaiserDoBland { + return x +} + +type respRaiserDoBland struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respRaiserDoBland)(nil) +var _ thrift.WritableResult = (*respRaiserDoBland)(nil) + +// Deprecated: RaiserDoBlandResultDeprecated is deprecated, since it is supposed to be internal. +type RaiserDoBlandResultDeprecated = respRaiserDoBland + +func newRespRaiserDoBland() *respRaiserDoBland { + return (&respRaiserDoBland{}).setDefaults() +} + + + +func (x *respRaiserDoBland) Exception() thrift.WritableException { + return nil +} + +func (x *respRaiserDoBland) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respRaiserDoBland"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respRaiserDoBland) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respRaiserDoBland) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respRaiserDoBland({") + sb.WriteString("})") + + return sb.String() +} +func (x *respRaiserDoBland) setDefaults() *respRaiserDoBland { + return x +} + +type reqRaiserDoRaise struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqRaiserDoRaise)(nil) + +// Deprecated: RaiserDoRaiseArgsDeprecated is deprecated, since it is supposed to be internal. +type RaiserDoRaiseArgsDeprecated = reqRaiserDoRaise + +func newReqRaiserDoRaise() *reqRaiserDoRaise { + return (&reqRaiserDoRaise{}).setDefaults() +} + + + +func (x *reqRaiserDoRaise) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqRaiserDoRaise"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqRaiserDoRaise) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqRaiserDoRaise) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqRaiserDoRaise({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqRaiserDoRaise) setDefaults() *reqRaiserDoRaise { + return x +} + +type respRaiserDoRaise struct { + B *Banal `thrift:"b,1,optional" json:"b,omitempty" db:"b"` + F *Fiery `thrift:"f,2,optional" json:"f,omitempty" db:"f"` + S *Serious `thrift:"s,3,optional" json:"s,omitempty" db:"s"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respRaiserDoRaise)(nil) +var _ thrift.WritableResult = (*respRaiserDoRaise)(nil) + +// Deprecated: RaiserDoRaiseResultDeprecated is deprecated, since it is supposed to be internal. +type RaiserDoRaiseResultDeprecated = respRaiserDoRaise + +func newRespRaiserDoRaise() *respRaiserDoRaise { + return (&respRaiserDoRaise{}).setDefaults() +} + +func (x *respRaiserDoRaise) GetB() *Banal { + if !x.IsSetB() { + return nil + } + return x.B +} + +func (x *respRaiserDoRaise) GetF() *Fiery { + if !x.IsSetF() { + return nil + } + return x.F +} + +func (x *respRaiserDoRaise) GetS() *Serious { + if !x.IsSetS() { + return nil + } + return x.S +} + +func (x *respRaiserDoRaise) SetBNonCompat(value *Banal) *respRaiserDoRaise { + x.B = value + return x +} + +func (x *respRaiserDoRaise) SetB(value *Banal) *respRaiserDoRaise { + x.B = value + return x +} + +func (x *respRaiserDoRaise) SetFNonCompat(value *Fiery) *respRaiserDoRaise { + x.F = value + return x +} + +func (x *respRaiserDoRaise) SetF(value *Fiery) *respRaiserDoRaise { + x.F = value + return x +} + +func (x *respRaiserDoRaise) SetSNonCompat(value *Serious) *respRaiserDoRaise { + x.S = value + return x +} + +func (x *respRaiserDoRaise) SetS(value *Serious) *respRaiserDoRaise { + x.S = value + return x +} + +func (x *respRaiserDoRaise) IsSetB() bool { + return x != nil && x.B != nil +} + +func (x *respRaiserDoRaise) IsSetF() bool { + return x != nil && x.F != nil +} + +func (x *respRaiserDoRaise) IsSetS() bool { + return x != nil && x.S != nil +} + +func (x *respRaiserDoRaise) writeField1(p thrift.Encoder) error { // B + if !x.IsSetB() { + return nil + } + + if err := p.WriteFieldBegin("b", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.B + if err := item.Write(p); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respRaiserDoRaise) writeField2(p thrift.Encoder) error { // F + if !x.IsSetF() { + return nil + } + + if err := p.WriteFieldBegin("f", thrift.STRUCT, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.F + if err := item.Write(p); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respRaiserDoRaise) writeField3(p thrift.Encoder) error { // S + if !x.IsSetS() { + return nil + } + + if err := p.WriteFieldBegin("s", thrift.STRUCT, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.S + if err := item.Write(p); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respRaiserDoRaise) readField1(p thrift.Decoder) error { // B + result := NewBanal() +err := result.Read(p) +if err != nil { + return err +} + + x.B = result + return nil +} + +func (x *respRaiserDoRaise) readField2(p thrift.Decoder) error { // F + result := NewFiery() +err := result.Read(p) +if err != nil { + return err +} + + x.F = result + return nil +} + +func (x *respRaiserDoRaise) readField3(p thrift.Decoder) error { // S + result := NewSerious() +err := result.Read(p) +if err != nil { + return err +} + + x.S = result + return nil +} + +func (x *respRaiserDoRaise) toString1() string { // B + return fmt.Sprintf("%v", x.B) +} + +func (x *respRaiserDoRaise) toString2() string { // F + return fmt.Sprintf("%v", x.F) +} + +func (x *respRaiserDoRaise) toString3() string { // S + return fmt.Sprintf("%v", x.S) +} + +// Deprecated: Use newRespRaiserDoRaise().GetB() instead. +func (x *respRaiserDoRaise) DefaultGetB() *Banal { + if !x.IsSetB() { + return NewBanal() + } + return x.B +} + +// Deprecated: Use newRespRaiserDoRaise().GetF() instead. +func (x *respRaiserDoRaise) DefaultGetF() *Fiery { + if !x.IsSetF() { + return NewFiery() + } + return x.F +} + +// Deprecated: Use newRespRaiserDoRaise().GetS() instead. +func (x *respRaiserDoRaise) DefaultGetS() *Serious { + if !x.IsSetS() { + return NewSerious() + } + return x.S +} + + + +func (x *respRaiserDoRaise) Exception() thrift.WritableException { + if x.B != nil { + return x.B + } + if x.F != nil { + return x.F + } + if x.S != nil { + return x.S + } + return nil +} + +func (x *respRaiserDoRaise) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respRaiserDoRaise"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + if err := x.writeField2(p); err != nil { + return err + } + if err := x.writeField3(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respRaiserDoRaise) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.STRUCT)): // b + fieldReadErr = x.readField1(p) + case (id == 2 && wireType == thrift.Type(thrift.STRUCT)): // f + fieldReadErr = x.readField2(p) + case (id == 3 && wireType == thrift.Type(thrift.STRUCT)): // s + fieldReadErr = x.readField3(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respRaiserDoRaise) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respRaiserDoRaise({") + sb.WriteString(fmt.Sprintf("B:%s ", x.toString1())) + sb.WriteString(fmt.Sprintf("F:%s ", x.toString2())) + sb.WriteString(fmt.Sprintf("S:%s", x.toString3())) + sb.WriteString("})") + + return sb.String() +} +func (x *respRaiserDoRaise) setDefaults() *respRaiserDoRaise { + return x +} + +type reqRaiserGet200 struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqRaiserGet200)(nil) + +// Deprecated: RaiserGet200ArgsDeprecated is deprecated, since it is supposed to be internal. +type RaiserGet200ArgsDeprecated = reqRaiserGet200 + +func newReqRaiserGet200() *reqRaiserGet200 { + return (&reqRaiserGet200{}).setDefaults() +} + + + +func (x *reqRaiserGet200) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqRaiserGet200"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqRaiserGet200) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqRaiserGet200) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqRaiserGet200({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqRaiserGet200) setDefaults() *reqRaiserGet200 { + return x +} + +type respRaiserGet200 struct { + Success *string `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respRaiserGet200)(nil) +var _ thrift.WritableResult = (*respRaiserGet200)(nil) + +// Deprecated: RaiserGet200ResultDeprecated is deprecated, since it is supposed to be internal. +type RaiserGet200ResultDeprecated = respRaiserGet200 + +func newRespRaiserGet200() *respRaiserGet200 { + return (&respRaiserGet200{}).setDefaults() +} + +func (x *respRaiserGet200) GetSuccess() string { + if !x.IsSetSuccess() { + return "" + } + return *x.Success +} + +func (x *respRaiserGet200) SetSuccessNonCompat(value string) *respRaiserGet200 { + x.Success = &value + return x +} + +func (x *respRaiserGet200) SetSuccess(value *string) *respRaiserGet200 { + x.Success = value + return x +} + +func (x *respRaiserGet200) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respRaiserGet200) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.STRING, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteString(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respRaiserGet200) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadString() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respRaiserGet200) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respRaiserGet200) Exception() thrift.WritableException { + return nil +} + +func (x *respRaiserGet200) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respRaiserGet200"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respRaiserGet200) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.STRING)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respRaiserGet200) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respRaiserGet200({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respRaiserGet200) setDefaults() *respRaiserGet200 { + return x +} + +type reqRaiserGet500 struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqRaiserGet500)(nil) + +// Deprecated: RaiserGet500ArgsDeprecated is deprecated, since it is supposed to be internal. +type RaiserGet500ArgsDeprecated = reqRaiserGet500 + +func newReqRaiserGet500() *reqRaiserGet500 { + return (&reqRaiserGet500{}).setDefaults() +} + + + +func (x *reqRaiserGet500) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqRaiserGet500"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqRaiserGet500) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqRaiserGet500) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqRaiserGet500({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqRaiserGet500) setDefaults() *reqRaiserGet500 { + return x +} + +type respRaiserGet500 struct { + Success *string `thrift:"success,0,optional" json:"success,omitempty" db:"success"` + F *Fiery `thrift:"f,1,optional" json:"f,omitempty" db:"f"` + B *Banal `thrift:"b,2,optional" json:"b,omitempty" db:"b"` + S *Serious `thrift:"s,3,optional" json:"s,omitempty" db:"s"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respRaiserGet500)(nil) +var _ thrift.WritableResult = (*respRaiserGet500)(nil) + +// Deprecated: RaiserGet500ResultDeprecated is deprecated, since it is supposed to be internal. +type RaiserGet500ResultDeprecated = respRaiserGet500 + +func newRespRaiserGet500() *respRaiserGet500 { + return (&respRaiserGet500{}).setDefaults() +} + +func (x *respRaiserGet500) GetSuccess() string { + if !x.IsSetSuccess() { + return "" + } + return *x.Success +} + +func (x *respRaiserGet500) GetF() *Fiery { + if !x.IsSetF() { + return nil + } + return x.F +} + +func (x *respRaiserGet500) GetB() *Banal { + if !x.IsSetB() { + return nil + } + return x.B +} + +func (x *respRaiserGet500) GetS() *Serious { + if !x.IsSetS() { + return nil + } + return x.S +} + +func (x *respRaiserGet500) SetSuccessNonCompat(value string) *respRaiserGet500 { + x.Success = &value + return x +} + +func (x *respRaiserGet500) SetSuccess(value *string) *respRaiserGet500 { + x.Success = value + return x +} + +func (x *respRaiserGet500) SetFNonCompat(value *Fiery) *respRaiserGet500 { + x.F = value + return x +} + +func (x *respRaiserGet500) SetF(value *Fiery) *respRaiserGet500 { + x.F = value + return x +} + +func (x *respRaiserGet500) SetBNonCompat(value *Banal) *respRaiserGet500 { + x.B = value + return x +} + +func (x *respRaiserGet500) SetB(value *Banal) *respRaiserGet500 { + x.B = value + return x +} + +func (x *respRaiserGet500) SetSNonCompat(value *Serious) *respRaiserGet500 { + x.S = value + return x +} + +func (x *respRaiserGet500) SetS(value *Serious) *respRaiserGet500 { + x.S = value + return x +} + +func (x *respRaiserGet500) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respRaiserGet500) IsSetF() bool { + return x != nil && x.F != nil +} + +func (x *respRaiserGet500) IsSetB() bool { + return x != nil && x.B != nil +} + +func (x *respRaiserGet500) IsSetS() bool { + return x != nil && x.S != nil +} + +func (x *respRaiserGet500) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.STRING, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteString(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respRaiserGet500) writeField1(p thrift.Encoder) error { // F + if !x.IsSetF() { + return nil + } + + if err := p.WriteFieldBegin("f", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.F + if err := item.Write(p); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respRaiserGet500) writeField2(p thrift.Encoder) error { // B + if !x.IsSetB() { + return nil + } + + if err := p.WriteFieldBegin("b", thrift.STRUCT, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.B + if err := item.Write(p); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respRaiserGet500) writeField3(p thrift.Encoder) error { // S + if !x.IsSetS() { + return nil + } + + if err := p.WriteFieldBegin("s", thrift.STRUCT, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.S + if err := item.Write(p); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respRaiserGet500) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadString() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respRaiserGet500) readField1(p thrift.Decoder) error { // F + result := NewFiery() +err := result.Read(p) +if err != nil { + return err +} + + x.F = result + return nil +} + +func (x *respRaiserGet500) readField2(p thrift.Decoder) error { // B + result := NewBanal() +err := result.Read(p) +if err != nil { + return err +} + + x.B = result + return nil +} + +func (x *respRaiserGet500) readField3(p thrift.Decoder) error { // S + result := NewSerious() +err := result.Read(p) +if err != nil { + return err +} + + x.S = result + return nil +} + +func (x *respRaiserGet500) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + +func (x *respRaiserGet500) toString1() string { // F + return fmt.Sprintf("%v", x.F) +} + +func (x *respRaiserGet500) toString2() string { // B + return fmt.Sprintf("%v", x.B) +} + +func (x *respRaiserGet500) toString3() string { // S + return fmt.Sprintf("%v", x.S) +} + + +// Deprecated: Use newRespRaiserGet500().GetF() instead. +func (x *respRaiserGet500) DefaultGetF() *Fiery { + if !x.IsSetF() { + return NewFiery() + } + return x.F +} + +// Deprecated: Use newRespRaiserGet500().GetB() instead. +func (x *respRaiserGet500) DefaultGetB() *Banal { + if !x.IsSetB() { + return NewBanal() + } + return x.B +} + +// Deprecated: Use newRespRaiserGet500().GetS() instead. +func (x *respRaiserGet500) DefaultGetS() *Serious { + if !x.IsSetS() { + return NewSerious() + } + return x.S +} + + + +func (x *respRaiserGet500) Exception() thrift.WritableException { + if x.F != nil { + return x.F + } + if x.B != nil { + return x.B + } + if x.S != nil { + return x.S + } + return nil +} + +func (x *respRaiserGet500) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respRaiserGet500"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + if err := x.writeField1(p); err != nil { + return err + } + if err := x.writeField2(p); err != nil { + return err + } + if err := x.writeField3(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respRaiserGet500) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.STRING)): // success + fieldReadErr = x.readField0(p) + case (id == 1 && wireType == thrift.Type(thrift.STRUCT)): // f + fieldReadErr = x.readField1(p) + case (id == 2 && wireType == thrift.Type(thrift.STRUCT)): // b + fieldReadErr = x.readField2(p) + case (id == 3 && wireType == thrift.Type(thrift.STRUCT)): // s + fieldReadErr = x.readField3(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respRaiserGet500) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respRaiserGet500({") + sb.WriteString(fmt.Sprintf("Success:%s ", x.toString0())) + sb.WriteString(fmt.Sprintf("F:%s ", x.toString1())) + sb.WriteString(fmt.Sprintf("B:%s ", x.toString2())) + sb.WriteString(fmt.Sprintf("S:%s", x.toString3())) + sb.WriteString("})") + + return sb.String() +} +func (x *respRaiserGet500) setDefaults() *respRaiserGet500 { + return x +} + + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/python/types.go b/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/python/types.go index 6c730aa3cae..a7510986f18 100644 --- a/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/python/types.go +++ b/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/python/types.go @@ -760,6 +760,7 @@ func (x *UseCAPI) setDefaults() *UseCAPI { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/scope/types.go b/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/scope/types.go index c2871133501..c8a6b005a41 100644 --- a/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/scope/types.go +++ b/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/scope/types.go @@ -1380,6 +1380,7 @@ func (x *Definition) setDefaults() *Definition { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/thrift/types.go b/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/thrift/types.go index 85cadd20f65..ba562235211 100644 --- a/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/thrift/types.go +++ b/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/thrift/types.go @@ -1804,6 +1804,7 @@ func (x *AllowReservedFilename) setDefaults() *AllowReservedFilename { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/go-service/out/go/gen-go/module/svcs.go b/thrift/compiler/test/fixtures/go-service/out/go/gen-go/module/svcs.go index 7501f1a7db7..6ac148a90c5 100644 --- a/thrift/compiler/test/fixtures/go-service/out/go/gen-go/module/svcs.go +++ b/thrift/compiler/test/fixtures/go-service/out/go/gen-go/module/svcs.go @@ -576,6219 +576,6 @@ func (c *GetEntityClient) GetErr1CollisionContext(ctx context.Context, err int64 return c.chClient.GetErr1Collision(ctx, err, err1) } -type reqGetEntityGetEntity struct { - R *GetEntityRequest `thrift:"r,1" json:"r" db:"r"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqGetEntityGetEntity)(nil) - -// Deprecated: GetEntityGetEntityArgsDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetEntityArgsDeprecated = reqGetEntityGetEntity - -func newReqGetEntityGetEntity() *reqGetEntityGetEntity { - return (&reqGetEntityGetEntity{}).setDefaults() -} - -func (x *reqGetEntityGetEntity) GetR() *GetEntityRequest { - if !x.IsSetR() { - return nil - } - return x.R -} - -func (x *reqGetEntityGetEntity) SetRNonCompat(value *GetEntityRequest) *reqGetEntityGetEntity { - x.R = value - return x -} - -func (x *reqGetEntityGetEntity) SetR(value *GetEntityRequest) *reqGetEntityGetEntity { - x.R = value - return x -} - -func (x *reqGetEntityGetEntity) IsSetR() bool { - return x != nil && x.R != nil -} - -func (x *reqGetEntityGetEntity) writeField1(p thrift.Encoder) error { // R - if !x.IsSetR() { - return nil - } - - if err := p.WriteFieldBegin("r", thrift.STRUCT, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.R - if err := item.Write(p); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetEntity) readField1(p thrift.Decoder) error { // R - result := NewGetEntityRequest() -err := result.Read(p) -if err != nil { - return err -} - - x.R = result - return nil -} - -func (x *reqGetEntityGetEntity) toString1() string { // R - return fmt.Sprintf("%v", x.R) -} - -// Deprecated: Use newReqGetEntityGetEntity().GetR() instead. -func (x *reqGetEntityGetEntity) DefaultGetR() *GetEntityRequest { - if !x.IsSetR() { - return NewGetEntityRequest() - } - return x.R -} - - - -func (x *reqGetEntityGetEntity) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqGetEntityGetEntity"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetEntity) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.STRUCT)): // r - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqGetEntityGetEntity) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqGetEntityGetEntity({") - sb.WriteString(fmt.Sprintf("R:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqGetEntityGetEntity) setDefaults() *reqGetEntityGetEntity { - return x. - SetRNonCompat(NewGetEntityRequest()) -} - -type respGetEntityGetEntity struct { - Success *GetEntityResponse `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respGetEntityGetEntity)(nil) -var _ thrift.WritableResult = (*respGetEntityGetEntity)(nil) - -// Deprecated: GetEntityGetEntityResultDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetEntityResultDeprecated = respGetEntityGetEntity - -func newRespGetEntityGetEntity() *respGetEntityGetEntity { - return (&respGetEntityGetEntity{}).setDefaults() -} - -func (x *respGetEntityGetEntity) GetSuccess() *GetEntityResponse { - if !x.IsSetSuccess() { - return nil - } - return x.Success -} - -func (x *respGetEntityGetEntity) SetSuccessNonCompat(value *GetEntityResponse) *respGetEntityGetEntity { - x.Success = value - return x -} - -func (x *respGetEntityGetEntity) SetSuccess(value *GetEntityResponse) *respGetEntityGetEntity { - x.Success = value - return x -} - -func (x *respGetEntityGetEntity) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respGetEntityGetEntity) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Success - if err := item.Write(p); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetEntity) readField0(p thrift.Decoder) error { // Success - result := NewGetEntityResponse() -err := result.Read(p) -if err != nil { - return err -} - - x.Success = result - return nil -} - -func (x *respGetEntityGetEntity) toString0() string { // Success - return fmt.Sprintf("%v", x.Success) -} - -// Deprecated: Use newRespGetEntityGetEntity().GetSuccess() instead. -func (x *respGetEntityGetEntity) DefaultGetSuccess() *GetEntityResponse { - if !x.IsSetSuccess() { - return NewGetEntityResponse() - } - return x.Success -} - - - -func (x *respGetEntityGetEntity) Exception() thrift.WritableException { - return nil -} - -func (x *respGetEntityGetEntity) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respGetEntityGetEntity"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetEntity) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.STRUCT)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respGetEntityGetEntity) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respGetEntityGetEntity({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respGetEntityGetEntity) setDefaults() *respGetEntityGetEntity { - return x -} - -type reqGetEntityGetBool struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqGetEntityGetBool)(nil) - -// Deprecated: GetEntityGetBoolArgsDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetBoolArgsDeprecated = reqGetEntityGetBool - -func newReqGetEntityGetBool() *reqGetEntityGetBool { - return (&reqGetEntityGetBool{}).setDefaults() -} - - - -func (x *reqGetEntityGetBool) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqGetEntityGetBool"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetBool) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqGetEntityGetBool) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqGetEntityGetBool({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqGetEntityGetBool) setDefaults() *reqGetEntityGetBool { - return x -} - -type respGetEntityGetBool struct { - Success *bool `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respGetEntityGetBool)(nil) -var _ thrift.WritableResult = (*respGetEntityGetBool)(nil) - -// Deprecated: GetEntityGetBoolResultDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetBoolResultDeprecated = respGetEntityGetBool - -func newRespGetEntityGetBool() *respGetEntityGetBool { - return (&respGetEntityGetBool{}).setDefaults() -} - -func (x *respGetEntityGetBool) GetSuccess() bool { - if !x.IsSetSuccess() { - return false - } - return *x.Success -} - -func (x *respGetEntityGetBool) SetSuccessNonCompat(value bool) *respGetEntityGetBool { - x.Success = &value - return x -} - -func (x *respGetEntityGetBool) SetSuccess(value *bool) *respGetEntityGetBool { - x.Success = value - return x -} - -func (x *respGetEntityGetBool) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respGetEntityGetBool) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.BOOL, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteBool(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetBool) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadBool() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respGetEntityGetBool) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respGetEntityGetBool) Exception() thrift.WritableException { - return nil -} - -func (x *respGetEntityGetBool) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respGetEntityGetBool"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetBool) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.BOOL)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respGetEntityGetBool) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respGetEntityGetBool({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respGetEntityGetBool) setDefaults() *respGetEntityGetBool { - return x -} - -type reqGetEntityGetByte struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqGetEntityGetByte)(nil) - -// Deprecated: GetEntityGetByteArgsDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetByteArgsDeprecated = reqGetEntityGetByte - -func newReqGetEntityGetByte() *reqGetEntityGetByte { - return (&reqGetEntityGetByte{}).setDefaults() -} - - - -func (x *reqGetEntityGetByte) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqGetEntityGetByte"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetByte) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqGetEntityGetByte) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqGetEntityGetByte({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqGetEntityGetByte) setDefaults() *reqGetEntityGetByte { - return x -} - -type respGetEntityGetByte struct { - Success *int8 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respGetEntityGetByte)(nil) -var _ thrift.WritableResult = (*respGetEntityGetByte)(nil) - -// Deprecated: GetEntityGetByteResultDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetByteResultDeprecated = respGetEntityGetByte - -func newRespGetEntityGetByte() *respGetEntityGetByte { - return (&respGetEntityGetByte{}).setDefaults() -} - -func (x *respGetEntityGetByte) GetSuccess() int8 { - if !x.IsSetSuccess() { - return 0 - } - return *x.Success -} - -func (x *respGetEntityGetByte) SetSuccessNonCompat(value int8) *respGetEntityGetByte { - x.Success = &value - return x -} - -func (x *respGetEntityGetByte) SetSuccess(value *int8) *respGetEntityGetByte { - x.Success = value - return x -} - -func (x *respGetEntityGetByte) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respGetEntityGetByte) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.BYTE, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteByte(byte(item)); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetByte) readField0(p thrift.Decoder) error { // Success - resultByte, err := p.ReadByte() -result := int8(resultByte) -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respGetEntityGetByte) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respGetEntityGetByte) Exception() thrift.WritableException { - return nil -} - -func (x *respGetEntityGetByte) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respGetEntityGetByte"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetByte) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.BYTE)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respGetEntityGetByte) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respGetEntityGetByte({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respGetEntityGetByte) setDefaults() *respGetEntityGetByte { - return x -} - -type reqGetEntityGetI16 struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqGetEntityGetI16)(nil) - -// Deprecated: GetEntityGetI16ArgsDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetI16ArgsDeprecated = reqGetEntityGetI16 - -func newReqGetEntityGetI16() *reqGetEntityGetI16 { - return (&reqGetEntityGetI16{}).setDefaults() -} - - - -func (x *reqGetEntityGetI16) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqGetEntityGetI16"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetI16) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqGetEntityGetI16) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqGetEntityGetI16({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqGetEntityGetI16) setDefaults() *reqGetEntityGetI16 { - return x -} - -type respGetEntityGetI16 struct { - Success *int16 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respGetEntityGetI16)(nil) -var _ thrift.WritableResult = (*respGetEntityGetI16)(nil) - -// Deprecated: GetEntityGetI16ResultDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetI16ResultDeprecated = respGetEntityGetI16 - -func newRespGetEntityGetI16() *respGetEntityGetI16 { - return (&respGetEntityGetI16{}).setDefaults() -} - -func (x *respGetEntityGetI16) GetSuccess() int16 { - if !x.IsSetSuccess() { - return 0 - } - return *x.Success -} - -func (x *respGetEntityGetI16) SetSuccessNonCompat(value int16) *respGetEntityGetI16 { - x.Success = &value - return x -} - -func (x *respGetEntityGetI16) SetSuccess(value *int16) *respGetEntityGetI16 { - x.Success = value - return x -} - -func (x *respGetEntityGetI16) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respGetEntityGetI16) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.I16, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteI16(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetI16) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadI16() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respGetEntityGetI16) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respGetEntityGetI16) Exception() thrift.WritableException { - return nil -} - -func (x *respGetEntityGetI16) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respGetEntityGetI16"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetI16) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.I16)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respGetEntityGetI16) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respGetEntityGetI16({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respGetEntityGetI16) setDefaults() *respGetEntityGetI16 { - return x -} - -type reqGetEntityGetI32 struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqGetEntityGetI32)(nil) - -// Deprecated: GetEntityGetI32ArgsDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetI32ArgsDeprecated = reqGetEntityGetI32 - -func newReqGetEntityGetI32() *reqGetEntityGetI32 { - return (&reqGetEntityGetI32{}).setDefaults() -} - - - -func (x *reqGetEntityGetI32) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqGetEntityGetI32"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetI32) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqGetEntityGetI32) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqGetEntityGetI32({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqGetEntityGetI32) setDefaults() *reqGetEntityGetI32 { - return x -} - -type respGetEntityGetI32 struct { - Success *int32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respGetEntityGetI32)(nil) -var _ thrift.WritableResult = (*respGetEntityGetI32)(nil) - -// Deprecated: GetEntityGetI32ResultDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetI32ResultDeprecated = respGetEntityGetI32 - -func newRespGetEntityGetI32() *respGetEntityGetI32 { - return (&respGetEntityGetI32{}).setDefaults() -} - -func (x *respGetEntityGetI32) GetSuccess() int32 { - if !x.IsSetSuccess() { - return 0 - } - return *x.Success -} - -func (x *respGetEntityGetI32) SetSuccessNonCompat(value int32) *respGetEntityGetI32 { - x.Success = &value - return x -} - -func (x *respGetEntityGetI32) SetSuccess(value *int32) *respGetEntityGetI32 { - x.Success = value - return x -} - -func (x *respGetEntityGetI32) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respGetEntityGetI32) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteI32(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetI32) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadI32() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respGetEntityGetI32) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respGetEntityGetI32) Exception() thrift.WritableException { - return nil -} - -func (x *respGetEntityGetI32) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respGetEntityGetI32"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetI32) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.I32)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respGetEntityGetI32) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respGetEntityGetI32({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respGetEntityGetI32) setDefaults() *respGetEntityGetI32 { - return x -} - -type reqGetEntityGetI64 struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqGetEntityGetI64)(nil) - -// Deprecated: GetEntityGetI64ArgsDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetI64ArgsDeprecated = reqGetEntityGetI64 - -func newReqGetEntityGetI64() *reqGetEntityGetI64 { - return (&reqGetEntityGetI64{}).setDefaults() -} - - - -func (x *reqGetEntityGetI64) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqGetEntityGetI64"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetI64) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqGetEntityGetI64) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqGetEntityGetI64({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqGetEntityGetI64) setDefaults() *reqGetEntityGetI64 { - return x -} - -type respGetEntityGetI64 struct { - Success *int64 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respGetEntityGetI64)(nil) -var _ thrift.WritableResult = (*respGetEntityGetI64)(nil) - -// Deprecated: GetEntityGetI64ResultDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetI64ResultDeprecated = respGetEntityGetI64 - -func newRespGetEntityGetI64() *respGetEntityGetI64 { - return (&respGetEntityGetI64{}).setDefaults() -} - -func (x *respGetEntityGetI64) GetSuccess() int64 { - if !x.IsSetSuccess() { - return 0 - } - return *x.Success -} - -func (x *respGetEntityGetI64) SetSuccessNonCompat(value int64) *respGetEntityGetI64 { - x.Success = &value - return x -} - -func (x *respGetEntityGetI64) SetSuccess(value *int64) *respGetEntityGetI64 { - x.Success = value - return x -} - -func (x *respGetEntityGetI64) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respGetEntityGetI64) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.I64, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetI64) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respGetEntityGetI64) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respGetEntityGetI64) Exception() thrift.WritableException { - return nil -} - -func (x *respGetEntityGetI64) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respGetEntityGetI64"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetI64) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.I64)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respGetEntityGetI64) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respGetEntityGetI64({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respGetEntityGetI64) setDefaults() *respGetEntityGetI64 { - return x -} - -type reqGetEntityGetDouble struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqGetEntityGetDouble)(nil) - -// Deprecated: GetEntityGetDoubleArgsDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetDoubleArgsDeprecated = reqGetEntityGetDouble - -func newReqGetEntityGetDouble() *reqGetEntityGetDouble { - return (&reqGetEntityGetDouble{}).setDefaults() -} - - - -func (x *reqGetEntityGetDouble) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqGetEntityGetDouble"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetDouble) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqGetEntityGetDouble) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqGetEntityGetDouble({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqGetEntityGetDouble) setDefaults() *reqGetEntityGetDouble { - return x -} - -type respGetEntityGetDouble struct { - Success *float64 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respGetEntityGetDouble)(nil) -var _ thrift.WritableResult = (*respGetEntityGetDouble)(nil) - -// Deprecated: GetEntityGetDoubleResultDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetDoubleResultDeprecated = respGetEntityGetDouble - -func newRespGetEntityGetDouble() *respGetEntityGetDouble { - return (&respGetEntityGetDouble{}).setDefaults() -} - -func (x *respGetEntityGetDouble) GetSuccess() float64 { - if !x.IsSetSuccess() { - return 0.0 - } - return *x.Success -} - -func (x *respGetEntityGetDouble) SetSuccessNonCompat(value float64) *respGetEntityGetDouble { - x.Success = &value - return x -} - -func (x *respGetEntityGetDouble) SetSuccess(value *float64) *respGetEntityGetDouble { - x.Success = value - return x -} - -func (x *respGetEntityGetDouble) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respGetEntityGetDouble) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.DOUBLE, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteDouble(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetDouble) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadDouble() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respGetEntityGetDouble) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respGetEntityGetDouble) Exception() thrift.WritableException { - return nil -} - -func (x *respGetEntityGetDouble) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respGetEntityGetDouble"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetDouble) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.DOUBLE)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respGetEntityGetDouble) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respGetEntityGetDouble({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respGetEntityGetDouble) setDefaults() *respGetEntityGetDouble { - return x -} - -type reqGetEntityGetString struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqGetEntityGetString)(nil) - -// Deprecated: GetEntityGetStringArgsDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetStringArgsDeprecated = reqGetEntityGetString - -func newReqGetEntityGetString() *reqGetEntityGetString { - return (&reqGetEntityGetString{}).setDefaults() -} - - - -func (x *reqGetEntityGetString) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqGetEntityGetString"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetString) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqGetEntityGetString) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqGetEntityGetString({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqGetEntityGetString) setDefaults() *reqGetEntityGetString { - return x -} - -type respGetEntityGetString struct { - Success *string `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respGetEntityGetString)(nil) -var _ thrift.WritableResult = (*respGetEntityGetString)(nil) - -// Deprecated: GetEntityGetStringResultDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetStringResultDeprecated = respGetEntityGetString - -func newRespGetEntityGetString() *respGetEntityGetString { - return (&respGetEntityGetString{}).setDefaults() -} - -func (x *respGetEntityGetString) GetSuccess() string { - if !x.IsSetSuccess() { - return "" - } - return *x.Success -} - -func (x *respGetEntityGetString) SetSuccessNonCompat(value string) *respGetEntityGetString { - x.Success = &value - return x -} - -func (x *respGetEntityGetString) SetSuccess(value *string) *respGetEntityGetString { - x.Success = value - return x -} - -func (x *respGetEntityGetString) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respGetEntityGetString) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.STRING, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteString(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetString) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadString() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respGetEntityGetString) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respGetEntityGetString) Exception() thrift.WritableException { - return nil -} - -func (x *respGetEntityGetString) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respGetEntityGetString"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetString) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.STRING)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respGetEntityGetString) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respGetEntityGetString({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respGetEntityGetString) setDefaults() *respGetEntityGetString { - return x -} - -type reqGetEntityGetBinary struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqGetEntityGetBinary)(nil) - -// Deprecated: GetEntityGetBinaryArgsDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetBinaryArgsDeprecated = reqGetEntityGetBinary - -func newReqGetEntityGetBinary() *reqGetEntityGetBinary { - return (&reqGetEntityGetBinary{}).setDefaults() -} - - - -func (x *reqGetEntityGetBinary) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqGetEntityGetBinary"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetBinary) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqGetEntityGetBinary) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqGetEntityGetBinary({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqGetEntityGetBinary) setDefaults() *reqGetEntityGetBinary { - return x -} - -type respGetEntityGetBinary struct { - Success []byte `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respGetEntityGetBinary)(nil) -var _ thrift.WritableResult = (*respGetEntityGetBinary)(nil) - -// Deprecated: GetEntityGetBinaryResultDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetBinaryResultDeprecated = respGetEntityGetBinary - -func newRespGetEntityGetBinary() *respGetEntityGetBinary { - return (&respGetEntityGetBinary{}).setDefaults() -} - -func (x *respGetEntityGetBinary) GetSuccess() []byte { - if !x.IsSetSuccess() { - return []byte("") - } - return x.Success -} - -func (x *respGetEntityGetBinary) SetSuccessNonCompat(value []byte) *respGetEntityGetBinary { - x.Success = value - return x -} - -func (x *respGetEntityGetBinary) SetSuccess(value []byte) *respGetEntityGetBinary { - x.Success = value - return x -} - -func (x *respGetEntityGetBinary) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respGetEntityGetBinary) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.STRING, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Success - if err := p.WriteBinary(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetBinary) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadBinary() -if err != nil { - return err -} - - x.Success = result - return nil -} - -func (x *respGetEntityGetBinary) toString0() string { // Success - return fmt.Sprintf("%v", x.Success) -} - - - -func (x *respGetEntityGetBinary) Exception() thrift.WritableException { - return nil -} - -func (x *respGetEntityGetBinary) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respGetEntityGetBinary"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetBinary) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.STRING)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respGetEntityGetBinary) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respGetEntityGetBinary({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respGetEntityGetBinary) setDefaults() *respGetEntityGetBinary { - return x -} - -type reqGetEntityGetMap struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqGetEntityGetMap)(nil) - -// Deprecated: GetEntityGetMapArgsDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetMapArgsDeprecated = reqGetEntityGetMap - -func newReqGetEntityGetMap() *reqGetEntityGetMap { - return (&reqGetEntityGetMap{}).setDefaults() -} - - - -func (x *reqGetEntityGetMap) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqGetEntityGetMap"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetMap) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqGetEntityGetMap) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqGetEntityGetMap({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqGetEntityGetMap) setDefaults() *reqGetEntityGetMap { - return x -} - -type respGetEntityGetMap struct { - Success map[string]string `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respGetEntityGetMap)(nil) -var _ thrift.WritableResult = (*respGetEntityGetMap)(nil) - -// Deprecated: GetEntityGetMapResultDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetMapResultDeprecated = respGetEntityGetMap - -func newRespGetEntityGetMap() *respGetEntityGetMap { - return (&respGetEntityGetMap{}).setDefaults() -} - -func (x *respGetEntityGetMap) GetSuccess() map[string]string { - if !x.IsSetSuccess() { - return make(map[string]string) - } - return x.Success -} - -func (x *respGetEntityGetMap) SetSuccessNonCompat(value map[string]string) *respGetEntityGetMap { - x.Success = value - return x -} - -func (x *respGetEntityGetMap) SetSuccess(value map[string]string) *respGetEntityGetMap { - x.Success = value - return x -} - -func (x *respGetEntityGetMap) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respGetEntityGetMap) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.MAP, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Success - if err := p.WriteMapBegin(thrift.STRING, thrift.STRING, len(item)); err != nil { - return thrift.PrependError("error writing map begin: ", err) -} -for k, v := range item { - { - item := k - if err := p.WriteString(item); err != nil { - return err -} - } - - { - item := v - if err := p.WriteString(item); err != nil { - return err -} - } -} -if err := p.WriteMapEnd(); err != nil { - return thrift.PrependError("error writing map end: ", err) -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetMap) readField0(p thrift.Decoder) error { // Success - _ /* keyType */, _ /* valueType */, size, err := p.ReadMapBegin() -if err != nil { - return thrift.PrependError("error reading map begin: ", err) -} - -mapResult := make(map[string]string, size) -for i := 0; i < size; i++ { - var key string - { - result, err := p.ReadString() -if err != nil { - return err -} - key = result - } - - var value string - { - result, err := p.ReadString() -if err != nil { - return err -} - value = result - } - - mapResult[key] = value -} - -if err := p.ReadMapEnd(); err != nil { - return thrift.PrependError("error reading map end: ", err) -} -result := mapResult - - x.Success = result - return nil -} - -func (x *respGetEntityGetMap) toString0() string { // Success - return fmt.Sprintf("%v", x.Success) -} - - - -func (x *respGetEntityGetMap) Exception() thrift.WritableException { - return nil -} - -func (x *respGetEntityGetMap) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respGetEntityGetMap"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetMap) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.MAP)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respGetEntityGetMap) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respGetEntityGetMap({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respGetEntityGetMap) setDefaults() *respGetEntityGetMap { - return x -} - -type reqGetEntityGetSet struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqGetEntityGetSet)(nil) - -// Deprecated: GetEntityGetSetArgsDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetSetArgsDeprecated = reqGetEntityGetSet - -func newReqGetEntityGetSet() *reqGetEntityGetSet { - return (&reqGetEntityGetSet{}).setDefaults() -} - - - -func (x *reqGetEntityGetSet) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqGetEntityGetSet"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetSet) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqGetEntityGetSet) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqGetEntityGetSet({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqGetEntityGetSet) setDefaults() *reqGetEntityGetSet { - return x -} - -type respGetEntityGetSet struct { - Success []string `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respGetEntityGetSet)(nil) -var _ thrift.WritableResult = (*respGetEntityGetSet)(nil) - -// Deprecated: GetEntityGetSetResultDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetSetResultDeprecated = respGetEntityGetSet - -func newRespGetEntityGetSet() *respGetEntityGetSet { - return (&respGetEntityGetSet{}).setDefaults() -} - -func (x *respGetEntityGetSet) GetSuccess() []string { - if !x.IsSetSuccess() { - return make([]string, 0) - } - return x.Success -} - -func (x *respGetEntityGetSet) SetSuccessNonCompat(value []string) *respGetEntityGetSet { - x.Success = value - return x -} - -func (x *respGetEntityGetSet) SetSuccess(value []string) *respGetEntityGetSet { - x.Success = value - return x -} - -func (x *respGetEntityGetSet) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respGetEntityGetSet) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.SET, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Success - if err := p.WriteSetBegin(thrift.STRING, len(item)); err != nil { - return thrift.PrependError("error writing set begin: ", err) -} -for _, v := range item { - { - item := v - if err := p.WriteString(item); err != nil { - return err -} - } -} -if err := p.WriteSetEnd(); err != nil { - return thrift.PrependError("error writing set end: ", err) -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetSet) readField0(p thrift.Decoder) error { // Success - _ /* elemType */, size, err := p.ReadSetBegin() -if err != nil { - return thrift.PrependError("error reading set begin: ", err) -} - -setResult := make([]string, 0, size) -for i := 0; i < size; i++ { - var elem string - { - result, err := p.ReadString() -if err != nil { - return err -} - elem = result - } - setResult = append(setResult, elem) -} - -if err := p.ReadSetEnd(); err != nil { - return thrift.PrependError("error reading set end: ", err) -} -result := setResult - - x.Success = result - return nil -} - -func (x *respGetEntityGetSet) toString0() string { // Success - return fmt.Sprintf("%v", x.Success) -} - - - -func (x *respGetEntityGetSet) Exception() thrift.WritableException { - return nil -} - -func (x *respGetEntityGetSet) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respGetEntityGetSet"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetSet) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.SET)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respGetEntityGetSet) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respGetEntityGetSet({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respGetEntityGetSet) setDefaults() *respGetEntityGetSet { - return x -} - -type reqGetEntityGetList struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqGetEntityGetList)(nil) - -// Deprecated: GetEntityGetListArgsDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetListArgsDeprecated = reqGetEntityGetList - -func newReqGetEntityGetList() *reqGetEntityGetList { - return (&reqGetEntityGetList{}).setDefaults() -} - - - -func (x *reqGetEntityGetList) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqGetEntityGetList"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetList) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqGetEntityGetList) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqGetEntityGetList({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqGetEntityGetList) setDefaults() *reqGetEntityGetList { - return x -} - -type respGetEntityGetList struct { - Success []string `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respGetEntityGetList)(nil) -var _ thrift.WritableResult = (*respGetEntityGetList)(nil) - -// Deprecated: GetEntityGetListResultDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetListResultDeprecated = respGetEntityGetList - -func newRespGetEntityGetList() *respGetEntityGetList { - return (&respGetEntityGetList{}).setDefaults() -} - -func (x *respGetEntityGetList) GetSuccess() []string { - if !x.IsSetSuccess() { - return make([]string, 0) - } - return x.Success -} - -func (x *respGetEntityGetList) SetSuccessNonCompat(value []string) *respGetEntityGetList { - x.Success = value - return x -} - -func (x *respGetEntityGetList) SetSuccess(value []string) *respGetEntityGetList { - x.Success = value - return x -} - -func (x *respGetEntityGetList) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respGetEntityGetList) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.LIST, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Success - if err := p.WriteListBegin(thrift.STRING, len(item)); err != nil { - return thrift.PrependError("error writing list begin: ", err) -} -for _, v := range item { - { - item := v - if err := p.WriteString(item); err != nil { - return err -} - } -} -if err := p.WriteListEnd(); err != nil { - return thrift.PrependError("error writing list end: ", err) -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetList) readField0(p thrift.Decoder) error { // Success - _ /* elemType */, size, err := p.ReadListBegin() -if err != nil { - return thrift.PrependError("error reading list begin: ", err) -} - -listResult := make([]string, 0, size) -for i := 0; i < size; i++ { - var elem string - { - result, err := p.ReadString() -if err != nil { - return err -} - elem = result - } - listResult = append(listResult, elem) -} - -if err := p.ReadListEnd(); err != nil { - return thrift.PrependError("error reading list end: ", err) -} -result := listResult - - x.Success = result - return nil -} - -func (x *respGetEntityGetList) toString0() string { // Success - return fmt.Sprintf("%v", x.Success) -} - - - -func (x *respGetEntityGetList) Exception() thrift.WritableException { - return nil -} - -func (x *respGetEntityGetList) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respGetEntityGetList"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetList) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.LIST)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respGetEntityGetList) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respGetEntityGetList({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respGetEntityGetList) setDefaults() *respGetEntityGetList { - return x -} - -type reqGetEntityGetLegacyStuff struct { - NumNeg2 int64 `thrift:"numNeg2,-2" json:"numNeg2" db:"numNeg2"` - NumNeg1 int64 `thrift:"numNeg1,-1" json:"numNeg1" db:"numNeg1"` - NumPos int64 `thrift:"numPos,1" json:"numPos" db:"numPos"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqGetEntityGetLegacyStuff)(nil) - -// Deprecated: GetEntityGetLegacyStuffArgsDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetLegacyStuffArgsDeprecated = reqGetEntityGetLegacyStuff - -func newReqGetEntityGetLegacyStuff() *reqGetEntityGetLegacyStuff { - return (&reqGetEntityGetLegacyStuff{}).setDefaults() -} - -func (x *reqGetEntityGetLegacyStuff) GetNumNeg2() int64 { - return x.NumNeg2 -} - -func (x *reqGetEntityGetLegacyStuff) GetNumNeg1() int64 { - return x.NumNeg1 -} - -func (x *reqGetEntityGetLegacyStuff) GetNumPos() int64 { - return x.NumPos -} - -func (x *reqGetEntityGetLegacyStuff) SetNumNeg2NonCompat(value int64) *reqGetEntityGetLegacyStuff { - x.NumNeg2 = value - return x -} - -func (x *reqGetEntityGetLegacyStuff) SetNumNeg2(value int64) *reqGetEntityGetLegacyStuff { - x.NumNeg2 = value - return x -} - -func (x *reqGetEntityGetLegacyStuff) SetNumNeg1NonCompat(value int64) *reqGetEntityGetLegacyStuff { - x.NumNeg1 = value - return x -} - -func (x *reqGetEntityGetLegacyStuff) SetNumNeg1(value int64) *reqGetEntityGetLegacyStuff { - x.NumNeg1 = value - return x -} - -func (x *reqGetEntityGetLegacyStuff) SetNumPosNonCompat(value int64) *reqGetEntityGetLegacyStuff { - x.NumPos = value - return x -} - -func (x *reqGetEntityGetLegacyStuff) SetNumPos(value int64) *reqGetEntityGetLegacyStuff { - x.NumPos = value - return x -} - -func (x *reqGetEntityGetLegacyStuff) writeField_2(p thrift.Encoder) error { // NumNeg2 - if err := p.WriteFieldBegin("numNeg2", thrift.I64, -2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.NumNeg2 - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetLegacyStuff) writeField_1(p thrift.Encoder) error { // NumNeg1 - if err := p.WriteFieldBegin("numNeg1", thrift.I64, -1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.NumNeg1 - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetLegacyStuff) writeField1(p thrift.Encoder) error { // NumPos - if err := p.WriteFieldBegin("numPos", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.NumPos - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetLegacyStuff) readField_2(p thrift.Decoder) error { // NumNeg2 - result, err := p.ReadI64() -if err != nil { - return err -} - - x.NumNeg2 = result - return nil -} - -func (x *reqGetEntityGetLegacyStuff) readField_1(p thrift.Decoder) error { // NumNeg1 - result, err := p.ReadI64() -if err != nil { - return err -} - - x.NumNeg1 = result - return nil -} - -func (x *reqGetEntityGetLegacyStuff) readField1(p thrift.Decoder) error { // NumPos - result, err := p.ReadI64() -if err != nil { - return err -} - - x.NumPos = result - return nil -} - -func (x *reqGetEntityGetLegacyStuff) toString_2() string { // NumNeg2 - return fmt.Sprintf("%v", x.NumNeg2) -} - -func (x *reqGetEntityGetLegacyStuff) toString_1() string { // NumNeg1 - return fmt.Sprintf("%v", x.NumNeg1) -} - -func (x *reqGetEntityGetLegacyStuff) toString1() string { // NumPos - return fmt.Sprintf("%v", x.NumPos) -} - - - -func (x *reqGetEntityGetLegacyStuff) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqGetEntityGetLegacyStuff"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField_2(p); err != nil { - return err - } - if err := x.writeField_1(p); err != nil { - return err - } - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetLegacyStuff) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == -2 && wireType == thrift.Type(thrift.I64)): // numNeg2 - fieldReadErr = x.readField_2(p) - case (id == -1 && wireType == thrift.Type(thrift.I64)): // numNeg1 - fieldReadErr = x.readField_1(p) - case (id == 1 && wireType == thrift.Type(thrift.I64)): // numPos - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqGetEntityGetLegacyStuff) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqGetEntityGetLegacyStuff({") - sb.WriteString(fmt.Sprintf("NumNeg2:%s ", x.toString_2())) - sb.WriteString(fmt.Sprintf("NumNeg1:%s ", x.toString_1())) - sb.WriteString(fmt.Sprintf("NumPos:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqGetEntityGetLegacyStuff) setDefaults() *reqGetEntityGetLegacyStuff { - return x. - SetNumNeg2NonCompat(0). - SetNumNeg1NonCompat(0). - SetNumPosNonCompat(0) -} - -type respGetEntityGetLegacyStuff struct { - Success *int32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respGetEntityGetLegacyStuff)(nil) -var _ thrift.WritableResult = (*respGetEntityGetLegacyStuff)(nil) - -// Deprecated: GetEntityGetLegacyStuffResultDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetLegacyStuffResultDeprecated = respGetEntityGetLegacyStuff - -func newRespGetEntityGetLegacyStuff() *respGetEntityGetLegacyStuff { - return (&respGetEntityGetLegacyStuff{}).setDefaults() -} - -func (x *respGetEntityGetLegacyStuff) GetSuccess() int32 { - if !x.IsSetSuccess() { - return 0 - } - return *x.Success -} - -func (x *respGetEntityGetLegacyStuff) SetSuccessNonCompat(value int32) *respGetEntityGetLegacyStuff { - x.Success = &value - return x -} - -func (x *respGetEntityGetLegacyStuff) SetSuccess(value *int32) *respGetEntityGetLegacyStuff { - x.Success = value - return x -} - -func (x *respGetEntityGetLegacyStuff) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respGetEntityGetLegacyStuff) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteI32(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetLegacyStuff) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadI32() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respGetEntityGetLegacyStuff) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respGetEntityGetLegacyStuff) Exception() thrift.WritableException { - return nil -} - -func (x *respGetEntityGetLegacyStuff) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respGetEntityGetLegacyStuff"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetLegacyStuff) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.I32)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respGetEntityGetLegacyStuff) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respGetEntityGetLegacyStuff({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respGetEntityGetLegacyStuff) setDefaults() *respGetEntityGetLegacyStuff { - return x -} - -type reqGetEntityGetCtxCollision struct { - Ctx int64 `thrift:"ctx,1" json:"ctx" db:"ctx"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqGetEntityGetCtxCollision)(nil) - -// Deprecated: GetEntityGetCtxCollisionArgsDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetCtxCollisionArgsDeprecated = reqGetEntityGetCtxCollision - -func newReqGetEntityGetCtxCollision() *reqGetEntityGetCtxCollision { - return (&reqGetEntityGetCtxCollision{}).setDefaults() -} - -func (x *reqGetEntityGetCtxCollision) GetCtx() int64 { - return x.Ctx -} - -func (x *reqGetEntityGetCtxCollision) SetCtxNonCompat(value int64) *reqGetEntityGetCtxCollision { - x.Ctx = value - return x -} - -func (x *reqGetEntityGetCtxCollision) SetCtx(value int64) *reqGetEntityGetCtxCollision { - x.Ctx = value - return x -} - -func (x *reqGetEntityGetCtxCollision) writeField1(p thrift.Encoder) error { // Ctx - if err := p.WriteFieldBegin("ctx", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Ctx - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetCtxCollision) readField1(p thrift.Decoder) error { // Ctx - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Ctx = result - return nil -} - -func (x *reqGetEntityGetCtxCollision) toString1() string { // Ctx - return fmt.Sprintf("%v", x.Ctx) -} - - - -func (x *reqGetEntityGetCtxCollision) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqGetEntityGetCtxCollision"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetCtxCollision) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // ctx - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqGetEntityGetCtxCollision) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqGetEntityGetCtxCollision({") - sb.WriteString(fmt.Sprintf("Ctx:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqGetEntityGetCtxCollision) setDefaults() *reqGetEntityGetCtxCollision { - return x. - SetCtxNonCompat(0) -} - -type respGetEntityGetCtxCollision struct { - Success *int32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respGetEntityGetCtxCollision)(nil) -var _ thrift.WritableResult = (*respGetEntityGetCtxCollision)(nil) - -// Deprecated: GetEntityGetCtxCollisionResultDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetCtxCollisionResultDeprecated = respGetEntityGetCtxCollision - -func newRespGetEntityGetCtxCollision() *respGetEntityGetCtxCollision { - return (&respGetEntityGetCtxCollision{}).setDefaults() -} - -func (x *respGetEntityGetCtxCollision) GetSuccess() int32 { - if !x.IsSetSuccess() { - return 0 - } - return *x.Success -} - -func (x *respGetEntityGetCtxCollision) SetSuccessNonCompat(value int32) *respGetEntityGetCtxCollision { - x.Success = &value - return x -} - -func (x *respGetEntityGetCtxCollision) SetSuccess(value *int32) *respGetEntityGetCtxCollision { - x.Success = value - return x -} - -func (x *respGetEntityGetCtxCollision) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respGetEntityGetCtxCollision) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteI32(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetCtxCollision) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadI32() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respGetEntityGetCtxCollision) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respGetEntityGetCtxCollision) Exception() thrift.WritableException { - return nil -} - -func (x *respGetEntityGetCtxCollision) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respGetEntityGetCtxCollision"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetCtxCollision) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.I32)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respGetEntityGetCtxCollision) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respGetEntityGetCtxCollision({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respGetEntityGetCtxCollision) setDefaults() *respGetEntityGetCtxCollision { - return x -} - -type reqGetEntityGetCtx1Collision struct { - Ctx int64 `thrift:"ctx,1" json:"ctx" db:"ctx"` - Ctx1 int64 `thrift:"ctx1,2" json:"ctx1" db:"ctx1"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqGetEntityGetCtx1Collision)(nil) - -// Deprecated: GetEntityGetCtx1CollisionArgsDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetCtx1CollisionArgsDeprecated = reqGetEntityGetCtx1Collision - -func newReqGetEntityGetCtx1Collision() *reqGetEntityGetCtx1Collision { - return (&reqGetEntityGetCtx1Collision{}).setDefaults() -} - -func (x *reqGetEntityGetCtx1Collision) GetCtx() int64 { - return x.Ctx -} - -func (x *reqGetEntityGetCtx1Collision) GetCtx1() int64 { - return x.Ctx1 -} - -func (x *reqGetEntityGetCtx1Collision) SetCtxNonCompat(value int64) *reqGetEntityGetCtx1Collision { - x.Ctx = value - return x -} - -func (x *reqGetEntityGetCtx1Collision) SetCtx(value int64) *reqGetEntityGetCtx1Collision { - x.Ctx = value - return x -} - -func (x *reqGetEntityGetCtx1Collision) SetCtx1NonCompat(value int64) *reqGetEntityGetCtx1Collision { - x.Ctx1 = value - return x -} - -func (x *reqGetEntityGetCtx1Collision) SetCtx1(value int64) *reqGetEntityGetCtx1Collision { - x.Ctx1 = value - return x -} - -func (x *reqGetEntityGetCtx1Collision) writeField1(p thrift.Encoder) error { // Ctx - if err := p.WriteFieldBegin("ctx", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Ctx - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetCtx1Collision) writeField2(p thrift.Encoder) error { // Ctx1 - if err := p.WriteFieldBegin("ctx1", thrift.I64, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Ctx1 - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetCtx1Collision) readField1(p thrift.Decoder) error { // Ctx - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Ctx = result - return nil -} - -func (x *reqGetEntityGetCtx1Collision) readField2(p thrift.Decoder) error { // Ctx1 - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Ctx1 = result - return nil -} - -func (x *reqGetEntityGetCtx1Collision) toString1() string { // Ctx - return fmt.Sprintf("%v", x.Ctx) -} - -func (x *reqGetEntityGetCtx1Collision) toString2() string { // Ctx1 - return fmt.Sprintf("%v", x.Ctx1) -} - - - -func (x *reqGetEntityGetCtx1Collision) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqGetEntityGetCtx1Collision"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - if err := x.writeField2(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetCtx1Collision) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // ctx - fieldReadErr = x.readField1(p) - case (id == 2 && wireType == thrift.Type(thrift.I64)): // ctx1 - fieldReadErr = x.readField2(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqGetEntityGetCtx1Collision) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqGetEntityGetCtx1Collision({") - sb.WriteString(fmt.Sprintf("Ctx:%s ", x.toString1())) - sb.WriteString(fmt.Sprintf("Ctx1:%s", x.toString2())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqGetEntityGetCtx1Collision) setDefaults() *reqGetEntityGetCtx1Collision { - return x. - SetCtxNonCompat(0). - SetCtx1NonCompat(0) -} - -type respGetEntityGetCtx1Collision struct { - Success *int32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respGetEntityGetCtx1Collision)(nil) -var _ thrift.WritableResult = (*respGetEntityGetCtx1Collision)(nil) - -// Deprecated: GetEntityGetCtx1CollisionResultDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetCtx1CollisionResultDeprecated = respGetEntityGetCtx1Collision - -func newRespGetEntityGetCtx1Collision() *respGetEntityGetCtx1Collision { - return (&respGetEntityGetCtx1Collision{}).setDefaults() -} - -func (x *respGetEntityGetCtx1Collision) GetSuccess() int32 { - if !x.IsSetSuccess() { - return 0 - } - return *x.Success -} - -func (x *respGetEntityGetCtx1Collision) SetSuccessNonCompat(value int32) *respGetEntityGetCtx1Collision { - x.Success = &value - return x -} - -func (x *respGetEntityGetCtx1Collision) SetSuccess(value *int32) *respGetEntityGetCtx1Collision { - x.Success = value - return x -} - -func (x *respGetEntityGetCtx1Collision) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respGetEntityGetCtx1Collision) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteI32(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetCtx1Collision) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadI32() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respGetEntityGetCtx1Collision) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respGetEntityGetCtx1Collision) Exception() thrift.WritableException { - return nil -} - -func (x *respGetEntityGetCtx1Collision) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respGetEntityGetCtx1Collision"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetCtx1Collision) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.I32)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respGetEntityGetCtx1Collision) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respGetEntityGetCtx1Collision({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respGetEntityGetCtx1Collision) setDefaults() *respGetEntityGetCtx1Collision { - return x -} - -type reqGetEntityGetContextCollision struct { - Context int64 `thrift:"context,1" json:"context" db:"context"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqGetEntityGetContextCollision)(nil) - -// Deprecated: GetEntityGetContextCollisionArgsDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetContextCollisionArgsDeprecated = reqGetEntityGetContextCollision - -func newReqGetEntityGetContextCollision() *reqGetEntityGetContextCollision { - return (&reqGetEntityGetContextCollision{}).setDefaults() -} - -func (x *reqGetEntityGetContextCollision) GetContext() int64 { - return x.Context -} - -func (x *reqGetEntityGetContextCollision) SetContextNonCompat(value int64) *reqGetEntityGetContextCollision { - x.Context = value - return x -} - -func (x *reqGetEntityGetContextCollision) SetContext(value int64) *reqGetEntityGetContextCollision { - x.Context = value - return x -} - -func (x *reqGetEntityGetContextCollision) writeField1(p thrift.Encoder) error { // Context - if err := p.WriteFieldBegin("context", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Context - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetContextCollision) readField1(p thrift.Decoder) error { // Context - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Context = result - return nil -} - -func (x *reqGetEntityGetContextCollision) toString1() string { // Context - return fmt.Sprintf("%v", x.Context) -} - - - -func (x *reqGetEntityGetContextCollision) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqGetEntityGetContextCollision"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetContextCollision) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // context - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqGetEntityGetContextCollision) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqGetEntityGetContextCollision({") - sb.WriteString(fmt.Sprintf("Context:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqGetEntityGetContextCollision) setDefaults() *reqGetEntityGetContextCollision { - return x. - SetContextNonCompat(0) -} - -type respGetEntityGetContextCollision struct { - Success *int32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respGetEntityGetContextCollision)(nil) -var _ thrift.WritableResult = (*respGetEntityGetContextCollision)(nil) - -// Deprecated: GetEntityGetContextCollisionResultDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetContextCollisionResultDeprecated = respGetEntityGetContextCollision - -func newRespGetEntityGetContextCollision() *respGetEntityGetContextCollision { - return (&respGetEntityGetContextCollision{}).setDefaults() -} - -func (x *respGetEntityGetContextCollision) GetSuccess() int32 { - if !x.IsSetSuccess() { - return 0 - } - return *x.Success -} - -func (x *respGetEntityGetContextCollision) SetSuccessNonCompat(value int32) *respGetEntityGetContextCollision { - x.Success = &value - return x -} - -func (x *respGetEntityGetContextCollision) SetSuccess(value *int32) *respGetEntityGetContextCollision { - x.Success = value - return x -} - -func (x *respGetEntityGetContextCollision) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respGetEntityGetContextCollision) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteI32(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetContextCollision) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadI32() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respGetEntityGetContextCollision) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respGetEntityGetContextCollision) Exception() thrift.WritableException { - return nil -} - -func (x *respGetEntityGetContextCollision) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respGetEntityGetContextCollision"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetContextCollision) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.I32)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respGetEntityGetContextCollision) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respGetEntityGetContextCollision({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respGetEntityGetContextCollision) setDefaults() *respGetEntityGetContextCollision { - return x -} - -type reqGetEntityGetOutCollision struct { - Out int64 `thrift:"out,1" json:"out" db:"out"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqGetEntityGetOutCollision)(nil) - -// Deprecated: GetEntityGetOutCollisionArgsDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetOutCollisionArgsDeprecated = reqGetEntityGetOutCollision - -func newReqGetEntityGetOutCollision() *reqGetEntityGetOutCollision { - return (&reqGetEntityGetOutCollision{}).setDefaults() -} - -func (x *reqGetEntityGetOutCollision) GetOut() int64 { - return x.Out -} - -func (x *reqGetEntityGetOutCollision) SetOutNonCompat(value int64) *reqGetEntityGetOutCollision { - x.Out = value - return x -} - -func (x *reqGetEntityGetOutCollision) SetOut(value int64) *reqGetEntityGetOutCollision { - x.Out = value - return x -} - -func (x *reqGetEntityGetOutCollision) writeField1(p thrift.Encoder) error { // Out - if err := p.WriteFieldBegin("out", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Out - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetOutCollision) readField1(p thrift.Decoder) error { // Out - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Out = result - return nil -} - -func (x *reqGetEntityGetOutCollision) toString1() string { // Out - return fmt.Sprintf("%v", x.Out) -} - - - -func (x *reqGetEntityGetOutCollision) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqGetEntityGetOutCollision"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetOutCollision) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // out - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqGetEntityGetOutCollision) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqGetEntityGetOutCollision({") - sb.WriteString(fmt.Sprintf("Out:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqGetEntityGetOutCollision) setDefaults() *reqGetEntityGetOutCollision { - return x. - SetOutNonCompat(0) -} - -type respGetEntityGetOutCollision struct { - Success *int32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respGetEntityGetOutCollision)(nil) -var _ thrift.WritableResult = (*respGetEntityGetOutCollision)(nil) - -// Deprecated: GetEntityGetOutCollisionResultDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetOutCollisionResultDeprecated = respGetEntityGetOutCollision - -func newRespGetEntityGetOutCollision() *respGetEntityGetOutCollision { - return (&respGetEntityGetOutCollision{}).setDefaults() -} - -func (x *respGetEntityGetOutCollision) GetSuccess() int32 { - if !x.IsSetSuccess() { - return 0 - } - return *x.Success -} - -func (x *respGetEntityGetOutCollision) SetSuccessNonCompat(value int32) *respGetEntityGetOutCollision { - x.Success = &value - return x -} - -func (x *respGetEntityGetOutCollision) SetSuccess(value *int32) *respGetEntityGetOutCollision { - x.Success = value - return x -} - -func (x *respGetEntityGetOutCollision) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respGetEntityGetOutCollision) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteI32(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetOutCollision) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadI32() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respGetEntityGetOutCollision) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respGetEntityGetOutCollision) Exception() thrift.WritableException { - return nil -} - -func (x *respGetEntityGetOutCollision) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respGetEntityGetOutCollision"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetOutCollision) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.I32)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respGetEntityGetOutCollision) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respGetEntityGetOutCollision({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respGetEntityGetOutCollision) setDefaults() *respGetEntityGetOutCollision { - return x -} - -type reqGetEntityGetOut1Collision struct { - Out int64 `thrift:"out,1" json:"out" db:"out"` - Out1 int64 `thrift:"out1,2" json:"out1" db:"out1"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqGetEntityGetOut1Collision)(nil) - -// Deprecated: GetEntityGetOut1CollisionArgsDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetOut1CollisionArgsDeprecated = reqGetEntityGetOut1Collision - -func newReqGetEntityGetOut1Collision() *reqGetEntityGetOut1Collision { - return (&reqGetEntityGetOut1Collision{}).setDefaults() -} - -func (x *reqGetEntityGetOut1Collision) GetOut() int64 { - return x.Out -} - -func (x *reqGetEntityGetOut1Collision) GetOut1() int64 { - return x.Out1 -} - -func (x *reqGetEntityGetOut1Collision) SetOutNonCompat(value int64) *reqGetEntityGetOut1Collision { - x.Out = value - return x -} - -func (x *reqGetEntityGetOut1Collision) SetOut(value int64) *reqGetEntityGetOut1Collision { - x.Out = value - return x -} - -func (x *reqGetEntityGetOut1Collision) SetOut1NonCompat(value int64) *reqGetEntityGetOut1Collision { - x.Out1 = value - return x -} - -func (x *reqGetEntityGetOut1Collision) SetOut1(value int64) *reqGetEntityGetOut1Collision { - x.Out1 = value - return x -} - -func (x *reqGetEntityGetOut1Collision) writeField1(p thrift.Encoder) error { // Out - if err := p.WriteFieldBegin("out", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Out - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetOut1Collision) writeField2(p thrift.Encoder) error { // Out1 - if err := p.WriteFieldBegin("out1", thrift.I64, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Out1 - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetOut1Collision) readField1(p thrift.Decoder) error { // Out - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Out = result - return nil -} - -func (x *reqGetEntityGetOut1Collision) readField2(p thrift.Decoder) error { // Out1 - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Out1 = result - return nil -} - -func (x *reqGetEntityGetOut1Collision) toString1() string { // Out - return fmt.Sprintf("%v", x.Out) -} - -func (x *reqGetEntityGetOut1Collision) toString2() string { // Out1 - return fmt.Sprintf("%v", x.Out1) -} - - - -func (x *reqGetEntityGetOut1Collision) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqGetEntityGetOut1Collision"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - if err := x.writeField2(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetOut1Collision) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // out - fieldReadErr = x.readField1(p) - case (id == 2 && wireType == thrift.Type(thrift.I64)): // out1 - fieldReadErr = x.readField2(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqGetEntityGetOut1Collision) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqGetEntityGetOut1Collision({") - sb.WriteString(fmt.Sprintf("Out:%s ", x.toString1())) - sb.WriteString(fmt.Sprintf("Out1:%s", x.toString2())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqGetEntityGetOut1Collision) setDefaults() *reqGetEntityGetOut1Collision { - return x. - SetOutNonCompat(0). - SetOut1NonCompat(0) -} - -type respGetEntityGetOut1Collision struct { - Success *int32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respGetEntityGetOut1Collision)(nil) -var _ thrift.WritableResult = (*respGetEntityGetOut1Collision)(nil) - -// Deprecated: GetEntityGetOut1CollisionResultDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetOut1CollisionResultDeprecated = respGetEntityGetOut1Collision - -func newRespGetEntityGetOut1Collision() *respGetEntityGetOut1Collision { - return (&respGetEntityGetOut1Collision{}).setDefaults() -} - -func (x *respGetEntityGetOut1Collision) GetSuccess() int32 { - if !x.IsSetSuccess() { - return 0 - } - return *x.Success -} - -func (x *respGetEntityGetOut1Collision) SetSuccessNonCompat(value int32) *respGetEntityGetOut1Collision { - x.Success = &value - return x -} - -func (x *respGetEntityGetOut1Collision) SetSuccess(value *int32) *respGetEntityGetOut1Collision { - x.Success = value - return x -} - -func (x *respGetEntityGetOut1Collision) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respGetEntityGetOut1Collision) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteI32(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetOut1Collision) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadI32() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respGetEntityGetOut1Collision) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respGetEntityGetOut1Collision) Exception() thrift.WritableException { - return nil -} - -func (x *respGetEntityGetOut1Collision) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respGetEntityGetOut1Collision"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetOut1Collision) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.I32)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respGetEntityGetOut1Collision) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respGetEntityGetOut1Collision({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respGetEntityGetOut1Collision) setDefaults() *respGetEntityGetOut1Collision { - return x -} - -type reqGetEntityGetInCollision struct { - In int64 `thrift:"in,1" json:"in" db:"in"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqGetEntityGetInCollision)(nil) - -// Deprecated: GetEntityGetInCollisionArgsDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetInCollisionArgsDeprecated = reqGetEntityGetInCollision - -func newReqGetEntityGetInCollision() *reqGetEntityGetInCollision { - return (&reqGetEntityGetInCollision{}).setDefaults() -} - -func (x *reqGetEntityGetInCollision) GetIn() int64 { - return x.In -} - -func (x *reqGetEntityGetInCollision) SetInNonCompat(value int64) *reqGetEntityGetInCollision { - x.In = value - return x -} - -func (x *reqGetEntityGetInCollision) SetIn(value int64) *reqGetEntityGetInCollision { - x.In = value - return x -} - -func (x *reqGetEntityGetInCollision) writeField1(p thrift.Encoder) error { // In - if err := p.WriteFieldBegin("in", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.In - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetInCollision) readField1(p thrift.Decoder) error { // In - result, err := p.ReadI64() -if err != nil { - return err -} - - x.In = result - return nil -} - -func (x *reqGetEntityGetInCollision) toString1() string { // In - return fmt.Sprintf("%v", x.In) -} - - - -func (x *reqGetEntityGetInCollision) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqGetEntityGetInCollision"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetInCollision) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // in - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqGetEntityGetInCollision) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqGetEntityGetInCollision({") - sb.WriteString(fmt.Sprintf("In:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqGetEntityGetInCollision) setDefaults() *reqGetEntityGetInCollision { - return x. - SetInNonCompat(0) -} - -type respGetEntityGetInCollision struct { - Success *int32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respGetEntityGetInCollision)(nil) -var _ thrift.WritableResult = (*respGetEntityGetInCollision)(nil) - -// Deprecated: GetEntityGetInCollisionResultDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetInCollisionResultDeprecated = respGetEntityGetInCollision - -func newRespGetEntityGetInCollision() *respGetEntityGetInCollision { - return (&respGetEntityGetInCollision{}).setDefaults() -} - -func (x *respGetEntityGetInCollision) GetSuccess() int32 { - if !x.IsSetSuccess() { - return 0 - } - return *x.Success -} - -func (x *respGetEntityGetInCollision) SetSuccessNonCompat(value int32) *respGetEntityGetInCollision { - x.Success = &value - return x -} - -func (x *respGetEntityGetInCollision) SetSuccess(value *int32) *respGetEntityGetInCollision { - x.Success = value - return x -} - -func (x *respGetEntityGetInCollision) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respGetEntityGetInCollision) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteI32(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetInCollision) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadI32() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respGetEntityGetInCollision) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respGetEntityGetInCollision) Exception() thrift.WritableException { - return nil -} - -func (x *respGetEntityGetInCollision) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respGetEntityGetInCollision"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetInCollision) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.I32)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respGetEntityGetInCollision) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respGetEntityGetInCollision({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respGetEntityGetInCollision) setDefaults() *respGetEntityGetInCollision { - return x -} - -type reqGetEntityGetIn1Collision struct { - In int64 `thrift:"in,1" json:"in" db:"in"` - In1 int64 `thrift:"in1,2" json:"in1" db:"in1"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqGetEntityGetIn1Collision)(nil) - -// Deprecated: GetEntityGetIn1CollisionArgsDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetIn1CollisionArgsDeprecated = reqGetEntityGetIn1Collision - -func newReqGetEntityGetIn1Collision() *reqGetEntityGetIn1Collision { - return (&reqGetEntityGetIn1Collision{}).setDefaults() -} - -func (x *reqGetEntityGetIn1Collision) GetIn() int64 { - return x.In -} - -func (x *reqGetEntityGetIn1Collision) GetIn1() int64 { - return x.In1 -} - -func (x *reqGetEntityGetIn1Collision) SetInNonCompat(value int64) *reqGetEntityGetIn1Collision { - x.In = value - return x -} - -func (x *reqGetEntityGetIn1Collision) SetIn(value int64) *reqGetEntityGetIn1Collision { - x.In = value - return x -} - -func (x *reqGetEntityGetIn1Collision) SetIn1NonCompat(value int64) *reqGetEntityGetIn1Collision { - x.In1 = value - return x -} - -func (x *reqGetEntityGetIn1Collision) SetIn1(value int64) *reqGetEntityGetIn1Collision { - x.In1 = value - return x -} - -func (x *reqGetEntityGetIn1Collision) writeField1(p thrift.Encoder) error { // In - if err := p.WriteFieldBegin("in", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.In - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetIn1Collision) writeField2(p thrift.Encoder) error { // In1 - if err := p.WriteFieldBegin("in1", thrift.I64, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.In1 - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetIn1Collision) readField1(p thrift.Decoder) error { // In - result, err := p.ReadI64() -if err != nil { - return err -} - - x.In = result - return nil -} - -func (x *reqGetEntityGetIn1Collision) readField2(p thrift.Decoder) error { // In1 - result, err := p.ReadI64() -if err != nil { - return err -} - - x.In1 = result - return nil -} - -func (x *reqGetEntityGetIn1Collision) toString1() string { // In - return fmt.Sprintf("%v", x.In) -} - -func (x *reqGetEntityGetIn1Collision) toString2() string { // In1 - return fmt.Sprintf("%v", x.In1) -} - - - -func (x *reqGetEntityGetIn1Collision) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqGetEntityGetIn1Collision"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - if err := x.writeField2(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetIn1Collision) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // in - fieldReadErr = x.readField1(p) - case (id == 2 && wireType == thrift.Type(thrift.I64)): // in1 - fieldReadErr = x.readField2(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqGetEntityGetIn1Collision) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqGetEntityGetIn1Collision({") - sb.WriteString(fmt.Sprintf("In:%s ", x.toString1())) - sb.WriteString(fmt.Sprintf("In1:%s", x.toString2())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqGetEntityGetIn1Collision) setDefaults() *reqGetEntityGetIn1Collision { - return x. - SetInNonCompat(0). - SetIn1NonCompat(0) -} - -type respGetEntityGetIn1Collision struct { - Success *int32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respGetEntityGetIn1Collision)(nil) -var _ thrift.WritableResult = (*respGetEntityGetIn1Collision)(nil) - -// Deprecated: GetEntityGetIn1CollisionResultDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetIn1CollisionResultDeprecated = respGetEntityGetIn1Collision - -func newRespGetEntityGetIn1Collision() *respGetEntityGetIn1Collision { - return (&respGetEntityGetIn1Collision{}).setDefaults() -} - -func (x *respGetEntityGetIn1Collision) GetSuccess() int32 { - if !x.IsSetSuccess() { - return 0 - } - return *x.Success -} - -func (x *respGetEntityGetIn1Collision) SetSuccessNonCompat(value int32) *respGetEntityGetIn1Collision { - x.Success = &value - return x -} - -func (x *respGetEntityGetIn1Collision) SetSuccess(value *int32) *respGetEntityGetIn1Collision { - x.Success = value - return x -} - -func (x *respGetEntityGetIn1Collision) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respGetEntityGetIn1Collision) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteI32(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetIn1Collision) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadI32() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respGetEntityGetIn1Collision) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respGetEntityGetIn1Collision) Exception() thrift.WritableException { - return nil -} - -func (x *respGetEntityGetIn1Collision) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respGetEntityGetIn1Collision"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetIn1Collision) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.I32)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respGetEntityGetIn1Collision) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respGetEntityGetIn1Collision({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respGetEntityGetIn1Collision) setDefaults() *respGetEntityGetIn1Collision { - return x -} - -type reqGetEntityGetErrCollision struct { - Err int64 `thrift:"err,1" json:"err" db:"err"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqGetEntityGetErrCollision)(nil) - -// Deprecated: GetEntityGetErrCollisionArgsDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetErrCollisionArgsDeprecated = reqGetEntityGetErrCollision - -func newReqGetEntityGetErrCollision() *reqGetEntityGetErrCollision { - return (&reqGetEntityGetErrCollision{}).setDefaults() -} - -func (x *reqGetEntityGetErrCollision) GetErr() int64 { - return x.Err -} - -func (x *reqGetEntityGetErrCollision) SetErrNonCompat(value int64) *reqGetEntityGetErrCollision { - x.Err = value - return x -} - -func (x *reqGetEntityGetErrCollision) SetErr(value int64) *reqGetEntityGetErrCollision { - x.Err = value - return x -} - -func (x *reqGetEntityGetErrCollision) writeField1(p thrift.Encoder) error { // Err - if err := p.WriteFieldBegin("err", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Err - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetErrCollision) readField1(p thrift.Decoder) error { // Err - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Err = result - return nil -} - -func (x *reqGetEntityGetErrCollision) toString1() string { // Err - return fmt.Sprintf("%v", x.Err) -} - - - -func (x *reqGetEntityGetErrCollision) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqGetEntityGetErrCollision"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetErrCollision) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // err - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqGetEntityGetErrCollision) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqGetEntityGetErrCollision({") - sb.WriteString(fmt.Sprintf("Err:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqGetEntityGetErrCollision) setDefaults() *reqGetEntityGetErrCollision { - return x. - SetErrNonCompat(0) -} - -type respGetEntityGetErrCollision struct { - Success *int32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respGetEntityGetErrCollision)(nil) -var _ thrift.WritableResult = (*respGetEntityGetErrCollision)(nil) - -// Deprecated: GetEntityGetErrCollisionResultDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetErrCollisionResultDeprecated = respGetEntityGetErrCollision - -func newRespGetEntityGetErrCollision() *respGetEntityGetErrCollision { - return (&respGetEntityGetErrCollision{}).setDefaults() -} - -func (x *respGetEntityGetErrCollision) GetSuccess() int32 { - if !x.IsSetSuccess() { - return 0 - } - return *x.Success -} - -func (x *respGetEntityGetErrCollision) SetSuccessNonCompat(value int32) *respGetEntityGetErrCollision { - x.Success = &value - return x -} - -func (x *respGetEntityGetErrCollision) SetSuccess(value *int32) *respGetEntityGetErrCollision { - x.Success = value - return x -} - -func (x *respGetEntityGetErrCollision) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respGetEntityGetErrCollision) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteI32(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetErrCollision) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadI32() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respGetEntityGetErrCollision) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respGetEntityGetErrCollision) Exception() thrift.WritableException { - return nil -} - -func (x *respGetEntityGetErrCollision) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respGetEntityGetErrCollision"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetErrCollision) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.I32)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respGetEntityGetErrCollision) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respGetEntityGetErrCollision({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respGetEntityGetErrCollision) setDefaults() *respGetEntityGetErrCollision { - return x -} - -type reqGetEntityGetErr1Collision struct { - Err int64 `thrift:"err,1" json:"err" db:"err"` - Err1 int64 `thrift:"err1,2" json:"err1" db:"err1"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqGetEntityGetErr1Collision)(nil) - -// Deprecated: GetEntityGetErr1CollisionArgsDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetErr1CollisionArgsDeprecated = reqGetEntityGetErr1Collision - -func newReqGetEntityGetErr1Collision() *reqGetEntityGetErr1Collision { - return (&reqGetEntityGetErr1Collision{}).setDefaults() -} - -func (x *reqGetEntityGetErr1Collision) GetErr() int64 { - return x.Err -} - -func (x *reqGetEntityGetErr1Collision) GetErr1() int64 { - return x.Err1 -} - -func (x *reqGetEntityGetErr1Collision) SetErrNonCompat(value int64) *reqGetEntityGetErr1Collision { - x.Err = value - return x -} - -func (x *reqGetEntityGetErr1Collision) SetErr(value int64) *reqGetEntityGetErr1Collision { - x.Err = value - return x -} - -func (x *reqGetEntityGetErr1Collision) SetErr1NonCompat(value int64) *reqGetEntityGetErr1Collision { - x.Err1 = value - return x -} - -func (x *reqGetEntityGetErr1Collision) SetErr1(value int64) *reqGetEntityGetErr1Collision { - x.Err1 = value - return x -} - -func (x *reqGetEntityGetErr1Collision) writeField1(p thrift.Encoder) error { // Err - if err := p.WriteFieldBegin("err", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Err - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetErr1Collision) writeField2(p thrift.Encoder) error { // Err1 - if err := p.WriteFieldBegin("err1", thrift.I64, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Err1 - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetErr1Collision) readField1(p thrift.Decoder) error { // Err - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Err = result - return nil -} - -func (x *reqGetEntityGetErr1Collision) readField2(p thrift.Decoder) error { // Err1 - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Err1 = result - return nil -} - -func (x *reqGetEntityGetErr1Collision) toString1() string { // Err - return fmt.Sprintf("%v", x.Err) -} - -func (x *reqGetEntityGetErr1Collision) toString2() string { // Err1 - return fmt.Sprintf("%v", x.Err1) -} - - - -func (x *reqGetEntityGetErr1Collision) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqGetEntityGetErr1Collision"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - if err := x.writeField2(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqGetEntityGetErr1Collision) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // err - fieldReadErr = x.readField1(p) - case (id == 2 && wireType == thrift.Type(thrift.I64)): // err1 - fieldReadErr = x.readField2(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqGetEntityGetErr1Collision) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqGetEntityGetErr1Collision({") - sb.WriteString(fmt.Sprintf("Err:%s ", x.toString1())) - sb.WriteString(fmt.Sprintf("Err1:%s", x.toString2())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqGetEntityGetErr1Collision) setDefaults() *reqGetEntityGetErr1Collision { - return x. - SetErrNonCompat(0). - SetErr1NonCompat(0) -} - -type respGetEntityGetErr1Collision struct { - Success *int32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respGetEntityGetErr1Collision)(nil) -var _ thrift.WritableResult = (*respGetEntityGetErr1Collision)(nil) - -// Deprecated: GetEntityGetErr1CollisionResultDeprecated is deprecated, since it is supposed to be internal. -type GetEntityGetErr1CollisionResultDeprecated = respGetEntityGetErr1Collision - -func newRespGetEntityGetErr1Collision() *respGetEntityGetErr1Collision { - return (&respGetEntityGetErr1Collision{}).setDefaults() -} - -func (x *respGetEntityGetErr1Collision) GetSuccess() int32 { - if !x.IsSetSuccess() { - return 0 - } - return *x.Success -} - -func (x *respGetEntityGetErr1Collision) SetSuccessNonCompat(value int32) *respGetEntityGetErr1Collision { - x.Success = &value - return x -} - -func (x *respGetEntityGetErr1Collision) SetSuccess(value *int32) *respGetEntityGetErr1Collision { - x.Success = value - return x -} - -func (x *respGetEntityGetErr1Collision) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respGetEntityGetErr1Collision) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteI32(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetErr1Collision) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadI32() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respGetEntityGetErr1Collision) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respGetEntityGetErr1Collision) Exception() thrift.WritableException { - return nil -} - -func (x *respGetEntityGetErr1Collision) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respGetEntityGetErr1Collision"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respGetEntityGetErr1Collision) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.I32)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respGetEntityGetErr1Collision) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respGetEntityGetErr1Collision({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respGetEntityGetErr1Collision) setDefaults() *respGetEntityGetErr1Collision { - return x -} - - type GetEntityProcessor struct { processorFunctionMap map[string]thrift.ProcessorFunction diff --git a/thrift/compiler/test/fixtures/go-service/out/go/gen-go/module/types.go b/thrift/compiler/test/fixtures/go-service/out/go/gen-go/module/types.go index 952b20b4883..c17a0672d4e 100644 --- a/thrift/compiler/test/fixtures/go-service/out/go/gen-go/module/types.go +++ b/thrift/compiler/test/fixtures/go-service/out/go/gen-go/module/types.go @@ -614,6 +614,6220 @@ func (x *NonComparableStruct) setDefaults() *NonComparableStruct { } +// Service req/resp structs (below) +type reqGetEntityGetEntity struct { + R *GetEntityRequest `thrift:"r,1" json:"r" db:"r"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqGetEntityGetEntity)(nil) + +// Deprecated: GetEntityGetEntityArgsDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetEntityArgsDeprecated = reqGetEntityGetEntity + +func newReqGetEntityGetEntity() *reqGetEntityGetEntity { + return (&reqGetEntityGetEntity{}).setDefaults() +} + +func (x *reqGetEntityGetEntity) GetR() *GetEntityRequest { + if !x.IsSetR() { + return nil + } + return x.R +} + +func (x *reqGetEntityGetEntity) SetRNonCompat(value *GetEntityRequest) *reqGetEntityGetEntity { + x.R = value + return x +} + +func (x *reqGetEntityGetEntity) SetR(value *GetEntityRequest) *reqGetEntityGetEntity { + x.R = value + return x +} + +func (x *reqGetEntityGetEntity) IsSetR() bool { + return x != nil && x.R != nil +} + +func (x *reqGetEntityGetEntity) writeField1(p thrift.Encoder) error { // R + if !x.IsSetR() { + return nil + } + + if err := p.WriteFieldBegin("r", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.R + if err := item.Write(p); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetEntity) readField1(p thrift.Decoder) error { // R + result := NewGetEntityRequest() +err := result.Read(p) +if err != nil { + return err +} + + x.R = result + return nil +} + +func (x *reqGetEntityGetEntity) toString1() string { // R + return fmt.Sprintf("%v", x.R) +} + +// Deprecated: Use newReqGetEntityGetEntity().GetR() instead. +func (x *reqGetEntityGetEntity) DefaultGetR() *GetEntityRequest { + if !x.IsSetR() { + return NewGetEntityRequest() + } + return x.R +} + + + +func (x *reqGetEntityGetEntity) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqGetEntityGetEntity"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetEntity) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.STRUCT)): // r + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqGetEntityGetEntity) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqGetEntityGetEntity({") + sb.WriteString(fmt.Sprintf("R:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqGetEntityGetEntity) setDefaults() *reqGetEntityGetEntity { + return x. + SetRNonCompat(NewGetEntityRequest()) +} + +type respGetEntityGetEntity struct { + Success *GetEntityResponse `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respGetEntityGetEntity)(nil) +var _ thrift.WritableResult = (*respGetEntityGetEntity)(nil) + +// Deprecated: GetEntityGetEntityResultDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetEntityResultDeprecated = respGetEntityGetEntity + +func newRespGetEntityGetEntity() *respGetEntityGetEntity { + return (&respGetEntityGetEntity{}).setDefaults() +} + +func (x *respGetEntityGetEntity) GetSuccess() *GetEntityResponse { + if !x.IsSetSuccess() { + return nil + } + return x.Success +} + +func (x *respGetEntityGetEntity) SetSuccessNonCompat(value *GetEntityResponse) *respGetEntityGetEntity { + x.Success = value + return x +} + +func (x *respGetEntityGetEntity) SetSuccess(value *GetEntityResponse) *respGetEntityGetEntity { + x.Success = value + return x +} + +func (x *respGetEntityGetEntity) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respGetEntityGetEntity) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Success + if err := item.Write(p); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetEntity) readField0(p thrift.Decoder) error { // Success + result := NewGetEntityResponse() +err := result.Read(p) +if err != nil { + return err +} + + x.Success = result + return nil +} + +func (x *respGetEntityGetEntity) toString0() string { // Success + return fmt.Sprintf("%v", x.Success) +} + +// Deprecated: Use newRespGetEntityGetEntity().GetSuccess() instead. +func (x *respGetEntityGetEntity) DefaultGetSuccess() *GetEntityResponse { + if !x.IsSetSuccess() { + return NewGetEntityResponse() + } + return x.Success +} + + + +func (x *respGetEntityGetEntity) Exception() thrift.WritableException { + return nil +} + +func (x *respGetEntityGetEntity) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respGetEntityGetEntity"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetEntity) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.STRUCT)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respGetEntityGetEntity) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respGetEntityGetEntity({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respGetEntityGetEntity) setDefaults() *respGetEntityGetEntity { + return x +} + +type reqGetEntityGetBool struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqGetEntityGetBool)(nil) + +// Deprecated: GetEntityGetBoolArgsDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetBoolArgsDeprecated = reqGetEntityGetBool + +func newReqGetEntityGetBool() *reqGetEntityGetBool { + return (&reqGetEntityGetBool{}).setDefaults() +} + + + +func (x *reqGetEntityGetBool) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqGetEntityGetBool"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetBool) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqGetEntityGetBool) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqGetEntityGetBool({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqGetEntityGetBool) setDefaults() *reqGetEntityGetBool { + return x +} + +type respGetEntityGetBool struct { + Success *bool `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respGetEntityGetBool)(nil) +var _ thrift.WritableResult = (*respGetEntityGetBool)(nil) + +// Deprecated: GetEntityGetBoolResultDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetBoolResultDeprecated = respGetEntityGetBool + +func newRespGetEntityGetBool() *respGetEntityGetBool { + return (&respGetEntityGetBool{}).setDefaults() +} + +func (x *respGetEntityGetBool) GetSuccess() bool { + if !x.IsSetSuccess() { + return false + } + return *x.Success +} + +func (x *respGetEntityGetBool) SetSuccessNonCompat(value bool) *respGetEntityGetBool { + x.Success = &value + return x +} + +func (x *respGetEntityGetBool) SetSuccess(value *bool) *respGetEntityGetBool { + x.Success = value + return x +} + +func (x *respGetEntityGetBool) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respGetEntityGetBool) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.BOOL, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteBool(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetBool) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadBool() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respGetEntityGetBool) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respGetEntityGetBool) Exception() thrift.WritableException { + return nil +} + +func (x *respGetEntityGetBool) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respGetEntityGetBool"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetBool) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.BOOL)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respGetEntityGetBool) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respGetEntityGetBool({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respGetEntityGetBool) setDefaults() *respGetEntityGetBool { + return x +} + +type reqGetEntityGetByte struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqGetEntityGetByte)(nil) + +// Deprecated: GetEntityGetByteArgsDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetByteArgsDeprecated = reqGetEntityGetByte + +func newReqGetEntityGetByte() *reqGetEntityGetByte { + return (&reqGetEntityGetByte{}).setDefaults() +} + + + +func (x *reqGetEntityGetByte) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqGetEntityGetByte"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetByte) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqGetEntityGetByte) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqGetEntityGetByte({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqGetEntityGetByte) setDefaults() *reqGetEntityGetByte { + return x +} + +type respGetEntityGetByte struct { + Success *int8 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respGetEntityGetByte)(nil) +var _ thrift.WritableResult = (*respGetEntityGetByte)(nil) + +// Deprecated: GetEntityGetByteResultDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetByteResultDeprecated = respGetEntityGetByte + +func newRespGetEntityGetByte() *respGetEntityGetByte { + return (&respGetEntityGetByte{}).setDefaults() +} + +func (x *respGetEntityGetByte) GetSuccess() int8 { + if !x.IsSetSuccess() { + return 0 + } + return *x.Success +} + +func (x *respGetEntityGetByte) SetSuccessNonCompat(value int8) *respGetEntityGetByte { + x.Success = &value + return x +} + +func (x *respGetEntityGetByte) SetSuccess(value *int8) *respGetEntityGetByte { + x.Success = value + return x +} + +func (x *respGetEntityGetByte) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respGetEntityGetByte) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.BYTE, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteByte(byte(item)); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetByte) readField0(p thrift.Decoder) error { // Success + resultByte, err := p.ReadByte() +result := int8(resultByte) +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respGetEntityGetByte) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respGetEntityGetByte) Exception() thrift.WritableException { + return nil +} + +func (x *respGetEntityGetByte) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respGetEntityGetByte"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetByte) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.BYTE)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respGetEntityGetByte) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respGetEntityGetByte({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respGetEntityGetByte) setDefaults() *respGetEntityGetByte { + return x +} + +type reqGetEntityGetI16 struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqGetEntityGetI16)(nil) + +// Deprecated: GetEntityGetI16ArgsDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetI16ArgsDeprecated = reqGetEntityGetI16 + +func newReqGetEntityGetI16() *reqGetEntityGetI16 { + return (&reqGetEntityGetI16{}).setDefaults() +} + + + +func (x *reqGetEntityGetI16) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqGetEntityGetI16"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetI16) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqGetEntityGetI16) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqGetEntityGetI16({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqGetEntityGetI16) setDefaults() *reqGetEntityGetI16 { + return x +} + +type respGetEntityGetI16 struct { + Success *int16 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respGetEntityGetI16)(nil) +var _ thrift.WritableResult = (*respGetEntityGetI16)(nil) + +// Deprecated: GetEntityGetI16ResultDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetI16ResultDeprecated = respGetEntityGetI16 + +func newRespGetEntityGetI16() *respGetEntityGetI16 { + return (&respGetEntityGetI16{}).setDefaults() +} + +func (x *respGetEntityGetI16) GetSuccess() int16 { + if !x.IsSetSuccess() { + return 0 + } + return *x.Success +} + +func (x *respGetEntityGetI16) SetSuccessNonCompat(value int16) *respGetEntityGetI16 { + x.Success = &value + return x +} + +func (x *respGetEntityGetI16) SetSuccess(value *int16) *respGetEntityGetI16 { + x.Success = value + return x +} + +func (x *respGetEntityGetI16) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respGetEntityGetI16) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.I16, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteI16(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetI16) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadI16() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respGetEntityGetI16) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respGetEntityGetI16) Exception() thrift.WritableException { + return nil +} + +func (x *respGetEntityGetI16) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respGetEntityGetI16"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetI16) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.I16)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respGetEntityGetI16) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respGetEntityGetI16({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respGetEntityGetI16) setDefaults() *respGetEntityGetI16 { + return x +} + +type reqGetEntityGetI32 struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqGetEntityGetI32)(nil) + +// Deprecated: GetEntityGetI32ArgsDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetI32ArgsDeprecated = reqGetEntityGetI32 + +func newReqGetEntityGetI32() *reqGetEntityGetI32 { + return (&reqGetEntityGetI32{}).setDefaults() +} + + + +func (x *reqGetEntityGetI32) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqGetEntityGetI32"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetI32) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqGetEntityGetI32) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqGetEntityGetI32({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqGetEntityGetI32) setDefaults() *reqGetEntityGetI32 { + return x +} + +type respGetEntityGetI32 struct { + Success *int32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respGetEntityGetI32)(nil) +var _ thrift.WritableResult = (*respGetEntityGetI32)(nil) + +// Deprecated: GetEntityGetI32ResultDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetI32ResultDeprecated = respGetEntityGetI32 + +func newRespGetEntityGetI32() *respGetEntityGetI32 { + return (&respGetEntityGetI32{}).setDefaults() +} + +func (x *respGetEntityGetI32) GetSuccess() int32 { + if !x.IsSetSuccess() { + return 0 + } + return *x.Success +} + +func (x *respGetEntityGetI32) SetSuccessNonCompat(value int32) *respGetEntityGetI32 { + x.Success = &value + return x +} + +func (x *respGetEntityGetI32) SetSuccess(value *int32) *respGetEntityGetI32 { + x.Success = value + return x +} + +func (x *respGetEntityGetI32) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respGetEntityGetI32) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteI32(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetI32) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadI32() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respGetEntityGetI32) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respGetEntityGetI32) Exception() thrift.WritableException { + return nil +} + +func (x *respGetEntityGetI32) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respGetEntityGetI32"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetI32) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.I32)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respGetEntityGetI32) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respGetEntityGetI32({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respGetEntityGetI32) setDefaults() *respGetEntityGetI32 { + return x +} + +type reqGetEntityGetI64 struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqGetEntityGetI64)(nil) + +// Deprecated: GetEntityGetI64ArgsDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetI64ArgsDeprecated = reqGetEntityGetI64 + +func newReqGetEntityGetI64() *reqGetEntityGetI64 { + return (&reqGetEntityGetI64{}).setDefaults() +} + + + +func (x *reqGetEntityGetI64) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqGetEntityGetI64"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetI64) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqGetEntityGetI64) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqGetEntityGetI64({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqGetEntityGetI64) setDefaults() *reqGetEntityGetI64 { + return x +} + +type respGetEntityGetI64 struct { + Success *int64 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respGetEntityGetI64)(nil) +var _ thrift.WritableResult = (*respGetEntityGetI64)(nil) + +// Deprecated: GetEntityGetI64ResultDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetI64ResultDeprecated = respGetEntityGetI64 + +func newRespGetEntityGetI64() *respGetEntityGetI64 { + return (&respGetEntityGetI64{}).setDefaults() +} + +func (x *respGetEntityGetI64) GetSuccess() int64 { + if !x.IsSetSuccess() { + return 0 + } + return *x.Success +} + +func (x *respGetEntityGetI64) SetSuccessNonCompat(value int64) *respGetEntityGetI64 { + x.Success = &value + return x +} + +func (x *respGetEntityGetI64) SetSuccess(value *int64) *respGetEntityGetI64 { + x.Success = value + return x +} + +func (x *respGetEntityGetI64) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respGetEntityGetI64) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.I64, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetI64) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respGetEntityGetI64) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respGetEntityGetI64) Exception() thrift.WritableException { + return nil +} + +func (x *respGetEntityGetI64) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respGetEntityGetI64"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetI64) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.I64)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respGetEntityGetI64) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respGetEntityGetI64({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respGetEntityGetI64) setDefaults() *respGetEntityGetI64 { + return x +} + +type reqGetEntityGetDouble struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqGetEntityGetDouble)(nil) + +// Deprecated: GetEntityGetDoubleArgsDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetDoubleArgsDeprecated = reqGetEntityGetDouble + +func newReqGetEntityGetDouble() *reqGetEntityGetDouble { + return (&reqGetEntityGetDouble{}).setDefaults() +} + + + +func (x *reqGetEntityGetDouble) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqGetEntityGetDouble"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetDouble) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqGetEntityGetDouble) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqGetEntityGetDouble({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqGetEntityGetDouble) setDefaults() *reqGetEntityGetDouble { + return x +} + +type respGetEntityGetDouble struct { + Success *float64 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respGetEntityGetDouble)(nil) +var _ thrift.WritableResult = (*respGetEntityGetDouble)(nil) + +// Deprecated: GetEntityGetDoubleResultDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetDoubleResultDeprecated = respGetEntityGetDouble + +func newRespGetEntityGetDouble() *respGetEntityGetDouble { + return (&respGetEntityGetDouble{}).setDefaults() +} + +func (x *respGetEntityGetDouble) GetSuccess() float64 { + if !x.IsSetSuccess() { + return 0.0 + } + return *x.Success +} + +func (x *respGetEntityGetDouble) SetSuccessNonCompat(value float64) *respGetEntityGetDouble { + x.Success = &value + return x +} + +func (x *respGetEntityGetDouble) SetSuccess(value *float64) *respGetEntityGetDouble { + x.Success = value + return x +} + +func (x *respGetEntityGetDouble) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respGetEntityGetDouble) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.DOUBLE, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteDouble(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetDouble) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadDouble() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respGetEntityGetDouble) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respGetEntityGetDouble) Exception() thrift.WritableException { + return nil +} + +func (x *respGetEntityGetDouble) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respGetEntityGetDouble"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetDouble) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.DOUBLE)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respGetEntityGetDouble) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respGetEntityGetDouble({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respGetEntityGetDouble) setDefaults() *respGetEntityGetDouble { + return x +} + +type reqGetEntityGetString struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqGetEntityGetString)(nil) + +// Deprecated: GetEntityGetStringArgsDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetStringArgsDeprecated = reqGetEntityGetString + +func newReqGetEntityGetString() *reqGetEntityGetString { + return (&reqGetEntityGetString{}).setDefaults() +} + + + +func (x *reqGetEntityGetString) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqGetEntityGetString"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetString) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqGetEntityGetString) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqGetEntityGetString({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqGetEntityGetString) setDefaults() *reqGetEntityGetString { + return x +} + +type respGetEntityGetString struct { + Success *string `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respGetEntityGetString)(nil) +var _ thrift.WritableResult = (*respGetEntityGetString)(nil) + +// Deprecated: GetEntityGetStringResultDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetStringResultDeprecated = respGetEntityGetString + +func newRespGetEntityGetString() *respGetEntityGetString { + return (&respGetEntityGetString{}).setDefaults() +} + +func (x *respGetEntityGetString) GetSuccess() string { + if !x.IsSetSuccess() { + return "" + } + return *x.Success +} + +func (x *respGetEntityGetString) SetSuccessNonCompat(value string) *respGetEntityGetString { + x.Success = &value + return x +} + +func (x *respGetEntityGetString) SetSuccess(value *string) *respGetEntityGetString { + x.Success = value + return x +} + +func (x *respGetEntityGetString) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respGetEntityGetString) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.STRING, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteString(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetString) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadString() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respGetEntityGetString) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respGetEntityGetString) Exception() thrift.WritableException { + return nil +} + +func (x *respGetEntityGetString) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respGetEntityGetString"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetString) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.STRING)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respGetEntityGetString) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respGetEntityGetString({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respGetEntityGetString) setDefaults() *respGetEntityGetString { + return x +} + +type reqGetEntityGetBinary struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqGetEntityGetBinary)(nil) + +// Deprecated: GetEntityGetBinaryArgsDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetBinaryArgsDeprecated = reqGetEntityGetBinary + +func newReqGetEntityGetBinary() *reqGetEntityGetBinary { + return (&reqGetEntityGetBinary{}).setDefaults() +} + + + +func (x *reqGetEntityGetBinary) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqGetEntityGetBinary"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetBinary) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqGetEntityGetBinary) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqGetEntityGetBinary({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqGetEntityGetBinary) setDefaults() *reqGetEntityGetBinary { + return x +} + +type respGetEntityGetBinary struct { + Success []byte `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respGetEntityGetBinary)(nil) +var _ thrift.WritableResult = (*respGetEntityGetBinary)(nil) + +// Deprecated: GetEntityGetBinaryResultDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetBinaryResultDeprecated = respGetEntityGetBinary + +func newRespGetEntityGetBinary() *respGetEntityGetBinary { + return (&respGetEntityGetBinary{}).setDefaults() +} + +func (x *respGetEntityGetBinary) GetSuccess() []byte { + if !x.IsSetSuccess() { + return []byte("") + } + return x.Success +} + +func (x *respGetEntityGetBinary) SetSuccessNonCompat(value []byte) *respGetEntityGetBinary { + x.Success = value + return x +} + +func (x *respGetEntityGetBinary) SetSuccess(value []byte) *respGetEntityGetBinary { + x.Success = value + return x +} + +func (x *respGetEntityGetBinary) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respGetEntityGetBinary) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.STRING, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Success + if err := p.WriteBinary(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetBinary) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadBinary() +if err != nil { + return err +} + + x.Success = result + return nil +} + +func (x *respGetEntityGetBinary) toString0() string { // Success + return fmt.Sprintf("%v", x.Success) +} + + + +func (x *respGetEntityGetBinary) Exception() thrift.WritableException { + return nil +} + +func (x *respGetEntityGetBinary) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respGetEntityGetBinary"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetBinary) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.STRING)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respGetEntityGetBinary) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respGetEntityGetBinary({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respGetEntityGetBinary) setDefaults() *respGetEntityGetBinary { + return x +} + +type reqGetEntityGetMap struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqGetEntityGetMap)(nil) + +// Deprecated: GetEntityGetMapArgsDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetMapArgsDeprecated = reqGetEntityGetMap + +func newReqGetEntityGetMap() *reqGetEntityGetMap { + return (&reqGetEntityGetMap{}).setDefaults() +} + + + +func (x *reqGetEntityGetMap) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqGetEntityGetMap"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetMap) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqGetEntityGetMap) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqGetEntityGetMap({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqGetEntityGetMap) setDefaults() *reqGetEntityGetMap { + return x +} + +type respGetEntityGetMap struct { + Success map[string]string `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respGetEntityGetMap)(nil) +var _ thrift.WritableResult = (*respGetEntityGetMap)(nil) + +// Deprecated: GetEntityGetMapResultDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetMapResultDeprecated = respGetEntityGetMap + +func newRespGetEntityGetMap() *respGetEntityGetMap { + return (&respGetEntityGetMap{}).setDefaults() +} + +func (x *respGetEntityGetMap) GetSuccess() map[string]string { + if !x.IsSetSuccess() { + return make(map[string]string) + } + return x.Success +} + +func (x *respGetEntityGetMap) SetSuccessNonCompat(value map[string]string) *respGetEntityGetMap { + x.Success = value + return x +} + +func (x *respGetEntityGetMap) SetSuccess(value map[string]string) *respGetEntityGetMap { + x.Success = value + return x +} + +func (x *respGetEntityGetMap) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respGetEntityGetMap) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.MAP, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Success + if err := p.WriteMapBegin(thrift.STRING, thrift.STRING, len(item)); err != nil { + return thrift.PrependError("error writing map begin: ", err) +} +for k, v := range item { + { + item := k + if err := p.WriteString(item); err != nil { + return err +} + } + + { + item := v + if err := p.WriteString(item); err != nil { + return err +} + } +} +if err := p.WriteMapEnd(); err != nil { + return thrift.PrependError("error writing map end: ", err) +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetMap) readField0(p thrift.Decoder) error { // Success + _ /* keyType */, _ /* valueType */, size, err := p.ReadMapBegin() +if err != nil { + return thrift.PrependError("error reading map begin: ", err) +} + +mapResult := make(map[string]string, size) +for i := 0; i < size; i++ { + var key string + { + result, err := p.ReadString() +if err != nil { + return err +} + key = result + } + + var value string + { + result, err := p.ReadString() +if err != nil { + return err +} + value = result + } + + mapResult[key] = value +} + +if err := p.ReadMapEnd(); err != nil { + return thrift.PrependError("error reading map end: ", err) +} +result := mapResult + + x.Success = result + return nil +} + +func (x *respGetEntityGetMap) toString0() string { // Success + return fmt.Sprintf("%v", x.Success) +} + + + +func (x *respGetEntityGetMap) Exception() thrift.WritableException { + return nil +} + +func (x *respGetEntityGetMap) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respGetEntityGetMap"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetMap) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.MAP)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respGetEntityGetMap) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respGetEntityGetMap({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respGetEntityGetMap) setDefaults() *respGetEntityGetMap { + return x +} + +type reqGetEntityGetSet struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqGetEntityGetSet)(nil) + +// Deprecated: GetEntityGetSetArgsDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetSetArgsDeprecated = reqGetEntityGetSet + +func newReqGetEntityGetSet() *reqGetEntityGetSet { + return (&reqGetEntityGetSet{}).setDefaults() +} + + + +func (x *reqGetEntityGetSet) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqGetEntityGetSet"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetSet) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqGetEntityGetSet) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqGetEntityGetSet({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqGetEntityGetSet) setDefaults() *reqGetEntityGetSet { + return x +} + +type respGetEntityGetSet struct { + Success []string `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respGetEntityGetSet)(nil) +var _ thrift.WritableResult = (*respGetEntityGetSet)(nil) + +// Deprecated: GetEntityGetSetResultDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetSetResultDeprecated = respGetEntityGetSet + +func newRespGetEntityGetSet() *respGetEntityGetSet { + return (&respGetEntityGetSet{}).setDefaults() +} + +func (x *respGetEntityGetSet) GetSuccess() []string { + if !x.IsSetSuccess() { + return make([]string, 0) + } + return x.Success +} + +func (x *respGetEntityGetSet) SetSuccessNonCompat(value []string) *respGetEntityGetSet { + x.Success = value + return x +} + +func (x *respGetEntityGetSet) SetSuccess(value []string) *respGetEntityGetSet { + x.Success = value + return x +} + +func (x *respGetEntityGetSet) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respGetEntityGetSet) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.SET, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Success + if err := p.WriteSetBegin(thrift.STRING, len(item)); err != nil { + return thrift.PrependError("error writing set begin: ", err) +} +for _, v := range item { + { + item := v + if err := p.WriteString(item); err != nil { + return err +} + } +} +if err := p.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetSet) readField0(p thrift.Decoder) error { // Success + _ /* elemType */, size, err := p.ReadSetBegin() +if err != nil { + return thrift.PrependError("error reading set begin: ", err) +} + +setResult := make([]string, 0, size) +for i := 0; i < size; i++ { + var elem string + { + result, err := p.ReadString() +if err != nil { + return err +} + elem = result + } + setResult = append(setResult, elem) +} + +if err := p.ReadSetEnd(); err != nil { + return thrift.PrependError("error reading set end: ", err) +} +result := setResult + + x.Success = result + return nil +} + +func (x *respGetEntityGetSet) toString0() string { // Success + return fmt.Sprintf("%v", x.Success) +} + + + +func (x *respGetEntityGetSet) Exception() thrift.WritableException { + return nil +} + +func (x *respGetEntityGetSet) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respGetEntityGetSet"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetSet) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.SET)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respGetEntityGetSet) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respGetEntityGetSet({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respGetEntityGetSet) setDefaults() *respGetEntityGetSet { + return x +} + +type reqGetEntityGetList struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqGetEntityGetList)(nil) + +// Deprecated: GetEntityGetListArgsDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetListArgsDeprecated = reqGetEntityGetList + +func newReqGetEntityGetList() *reqGetEntityGetList { + return (&reqGetEntityGetList{}).setDefaults() +} + + + +func (x *reqGetEntityGetList) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqGetEntityGetList"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetList) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqGetEntityGetList) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqGetEntityGetList({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqGetEntityGetList) setDefaults() *reqGetEntityGetList { + return x +} + +type respGetEntityGetList struct { + Success []string `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respGetEntityGetList)(nil) +var _ thrift.WritableResult = (*respGetEntityGetList)(nil) + +// Deprecated: GetEntityGetListResultDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetListResultDeprecated = respGetEntityGetList + +func newRespGetEntityGetList() *respGetEntityGetList { + return (&respGetEntityGetList{}).setDefaults() +} + +func (x *respGetEntityGetList) GetSuccess() []string { + if !x.IsSetSuccess() { + return make([]string, 0) + } + return x.Success +} + +func (x *respGetEntityGetList) SetSuccessNonCompat(value []string) *respGetEntityGetList { + x.Success = value + return x +} + +func (x *respGetEntityGetList) SetSuccess(value []string) *respGetEntityGetList { + x.Success = value + return x +} + +func (x *respGetEntityGetList) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respGetEntityGetList) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.LIST, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Success + if err := p.WriteListBegin(thrift.STRING, len(item)); err != nil { + return thrift.PrependError("error writing list begin: ", err) +} +for _, v := range item { + { + item := v + if err := p.WriteString(item); err != nil { + return err +} + } +} +if err := p.WriteListEnd(); err != nil { + return thrift.PrependError("error writing list end: ", err) +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetList) readField0(p thrift.Decoder) error { // Success + _ /* elemType */, size, err := p.ReadListBegin() +if err != nil { + return thrift.PrependError("error reading list begin: ", err) +} + +listResult := make([]string, 0, size) +for i := 0; i < size; i++ { + var elem string + { + result, err := p.ReadString() +if err != nil { + return err +} + elem = result + } + listResult = append(listResult, elem) +} + +if err := p.ReadListEnd(); err != nil { + return thrift.PrependError("error reading list end: ", err) +} +result := listResult + + x.Success = result + return nil +} + +func (x *respGetEntityGetList) toString0() string { // Success + return fmt.Sprintf("%v", x.Success) +} + + + +func (x *respGetEntityGetList) Exception() thrift.WritableException { + return nil +} + +func (x *respGetEntityGetList) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respGetEntityGetList"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetList) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.LIST)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respGetEntityGetList) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respGetEntityGetList({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respGetEntityGetList) setDefaults() *respGetEntityGetList { + return x +} + +type reqGetEntityGetLegacyStuff struct { + NumNeg2 int64 `thrift:"numNeg2,-2" json:"numNeg2" db:"numNeg2"` + NumNeg1 int64 `thrift:"numNeg1,-1" json:"numNeg1" db:"numNeg1"` + NumPos int64 `thrift:"numPos,1" json:"numPos" db:"numPos"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqGetEntityGetLegacyStuff)(nil) + +// Deprecated: GetEntityGetLegacyStuffArgsDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetLegacyStuffArgsDeprecated = reqGetEntityGetLegacyStuff + +func newReqGetEntityGetLegacyStuff() *reqGetEntityGetLegacyStuff { + return (&reqGetEntityGetLegacyStuff{}).setDefaults() +} + +func (x *reqGetEntityGetLegacyStuff) GetNumNeg2() int64 { + return x.NumNeg2 +} + +func (x *reqGetEntityGetLegacyStuff) GetNumNeg1() int64 { + return x.NumNeg1 +} + +func (x *reqGetEntityGetLegacyStuff) GetNumPos() int64 { + return x.NumPos +} + +func (x *reqGetEntityGetLegacyStuff) SetNumNeg2NonCompat(value int64) *reqGetEntityGetLegacyStuff { + x.NumNeg2 = value + return x +} + +func (x *reqGetEntityGetLegacyStuff) SetNumNeg2(value int64) *reqGetEntityGetLegacyStuff { + x.NumNeg2 = value + return x +} + +func (x *reqGetEntityGetLegacyStuff) SetNumNeg1NonCompat(value int64) *reqGetEntityGetLegacyStuff { + x.NumNeg1 = value + return x +} + +func (x *reqGetEntityGetLegacyStuff) SetNumNeg1(value int64) *reqGetEntityGetLegacyStuff { + x.NumNeg1 = value + return x +} + +func (x *reqGetEntityGetLegacyStuff) SetNumPosNonCompat(value int64) *reqGetEntityGetLegacyStuff { + x.NumPos = value + return x +} + +func (x *reqGetEntityGetLegacyStuff) SetNumPos(value int64) *reqGetEntityGetLegacyStuff { + x.NumPos = value + return x +} + +func (x *reqGetEntityGetLegacyStuff) writeField_2(p thrift.Encoder) error { // NumNeg2 + if err := p.WriteFieldBegin("numNeg2", thrift.I64, -2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.NumNeg2 + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetLegacyStuff) writeField_1(p thrift.Encoder) error { // NumNeg1 + if err := p.WriteFieldBegin("numNeg1", thrift.I64, -1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.NumNeg1 + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetLegacyStuff) writeField1(p thrift.Encoder) error { // NumPos + if err := p.WriteFieldBegin("numPos", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.NumPos + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetLegacyStuff) readField_2(p thrift.Decoder) error { // NumNeg2 + result, err := p.ReadI64() +if err != nil { + return err +} + + x.NumNeg2 = result + return nil +} + +func (x *reqGetEntityGetLegacyStuff) readField_1(p thrift.Decoder) error { // NumNeg1 + result, err := p.ReadI64() +if err != nil { + return err +} + + x.NumNeg1 = result + return nil +} + +func (x *reqGetEntityGetLegacyStuff) readField1(p thrift.Decoder) error { // NumPos + result, err := p.ReadI64() +if err != nil { + return err +} + + x.NumPos = result + return nil +} + +func (x *reqGetEntityGetLegacyStuff) toString_2() string { // NumNeg2 + return fmt.Sprintf("%v", x.NumNeg2) +} + +func (x *reqGetEntityGetLegacyStuff) toString_1() string { // NumNeg1 + return fmt.Sprintf("%v", x.NumNeg1) +} + +func (x *reqGetEntityGetLegacyStuff) toString1() string { // NumPos + return fmt.Sprintf("%v", x.NumPos) +} + + + +func (x *reqGetEntityGetLegacyStuff) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqGetEntityGetLegacyStuff"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField_2(p); err != nil { + return err + } + if err := x.writeField_1(p); err != nil { + return err + } + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetLegacyStuff) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == -2 && wireType == thrift.Type(thrift.I64)): // numNeg2 + fieldReadErr = x.readField_2(p) + case (id == -1 && wireType == thrift.Type(thrift.I64)): // numNeg1 + fieldReadErr = x.readField_1(p) + case (id == 1 && wireType == thrift.Type(thrift.I64)): // numPos + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqGetEntityGetLegacyStuff) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqGetEntityGetLegacyStuff({") + sb.WriteString(fmt.Sprintf("NumNeg2:%s ", x.toString_2())) + sb.WriteString(fmt.Sprintf("NumNeg1:%s ", x.toString_1())) + sb.WriteString(fmt.Sprintf("NumPos:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqGetEntityGetLegacyStuff) setDefaults() *reqGetEntityGetLegacyStuff { + return x. + SetNumNeg2NonCompat(0). + SetNumNeg1NonCompat(0). + SetNumPosNonCompat(0) +} + +type respGetEntityGetLegacyStuff struct { + Success *int32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respGetEntityGetLegacyStuff)(nil) +var _ thrift.WritableResult = (*respGetEntityGetLegacyStuff)(nil) + +// Deprecated: GetEntityGetLegacyStuffResultDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetLegacyStuffResultDeprecated = respGetEntityGetLegacyStuff + +func newRespGetEntityGetLegacyStuff() *respGetEntityGetLegacyStuff { + return (&respGetEntityGetLegacyStuff{}).setDefaults() +} + +func (x *respGetEntityGetLegacyStuff) GetSuccess() int32 { + if !x.IsSetSuccess() { + return 0 + } + return *x.Success +} + +func (x *respGetEntityGetLegacyStuff) SetSuccessNonCompat(value int32) *respGetEntityGetLegacyStuff { + x.Success = &value + return x +} + +func (x *respGetEntityGetLegacyStuff) SetSuccess(value *int32) *respGetEntityGetLegacyStuff { + x.Success = value + return x +} + +func (x *respGetEntityGetLegacyStuff) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respGetEntityGetLegacyStuff) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteI32(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetLegacyStuff) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadI32() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respGetEntityGetLegacyStuff) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respGetEntityGetLegacyStuff) Exception() thrift.WritableException { + return nil +} + +func (x *respGetEntityGetLegacyStuff) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respGetEntityGetLegacyStuff"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetLegacyStuff) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.I32)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respGetEntityGetLegacyStuff) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respGetEntityGetLegacyStuff({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respGetEntityGetLegacyStuff) setDefaults() *respGetEntityGetLegacyStuff { + return x +} + +type reqGetEntityGetCtxCollision struct { + Ctx int64 `thrift:"ctx,1" json:"ctx" db:"ctx"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqGetEntityGetCtxCollision)(nil) + +// Deprecated: GetEntityGetCtxCollisionArgsDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetCtxCollisionArgsDeprecated = reqGetEntityGetCtxCollision + +func newReqGetEntityGetCtxCollision() *reqGetEntityGetCtxCollision { + return (&reqGetEntityGetCtxCollision{}).setDefaults() +} + +func (x *reqGetEntityGetCtxCollision) GetCtx() int64 { + return x.Ctx +} + +func (x *reqGetEntityGetCtxCollision) SetCtxNonCompat(value int64) *reqGetEntityGetCtxCollision { + x.Ctx = value + return x +} + +func (x *reqGetEntityGetCtxCollision) SetCtx(value int64) *reqGetEntityGetCtxCollision { + x.Ctx = value + return x +} + +func (x *reqGetEntityGetCtxCollision) writeField1(p thrift.Encoder) error { // Ctx + if err := p.WriteFieldBegin("ctx", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Ctx + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetCtxCollision) readField1(p thrift.Decoder) error { // Ctx + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Ctx = result + return nil +} + +func (x *reqGetEntityGetCtxCollision) toString1() string { // Ctx + return fmt.Sprintf("%v", x.Ctx) +} + + + +func (x *reqGetEntityGetCtxCollision) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqGetEntityGetCtxCollision"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetCtxCollision) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // ctx + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqGetEntityGetCtxCollision) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqGetEntityGetCtxCollision({") + sb.WriteString(fmt.Sprintf("Ctx:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqGetEntityGetCtxCollision) setDefaults() *reqGetEntityGetCtxCollision { + return x. + SetCtxNonCompat(0) +} + +type respGetEntityGetCtxCollision struct { + Success *int32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respGetEntityGetCtxCollision)(nil) +var _ thrift.WritableResult = (*respGetEntityGetCtxCollision)(nil) + +// Deprecated: GetEntityGetCtxCollisionResultDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetCtxCollisionResultDeprecated = respGetEntityGetCtxCollision + +func newRespGetEntityGetCtxCollision() *respGetEntityGetCtxCollision { + return (&respGetEntityGetCtxCollision{}).setDefaults() +} + +func (x *respGetEntityGetCtxCollision) GetSuccess() int32 { + if !x.IsSetSuccess() { + return 0 + } + return *x.Success +} + +func (x *respGetEntityGetCtxCollision) SetSuccessNonCompat(value int32) *respGetEntityGetCtxCollision { + x.Success = &value + return x +} + +func (x *respGetEntityGetCtxCollision) SetSuccess(value *int32) *respGetEntityGetCtxCollision { + x.Success = value + return x +} + +func (x *respGetEntityGetCtxCollision) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respGetEntityGetCtxCollision) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteI32(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetCtxCollision) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadI32() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respGetEntityGetCtxCollision) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respGetEntityGetCtxCollision) Exception() thrift.WritableException { + return nil +} + +func (x *respGetEntityGetCtxCollision) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respGetEntityGetCtxCollision"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetCtxCollision) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.I32)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respGetEntityGetCtxCollision) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respGetEntityGetCtxCollision({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respGetEntityGetCtxCollision) setDefaults() *respGetEntityGetCtxCollision { + return x +} + +type reqGetEntityGetCtx1Collision struct { + Ctx int64 `thrift:"ctx,1" json:"ctx" db:"ctx"` + Ctx1 int64 `thrift:"ctx1,2" json:"ctx1" db:"ctx1"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqGetEntityGetCtx1Collision)(nil) + +// Deprecated: GetEntityGetCtx1CollisionArgsDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetCtx1CollisionArgsDeprecated = reqGetEntityGetCtx1Collision + +func newReqGetEntityGetCtx1Collision() *reqGetEntityGetCtx1Collision { + return (&reqGetEntityGetCtx1Collision{}).setDefaults() +} + +func (x *reqGetEntityGetCtx1Collision) GetCtx() int64 { + return x.Ctx +} + +func (x *reqGetEntityGetCtx1Collision) GetCtx1() int64 { + return x.Ctx1 +} + +func (x *reqGetEntityGetCtx1Collision) SetCtxNonCompat(value int64) *reqGetEntityGetCtx1Collision { + x.Ctx = value + return x +} + +func (x *reqGetEntityGetCtx1Collision) SetCtx(value int64) *reqGetEntityGetCtx1Collision { + x.Ctx = value + return x +} + +func (x *reqGetEntityGetCtx1Collision) SetCtx1NonCompat(value int64) *reqGetEntityGetCtx1Collision { + x.Ctx1 = value + return x +} + +func (x *reqGetEntityGetCtx1Collision) SetCtx1(value int64) *reqGetEntityGetCtx1Collision { + x.Ctx1 = value + return x +} + +func (x *reqGetEntityGetCtx1Collision) writeField1(p thrift.Encoder) error { // Ctx + if err := p.WriteFieldBegin("ctx", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Ctx + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetCtx1Collision) writeField2(p thrift.Encoder) error { // Ctx1 + if err := p.WriteFieldBegin("ctx1", thrift.I64, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Ctx1 + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetCtx1Collision) readField1(p thrift.Decoder) error { // Ctx + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Ctx = result + return nil +} + +func (x *reqGetEntityGetCtx1Collision) readField2(p thrift.Decoder) error { // Ctx1 + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Ctx1 = result + return nil +} + +func (x *reqGetEntityGetCtx1Collision) toString1() string { // Ctx + return fmt.Sprintf("%v", x.Ctx) +} + +func (x *reqGetEntityGetCtx1Collision) toString2() string { // Ctx1 + return fmt.Sprintf("%v", x.Ctx1) +} + + + +func (x *reqGetEntityGetCtx1Collision) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqGetEntityGetCtx1Collision"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + if err := x.writeField2(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetCtx1Collision) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // ctx + fieldReadErr = x.readField1(p) + case (id == 2 && wireType == thrift.Type(thrift.I64)): // ctx1 + fieldReadErr = x.readField2(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqGetEntityGetCtx1Collision) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqGetEntityGetCtx1Collision({") + sb.WriteString(fmt.Sprintf("Ctx:%s ", x.toString1())) + sb.WriteString(fmt.Sprintf("Ctx1:%s", x.toString2())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqGetEntityGetCtx1Collision) setDefaults() *reqGetEntityGetCtx1Collision { + return x. + SetCtxNonCompat(0). + SetCtx1NonCompat(0) +} + +type respGetEntityGetCtx1Collision struct { + Success *int32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respGetEntityGetCtx1Collision)(nil) +var _ thrift.WritableResult = (*respGetEntityGetCtx1Collision)(nil) + +// Deprecated: GetEntityGetCtx1CollisionResultDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetCtx1CollisionResultDeprecated = respGetEntityGetCtx1Collision + +func newRespGetEntityGetCtx1Collision() *respGetEntityGetCtx1Collision { + return (&respGetEntityGetCtx1Collision{}).setDefaults() +} + +func (x *respGetEntityGetCtx1Collision) GetSuccess() int32 { + if !x.IsSetSuccess() { + return 0 + } + return *x.Success +} + +func (x *respGetEntityGetCtx1Collision) SetSuccessNonCompat(value int32) *respGetEntityGetCtx1Collision { + x.Success = &value + return x +} + +func (x *respGetEntityGetCtx1Collision) SetSuccess(value *int32) *respGetEntityGetCtx1Collision { + x.Success = value + return x +} + +func (x *respGetEntityGetCtx1Collision) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respGetEntityGetCtx1Collision) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteI32(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetCtx1Collision) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadI32() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respGetEntityGetCtx1Collision) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respGetEntityGetCtx1Collision) Exception() thrift.WritableException { + return nil +} + +func (x *respGetEntityGetCtx1Collision) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respGetEntityGetCtx1Collision"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetCtx1Collision) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.I32)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respGetEntityGetCtx1Collision) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respGetEntityGetCtx1Collision({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respGetEntityGetCtx1Collision) setDefaults() *respGetEntityGetCtx1Collision { + return x +} + +type reqGetEntityGetContextCollision struct { + Context int64 `thrift:"context,1" json:"context" db:"context"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqGetEntityGetContextCollision)(nil) + +// Deprecated: GetEntityGetContextCollisionArgsDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetContextCollisionArgsDeprecated = reqGetEntityGetContextCollision + +func newReqGetEntityGetContextCollision() *reqGetEntityGetContextCollision { + return (&reqGetEntityGetContextCollision{}).setDefaults() +} + +func (x *reqGetEntityGetContextCollision) GetContext() int64 { + return x.Context +} + +func (x *reqGetEntityGetContextCollision) SetContextNonCompat(value int64) *reqGetEntityGetContextCollision { + x.Context = value + return x +} + +func (x *reqGetEntityGetContextCollision) SetContext(value int64) *reqGetEntityGetContextCollision { + x.Context = value + return x +} + +func (x *reqGetEntityGetContextCollision) writeField1(p thrift.Encoder) error { // Context + if err := p.WriteFieldBegin("context", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Context + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetContextCollision) readField1(p thrift.Decoder) error { // Context + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Context = result + return nil +} + +func (x *reqGetEntityGetContextCollision) toString1() string { // Context + return fmt.Sprintf("%v", x.Context) +} + + + +func (x *reqGetEntityGetContextCollision) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqGetEntityGetContextCollision"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetContextCollision) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // context + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqGetEntityGetContextCollision) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqGetEntityGetContextCollision({") + sb.WriteString(fmt.Sprintf("Context:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqGetEntityGetContextCollision) setDefaults() *reqGetEntityGetContextCollision { + return x. + SetContextNonCompat(0) +} + +type respGetEntityGetContextCollision struct { + Success *int32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respGetEntityGetContextCollision)(nil) +var _ thrift.WritableResult = (*respGetEntityGetContextCollision)(nil) + +// Deprecated: GetEntityGetContextCollisionResultDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetContextCollisionResultDeprecated = respGetEntityGetContextCollision + +func newRespGetEntityGetContextCollision() *respGetEntityGetContextCollision { + return (&respGetEntityGetContextCollision{}).setDefaults() +} + +func (x *respGetEntityGetContextCollision) GetSuccess() int32 { + if !x.IsSetSuccess() { + return 0 + } + return *x.Success +} + +func (x *respGetEntityGetContextCollision) SetSuccessNonCompat(value int32) *respGetEntityGetContextCollision { + x.Success = &value + return x +} + +func (x *respGetEntityGetContextCollision) SetSuccess(value *int32) *respGetEntityGetContextCollision { + x.Success = value + return x +} + +func (x *respGetEntityGetContextCollision) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respGetEntityGetContextCollision) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteI32(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetContextCollision) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadI32() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respGetEntityGetContextCollision) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respGetEntityGetContextCollision) Exception() thrift.WritableException { + return nil +} + +func (x *respGetEntityGetContextCollision) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respGetEntityGetContextCollision"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetContextCollision) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.I32)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respGetEntityGetContextCollision) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respGetEntityGetContextCollision({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respGetEntityGetContextCollision) setDefaults() *respGetEntityGetContextCollision { + return x +} + +type reqGetEntityGetOutCollision struct { + Out int64 `thrift:"out,1" json:"out" db:"out"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqGetEntityGetOutCollision)(nil) + +// Deprecated: GetEntityGetOutCollisionArgsDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetOutCollisionArgsDeprecated = reqGetEntityGetOutCollision + +func newReqGetEntityGetOutCollision() *reqGetEntityGetOutCollision { + return (&reqGetEntityGetOutCollision{}).setDefaults() +} + +func (x *reqGetEntityGetOutCollision) GetOut() int64 { + return x.Out +} + +func (x *reqGetEntityGetOutCollision) SetOutNonCompat(value int64) *reqGetEntityGetOutCollision { + x.Out = value + return x +} + +func (x *reqGetEntityGetOutCollision) SetOut(value int64) *reqGetEntityGetOutCollision { + x.Out = value + return x +} + +func (x *reqGetEntityGetOutCollision) writeField1(p thrift.Encoder) error { // Out + if err := p.WriteFieldBegin("out", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Out + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetOutCollision) readField1(p thrift.Decoder) error { // Out + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Out = result + return nil +} + +func (x *reqGetEntityGetOutCollision) toString1() string { // Out + return fmt.Sprintf("%v", x.Out) +} + + + +func (x *reqGetEntityGetOutCollision) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqGetEntityGetOutCollision"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetOutCollision) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // out + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqGetEntityGetOutCollision) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqGetEntityGetOutCollision({") + sb.WriteString(fmt.Sprintf("Out:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqGetEntityGetOutCollision) setDefaults() *reqGetEntityGetOutCollision { + return x. + SetOutNonCompat(0) +} + +type respGetEntityGetOutCollision struct { + Success *int32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respGetEntityGetOutCollision)(nil) +var _ thrift.WritableResult = (*respGetEntityGetOutCollision)(nil) + +// Deprecated: GetEntityGetOutCollisionResultDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetOutCollisionResultDeprecated = respGetEntityGetOutCollision + +func newRespGetEntityGetOutCollision() *respGetEntityGetOutCollision { + return (&respGetEntityGetOutCollision{}).setDefaults() +} + +func (x *respGetEntityGetOutCollision) GetSuccess() int32 { + if !x.IsSetSuccess() { + return 0 + } + return *x.Success +} + +func (x *respGetEntityGetOutCollision) SetSuccessNonCompat(value int32) *respGetEntityGetOutCollision { + x.Success = &value + return x +} + +func (x *respGetEntityGetOutCollision) SetSuccess(value *int32) *respGetEntityGetOutCollision { + x.Success = value + return x +} + +func (x *respGetEntityGetOutCollision) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respGetEntityGetOutCollision) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteI32(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetOutCollision) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadI32() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respGetEntityGetOutCollision) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respGetEntityGetOutCollision) Exception() thrift.WritableException { + return nil +} + +func (x *respGetEntityGetOutCollision) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respGetEntityGetOutCollision"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetOutCollision) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.I32)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respGetEntityGetOutCollision) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respGetEntityGetOutCollision({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respGetEntityGetOutCollision) setDefaults() *respGetEntityGetOutCollision { + return x +} + +type reqGetEntityGetOut1Collision struct { + Out int64 `thrift:"out,1" json:"out" db:"out"` + Out1 int64 `thrift:"out1,2" json:"out1" db:"out1"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqGetEntityGetOut1Collision)(nil) + +// Deprecated: GetEntityGetOut1CollisionArgsDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetOut1CollisionArgsDeprecated = reqGetEntityGetOut1Collision + +func newReqGetEntityGetOut1Collision() *reqGetEntityGetOut1Collision { + return (&reqGetEntityGetOut1Collision{}).setDefaults() +} + +func (x *reqGetEntityGetOut1Collision) GetOut() int64 { + return x.Out +} + +func (x *reqGetEntityGetOut1Collision) GetOut1() int64 { + return x.Out1 +} + +func (x *reqGetEntityGetOut1Collision) SetOutNonCompat(value int64) *reqGetEntityGetOut1Collision { + x.Out = value + return x +} + +func (x *reqGetEntityGetOut1Collision) SetOut(value int64) *reqGetEntityGetOut1Collision { + x.Out = value + return x +} + +func (x *reqGetEntityGetOut1Collision) SetOut1NonCompat(value int64) *reqGetEntityGetOut1Collision { + x.Out1 = value + return x +} + +func (x *reqGetEntityGetOut1Collision) SetOut1(value int64) *reqGetEntityGetOut1Collision { + x.Out1 = value + return x +} + +func (x *reqGetEntityGetOut1Collision) writeField1(p thrift.Encoder) error { // Out + if err := p.WriteFieldBegin("out", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Out + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetOut1Collision) writeField2(p thrift.Encoder) error { // Out1 + if err := p.WriteFieldBegin("out1", thrift.I64, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Out1 + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetOut1Collision) readField1(p thrift.Decoder) error { // Out + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Out = result + return nil +} + +func (x *reqGetEntityGetOut1Collision) readField2(p thrift.Decoder) error { // Out1 + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Out1 = result + return nil +} + +func (x *reqGetEntityGetOut1Collision) toString1() string { // Out + return fmt.Sprintf("%v", x.Out) +} + +func (x *reqGetEntityGetOut1Collision) toString2() string { // Out1 + return fmt.Sprintf("%v", x.Out1) +} + + + +func (x *reqGetEntityGetOut1Collision) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqGetEntityGetOut1Collision"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + if err := x.writeField2(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetOut1Collision) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // out + fieldReadErr = x.readField1(p) + case (id == 2 && wireType == thrift.Type(thrift.I64)): // out1 + fieldReadErr = x.readField2(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqGetEntityGetOut1Collision) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqGetEntityGetOut1Collision({") + sb.WriteString(fmt.Sprintf("Out:%s ", x.toString1())) + sb.WriteString(fmt.Sprintf("Out1:%s", x.toString2())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqGetEntityGetOut1Collision) setDefaults() *reqGetEntityGetOut1Collision { + return x. + SetOutNonCompat(0). + SetOut1NonCompat(0) +} + +type respGetEntityGetOut1Collision struct { + Success *int32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respGetEntityGetOut1Collision)(nil) +var _ thrift.WritableResult = (*respGetEntityGetOut1Collision)(nil) + +// Deprecated: GetEntityGetOut1CollisionResultDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetOut1CollisionResultDeprecated = respGetEntityGetOut1Collision + +func newRespGetEntityGetOut1Collision() *respGetEntityGetOut1Collision { + return (&respGetEntityGetOut1Collision{}).setDefaults() +} + +func (x *respGetEntityGetOut1Collision) GetSuccess() int32 { + if !x.IsSetSuccess() { + return 0 + } + return *x.Success +} + +func (x *respGetEntityGetOut1Collision) SetSuccessNonCompat(value int32) *respGetEntityGetOut1Collision { + x.Success = &value + return x +} + +func (x *respGetEntityGetOut1Collision) SetSuccess(value *int32) *respGetEntityGetOut1Collision { + x.Success = value + return x +} + +func (x *respGetEntityGetOut1Collision) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respGetEntityGetOut1Collision) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteI32(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetOut1Collision) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadI32() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respGetEntityGetOut1Collision) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respGetEntityGetOut1Collision) Exception() thrift.WritableException { + return nil +} + +func (x *respGetEntityGetOut1Collision) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respGetEntityGetOut1Collision"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetOut1Collision) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.I32)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respGetEntityGetOut1Collision) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respGetEntityGetOut1Collision({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respGetEntityGetOut1Collision) setDefaults() *respGetEntityGetOut1Collision { + return x +} + +type reqGetEntityGetInCollision struct { + In int64 `thrift:"in,1" json:"in" db:"in"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqGetEntityGetInCollision)(nil) + +// Deprecated: GetEntityGetInCollisionArgsDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetInCollisionArgsDeprecated = reqGetEntityGetInCollision + +func newReqGetEntityGetInCollision() *reqGetEntityGetInCollision { + return (&reqGetEntityGetInCollision{}).setDefaults() +} + +func (x *reqGetEntityGetInCollision) GetIn() int64 { + return x.In +} + +func (x *reqGetEntityGetInCollision) SetInNonCompat(value int64) *reqGetEntityGetInCollision { + x.In = value + return x +} + +func (x *reqGetEntityGetInCollision) SetIn(value int64) *reqGetEntityGetInCollision { + x.In = value + return x +} + +func (x *reqGetEntityGetInCollision) writeField1(p thrift.Encoder) error { // In + if err := p.WriteFieldBegin("in", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.In + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetInCollision) readField1(p thrift.Decoder) error { // In + result, err := p.ReadI64() +if err != nil { + return err +} + + x.In = result + return nil +} + +func (x *reqGetEntityGetInCollision) toString1() string { // In + return fmt.Sprintf("%v", x.In) +} + + + +func (x *reqGetEntityGetInCollision) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqGetEntityGetInCollision"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetInCollision) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // in + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqGetEntityGetInCollision) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqGetEntityGetInCollision({") + sb.WriteString(fmt.Sprintf("In:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqGetEntityGetInCollision) setDefaults() *reqGetEntityGetInCollision { + return x. + SetInNonCompat(0) +} + +type respGetEntityGetInCollision struct { + Success *int32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respGetEntityGetInCollision)(nil) +var _ thrift.WritableResult = (*respGetEntityGetInCollision)(nil) + +// Deprecated: GetEntityGetInCollisionResultDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetInCollisionResultDeprecated = respGetEntityGetInCollision + +func newRespGetEntityGetInCollision() *respGetEntityGetInCollision { + return (&respGetEntityGetInCollision{}).setDefaults() +} + +func (x *respGetEntityGetInCollision) GetSuccess() int32 { + if !x.IsSetSuccess() { + return 0 + } + return *x.Success +} + +func (x *respGetEntityGetInCollision) SetSuccessNonCompat(value int32) *respGetEntityGetInCollision { + x.Success = &value + return x +} + +func (x *respGetEntityGetInCollision) SetSuccess(value *int32) *respGetEntityGetInCollision { + x.Success = value + return x +} + +func (x *respGetEntityGetInCollision) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respGetEntityGetInCollision) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteI32(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetInCollision) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadI32() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respGetEntityGetInCollision) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respGetEntityGetInCollision) Exception() thrift.WritableException { + return nil +} + +func (x *respGetEntityGetInCollision) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respGetEntityGetInCollision"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetInCollision) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.I32)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respGetEntityGetInCollision) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respGetEntityGetInCollision({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respGetEntityGetInCollision) setDefaults() *respGetEntityGetInCollision { + return x +} + +type reqGetEntityGetIn1Collision struct { + In int64 `thrift:"in,1" json:"in" db:"in"` + In1 int64 `thrift:"in1,2" json:"in1" db:"in1"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqGetEntityGetIn1Collision)(nil) + +// Deprecated: GetEntityGetIn1CollisionArgsDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetIn1CollisionArgsDeprecated = reqGetEntityGetIn1Collision + +func newReqGetEntityGetIn1Collision() *reqGetEntityGetIn1Collision { + return (&reqGetEntityGetIn1Collision{}).setDefaults() +} + +func (x *reqGetEntityGetIn1Collision) GetIn() int64 { + return x.In +} + +func (x *reqGetEntityGetIn1Collision) GetIn1() int64 { + return x.In1 +} + +func (x *reqGetEntityGetIn1Collision) SetInNonCompat(value int64) *reqGetEntityGetIn1Collision { + x.In = value + return x +} + +func (x *reqGetEntityGetIn1Collision) SetIn(value int64) *reqGetEntityGetIn1Collision { + x.In = value + return x +} + +func (x *reqGetEntityGetIn1Collision) SetIn1NonCompat(value int64) *reqGetEntityGetIn1Collision { + x.In1 = value + return x +} + +func (x *reqGetEntityGetIn1Collision) SetIn1(value int64) *reqGetEntityGetIn1Collision { + x.In1 = value + return x +} + +func (x *reqGetEntityGetIn1Collision) writeField1(p thrift.Encoder) error { // In + if err := p.WriteFieldBegin("in", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.In + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetIn1Collision) writeField2(p thrift.Encoder) error { // In1 + if err := p.WriteFieldBegin("in1", thrift.I64, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.In1 + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetIn1Collision) readField1(p thrift.Decoder) error { // In + result, err := p.ReadI64() +if err != nil { + return err +} + + x.In = result + return nil +} + +func (x *reqGetEntityGetIn1Collision) readField2(p thrift.Decoder) error { // In1 + result, err := p.ReadI64() +if err != nil { + return err +} + + x.In1 = result + return nil +} + +func (x *reqGetEntityGetIn1Collision) toString1() string { // In + return fmt.Sprintf("%v", x.In) +} + +func (x *reqGetEntityGetIn1Collision) toString2() string { // In1 + return fmt.Sprintf("%v", x.In1) +} + + + +func (x *reqGetEntityGetIn1Collision) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqGetEntityGetIn1Collision"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + if err := x.writeField2(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetIn1Collision) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // in + fieldReadErr = x.readField1(p) + case (id == 2 && wireType == thrift.Type(thrift.I64)): // in1 + fieldReadErr = x.readField2(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqGetEntityGetIn1Collision) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqGetEntityGetIn1Collision({") + sb.WriteString(fmt.Sprintf("In:%s ", x.toString1())) + sb.WriteString(fmt.Sprintf("In1:%s", x.toString2())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqGetEntityGetIn1Collision) setDefaults() *reqGetEntityGetIn1Collision { + return x. + SetInNonCompat(0). + SetIn1NonCompat(0) +} + +type respGetEntityGetIn1Collision struct { + Success *int32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respGetEntityGetIn1Collision)(nil) +var _ thrift.WritableResult = (*respGetEntityGetIn1Collision)(nil) + +// Deprecated: GetEntityGetIn1CollisionResultDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetIn1CollisionResultDeprecated = respGetEntityGetIn1Collision + +func newRespGetEntityGetIn1Collision() *respGetEntityGetIn1Collision { + return (&respGetEntityGetIn1Collision{}).setDefaults() +} + +func (x *respGetEntityGetIn1Collision) GetSuccess() int32 { + if !x.IsSetSuccess() { + return 0 + } + return *x.Success +} + +func (x *respGetEntityGetIn1Collision) SetSuccessNonCompat(value int32) *respGetEntityGetIn1Collision { + x.Success = &value + return x +} + +func (x *respGetEntityGetIn1Collision) SetSuccess(value *int32) *respGetEntityGetIn1Collision { + x.Success = value + return x +} + +func (x *respGetEntityGetIn1Collision) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respGetEntityGetIn1Collision) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteI32(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetIn1Collision) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadI32() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respGetEntityGetIn1Collision) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respGetEntityGetIn1Collision) Exception() thrift.WritableException { + return nil +} + +func (x *respGetEntityGetIn1Collision) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respGetEntityGetIn1Collision"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetIn1Collision) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.I32)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respGetEntityGetIn1Collision) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respGetEntityGetIn1Collision({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respGetEntityGetIn1Collision) setDefaults() *respGetEntityGetIn1Collision { + return x +} + +type reqGetEntityGetErrCollision struct { + Err int64 `thrift:"err,1" json:"err" db:"err"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqGetEntityGetErrCollision)(nil) + +// Deprecated: GetEntityGetErrCollisionArgsDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetErrCollisionArgsDeprecated = reqGetEntityGetErrCollision + +func newReqGetEntityGetErrCollision() *reqGetEntityGetErrCollision { + return (&reqGetEntityGetErrCollision{}).setDefaults() +} + +func (x *reqGetEntityGetErrCollision) GetErr() int64 { + return x.Err +} + +func (x *reqGetEntityGetErrCollision) SetErrNonCompat(value int64) *reqGetEntityGetErrCollision { + x.Err = value + return x +} + +func (x *reqGetEntityGetErrCollision) SetErr(value int64) *reqGetEntityGetErrCollision { + x.Err = value + return x +} + +func (x *reqGetEntityGetErrCollision) writeField1(p thrift.Encoder) error { // Err + if err := p.WriteFieldBegin("err", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Err + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetErrCollision) readField1(p thrift.Decoder) error { // Err + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Err = result + return nil +} + +func (x *reqGetEntityGetErrCollision) toString1() string { // Err + return fmt.Sprintf("%v", x.Err) +} + + + +func (x *reqGetEntityGetErrCollision) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqGetEntityGetErrCollision"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetErrCollision) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // err + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqGetEntityGetErrCollision) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqGetEntityGetErrCollision({") + sb.WriteString(fmt.Sprintf("Err:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqGetEntityGetErrCollision) setDefaults() *reqGetEntityGetErrCollision { + return x. + SetErrNonCompat(0) +} + +type respGetEntityGetErrCollision struct { + Success *int32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respGetEntityGetErrCollision)(nil) +var _ thrift.WritableResult = (*respGetEntityGetErrCollision)(nil) + +// Deprecated: GetEntityGetErrCollisionResultDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetErrCollisionResultDeprecated = respGetEntityGetErrCollision + +func newRespGetEntityGetErrCollision() *respGetEntityGetErrCollision { + return (&respGetEntityGetErrCollision{}).setDefaults() +} + +func (x *respGetEntityGetErrCollision) GetSuccess() int32 { + if !x.IsSetSuccess() { + return 0 + } + return *x.Success +} + +func (x *respGetEntityGetErrCollision) SetSuccessNonCompat(value int32) *respGetEntityGetErrCollision { + x.Success = &value + return x +} + +func (x *respGetEntityGetErrCollision) SetSuccess(value *int32) *respGetEntityGetErrCollision { + x.Success = value + return x +} + +func (x *respGetEntityGetErrCollision) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respGetEntityGetErrCollision) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteI32(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetErrCollision) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadI32() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respGetEntityGetErrCollision) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respGetEntityGetErrCollision) Exception() thrift.WritableException { + return nil +} + +func (x *respGetEntityGetErrCollision) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respGetEntityGetErrCollision"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetErrCollision) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.I32)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respGetEntityGetErrCollision) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respGetEntityGetErrCollision({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respGetEntityGetErrCollision) setDefaults() *respGetEntityGetErrCollision { + return x +} + +type reqGetEntityGetErr1Collision struct { + Err int64 `thrift:"err,1" json:"err" db:"err"` + Err1 int64 `thrift:"err1,2" json:"err1" db:"err1"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqGetEntityGetErr1Collision)(nil) + +// Deprecated: GetEntityGetErr1CollisionArgsDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetErr1CollisionArgsDeprecated = reqGetEntityGetErr1Collision + +func newReqGetEntityGetErr1Collision() *reqGetEntityGetErr1Collision { + return (&reqGetEntityGetErr1Collision{}).setDefaults() +} + +func (x *reqGetEntityGetErr1Collision) GetErr() int64 { + return x.Err +} + +func (x *reqGetEntityGetErr1Collision) GetErr1() int64 { + return x.Err1 +} + +func (x *reqGetEntityGetErr1Collision) SetErrNonCompat(value int64) *reqGetEntityGetErr1Collision { + x.Err = value + return x +} + +func (x *reqGetEntityGetErr1Collision) SetErr(value int64) *reqGetEntityGetErr1Collision { + x.Err = value + return x +} + +func (x *reqGetEntityGetErr1Collision) SetErr1NonCompat(value int64) *reqGetEntityGetErr1Collision { + x.Err1 = value + return x +} + +func (x *reqGetEntityGetErr1Collision) SetErr1(value int64) *reqGetEntityGetErr1Collision { + x.Err1 = value + return x +} + +func (x *reqGetEntityGetErr1Collision) writeField1(p thrift.Encoder) error { // Err + if err := p.WriteFieldBegin("err", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Err + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetErr1Collision) writeField2(p thrift.Encoder) error { // Err1 + if err := p.WriteFieldBegin("err1", thrift.I64, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Err1 + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetErr1Collision) readField1(p thrift.Decoder) error { // Err + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Err = result + return nil +} + +func (x *reqGetEntityGetErr1Collision) readField2(p thrift.Decoder) error { // Err1 + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Err1 = result + return nil +} + +func (x *reqGetEntityGetErr1Collision) toString1() string { // Err + return fmt.Sprintf("%v", x.Err) +} + +func (x *reqGetEntityGetErr1Collision) toString2() string { // Err1 + return fmt.Sprintf("%v", x.Err1) +} + + + +func (x *reqGetEntityGetErr1Collision) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqGetEntityGetErr1Collision"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + if err := x.writeField2(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqGetEntityGetErr1Collision) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // err + fieldReadErr = x.readField1(p) + case (id == 2 && wireType == thrift.Type(thrift.I64)): // err1 + fieldReadErr = x.readField2(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqGetEntityGetErr1Collision) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqGetEntityGetErr1Collision({") + sb.WriteString(fmt.Sprintf("Err:%s ", x.toString1())) + sb.WriteString(fmt.Sprintf("Err1:%s", x.toString2())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqGetEntityGetErr1Collision) setDefaults() *reqGetEntityGetErr1Collision { + return x. + SetErrNonCompat(0). + SetErr1NonCompat(0) +} + +type respGetEntityGetErr1Collision struct { + Success *int32 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respGetEntityGetErr1Collision)(nil) +var _ thrift.WritableResult = (*respGetEntityGetErr1Collision)(nil) + +// Deprecated: GetEntityGetErr1CollisionResultDeprecated is deprecated, since it is supposed to be internal. +type GetEntityGetErr1CollisionResultDeprecated = respGetEntityGetErr1Collision + +func newRespGetEntityGetErr1Collision() *respGetEntityGetErr1Collision { + return (&respGetEntityGetErr1Collision{}).setDefaults() +} + +func (x *respGetEntityGetErr1Collision) GetSuccess() int32 { + if !x.IsSetSuccess() { + return 0 + } + return *x.Success +} + +func (x *respGetEntityGetErr1Collision) SetSuccessNonCompat(value int32) *respGetEntityGetErr1Collision { + x.Success = &value + return x +} + +func (x *respGetEntityGetErr1Collision) SetSuccess(value *int32) *respGetEntityGetErr1Collision { + x.Success = value + return x +} + +func (x *respGetEntityGetErr1Collision) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respGetEntityGetErr1Collision) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.I32, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteI32(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetErr1Collision) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadI32() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respGetEntityGetErr1Collision) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respGetEntityGetErr1Collision) Exception() thrift.WritableException { + return nil +} + +func (x *respGetEntityGetErr1Collision) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respGetEntityGetErr1Collision"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respGetEntityGetErr1Collision) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.I32)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respGetEntityGetErr1Collision) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respGetEntityGetErr1Collision({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respGetEntityGetErr1Collision) setDefaults() *respGetEntityGetErr1Collision { + return x +} + + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/go-typedef/out/go_module0/gen-go/module0/types.go b/thrift/compiler/test/fixtures/go-typedef/out/go_module0/gen-go/module0/types.go index a880513d17f..d0471db500d 100644 --- a/thrift/compiler/test/fixtures/go-typedef/out/go_module0/gen-go/module0/types.go +++ b/thrift/compiler/test/fixtures/go-typedef/out/go_module0/gen-go/module0/types.go @@ -388,6 +388,7 @@ func (x *PartName) setDefaults() *PartName { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module0/types.go b/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module0/types.go index 7744f5fd30d..9bc41b03b85 100644 --- a/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module0/types.go +++ b/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module0/types.go @@ -388,6 +388,7 @@ func (x *PartName) setDefaults() *PartName { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module1/svcs.go b/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module1/svcs.go index ac8abb760cc..8f8ab9b9f19 100644 --- a/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module1/svcs.go +++ b/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module1/svcs.go @@ -148,888 +148,6 @@ func (c *FinderClient) PreviousPlateContext(ctx context.Context, plate Plate) (P return c.chClient.PreviousPlate(ctx, plate) } -type reqFinderByPlate struct { - Plate Plate `thrift:"plate,1" json:"plate" db:"plate"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqFinderByPlate)(nil) - -// Deprecated: FinderByPlateArgsDeprecated is deprecated, since it is supposed to be internal. -type FinderByPlateArgsDeprecated = reqFinderByPlate - -func newReqFinderByPlate() *reqFinderByPlate { - return (&reqFinderByPlate{}).setDefaults() -} - -func (x *reqFinderByPlate) GetPlate() Plate { - return x.Plate -} - -func (x *reqFinderByPlate) SetPlateNonCompat(value Plate) *reqFinderByPlate { - x.Plate = value - return x -} - -func (x *reqFinderByPlate) SetPlate(value Plate) *reqFinderByPlate { - x.Plate = value - return x -} - -func (x *reqFinderByPlate) writeField1(p thrift.Encoder) error { // Plate - if err := p.WriteFieldBegin("plate", thrift.STRING, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Plate - err := WritePlate(item, p) -if err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqFinderByPlate) readField1(p thrift.Decoder) error { // Plate - result, err := ReadPlate(p) -if err != nil { - return err -} - - x.Plate = result - return nil -} - -func (x *reqFinderByPlate) toString1() string { // Plate - return fmt.Sprintf("%v", x.Plate) -} - - - -func (x *reqFinderByPlate) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqFinderByPlate"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqFinderByPlate) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.STRING)): // plate - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqFinderByPlate) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqFinderByPlate({") - sb.WriteString(fmt.Sprintf("Plate:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqFinderByPlate) setDefaults() *reqFinderByPlate { - return x. - SetPlateNonCompat(NewPlate()) -} - -type respFinderByPlate struct { - Success *Automobile `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respFinderByPlate)(nil) -var _ thrift.WritableResult = (*respFinderByPlate)(nil) - -// Deprecated: FinderByPlateResultDeprecated is deprecated, since it is supposed to be internal. -type FinderByPlateResultDeprecated = respFinderByPlate - -func newRespFinderByPlate() *respFinderByPlate { - return (&respFinderByPlate{}).setDefaults() -} - -func (x *respFinderByPlate) GetSuccess() *Automobile { - if !x.IsSetSuccess() { - return nil - } - return x.Success -} - -func (x *respFinderByPlate) SetSuccessNonCompat(value *Automobile) *respFinderByPlate { - x.Success = value - return x -} - -func (x *respFinderByPlate) SetSuccess(value *Automobile) *respFinderByPlate { - x.Success = value - return x -} - -func (x *respFinderByPlate) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respFinderByPlate) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Success - if err := item.Write(p); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respFinderByPlate) readField0(p thrift.Decoder) error { // Success - result := NewAutomobile() -err := result.Read(p) -if err != nil { - return err -} - - x.Success = result - return nil -} - -func (x *respFinderByPlate) toString0() string { // Success - return fmt.Sprintf("%v", x.Success) -} - -// Deprecated: Use newRespFinderByPlate().GetSuccess() instead. -func (x *respFinderByPlate) DefaultGetSuccess() *Automobile { - if !x.IsSetSuccess() { - return NewAutomobile() - } - return x.Success -} - - - -func (x *respFinderByPlate) Exception() thrift.WritableException { - return nil -} - -func (x *respFinderByPlate) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respFinderByPlate"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respFinderByPlate) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.STRUCT)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respFinderByPlate) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respFinderByPlate({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respFinderByPlate) setDefaults() *respFinderByPlate { - return x -} - -type reqFinderAliasByPlate struct { - Plate Plate `thrift:"plate,1" json:"plate" db:"plate"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqFinderAliasByPlate)(nil) - -// Deprecated: FinderAliasByPlateArgsDeprecated is deprecated, since it is supposed to be internal. -type FinderAliasByPlateArgsDeprecated = reqFinderAliasByPlate - -func newReqFinderAliasByPlate() *reqFinderAliasByPlate { - return (&reqFinderAliasByPlate{}).setDefaults() -} - -func (x *reqFinderAliasByPlate) GetPlate() Plate { - return x.Plate -} - -func (x *reqFinderAliasByPlate) SetPlateNonCompat(value Plate) *reqFinderAliasByPlate { - x.Plate = value - return x -} - -func (x *reqFinderAliasByPlate) SetPlate(value Plate) *reqFinderAliasByPlate { - x.Plate = value - return x -} - -func (x *reqFinderAliasByPlate) writeField1(p thrift.Encoder) error { // Plate - if err := p.WriteFieldBegin("plate", thrift.STRING, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Plate - err := WritePlate(item, p) -if err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqFinderAliasByPlate) readField1(p thrift.Decoder) error { // Plate - result, err := ReadPlate(p) -if err != nil { - return err -} - - x.Plate = result - return nil -} - -func (x *reqFinderAliasByPlate) toString1() string { // Plate - return fmt.Sprintf("%v", x.Plate) -} - - - -func (x *reqFinderAliasByPlate) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqFinderAliasByPlate"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqFinderAliasByPlate) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.STRING)): // plate - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqFinderAliasByPlate) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqFinderAliasByPlate({") - sb.WriteString(fmt.Sprintf("Plate:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqFinderAliasByPlate) setDefaults() *reqFinderAliasByPlate { - return x. - SetPlateNonCompat(NewPlate()) -} - -type respFinderAliasByPlate struct { - Success *Car `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respFinderAliasByPlate)(nil) -var _ thrift.WritableResult = (*respFinderAliasByPlate)(nil) - -// Deprecated: FinderAliasByPlateResultDeprecated is deprecated, since it is supposed to be internal. -type FinderAliasByPlateResultDeprecated = respFinderAliasByPlate - -func newRespFinderAliasByPlate() *respFinderAliasByPlate { - return (&respFinderAliasByPlate{}).setDefaults() -} - -func (x *respFinderAliasByPlate) GetSuccess() *Car { - if !x.IsSetSuccess() { - return nil - } - return x.Success -} - -func (x *respFinderAliasByPlate) SetSuccessNonCompat(value *Car) *respFinderAliasByPlate { - x.Success = value - return x -} - -func (x *respFinderAliasByPlate) SetSuccess(value *Car) *respFinderAliasByPlate { - x.Success = value - return x -} - -func (x *respFinderAliasByPlate) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respFinderAliasByPlate) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Success - err := WriteCar(item, p) -if err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respFinderAliasByPlate) readField0(p thrift.Decoder) error { // Success - result, err := ReadCar(p) -if err != nil { - return err -} - - x.Success = result - return nil -} - -func (x *respFinderAliasByPlate) toString0() string { // Success - return fmt.Sprintf("%v", x.Success) -} - -// Deprecated: Use newRespFinderAliasByPlate().GetSuccess() instead. -func (x *respFinderAliasByPlate) DefaultGetSuccess() *Car { - if !x.IsSetSuccess() { - return NewCar() - } - return x.Success -} - - - -func (x *respFinderAliasByPlate) Exception() thrift.WritableException { - return nil -} - -func (x *respFinderAliasByPlate) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respFinderAliasByPlate"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respFinderAliasByPlate) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.STRUCT)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respFinderAliasByPlate) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respFinderAliasByPlate({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respFinderAliasByPlate) setDefaults() *respFinderAliasByPlate { - return x -} - -type reqFinderPreviousPlate struct { - Plate Plate `thrift:"plate,1" json:"plate" db:"plate"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqFinderPreviousPlate)(nil) - -// Deprecated: FinderPreviousPlateArgsDeprecated is deprecated, since it is supposed to be internal. -type FinderPreviousPlateArgsDeprecated = reqFinderPreviousPlate - -func newReqFinderPreviousPlate() *reqFinderPreviousPlate { - return (&reqFinderPreviousPlate{}).setDefaults() -} - -func (x *reqFinderPreviousPlate) GetPlate() Plate { - return x.Plate -} - -func (x *reqFinderPreviousPlate) SetPlateNonCompat(value Plate) *reqFinderPreviousPlate { - x.Plate = value - return x -} - -func (x *reqFinderPreviousPlate) SetPlate(value Plate) *reqFinderPreviousPlate { - x.Plate = value - return x -} - -func (x *reqFinderPreviousPlate) writeField1(p thrift.Encoder) error { // Plate - if err := p.WriteFieldBegin("plate", thrift.STRING, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Plate - err := WritePlate(item, p) -if err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqFinderPreviousPlate) readField1(p thrift.Decoder) error { // Plate - result, err := ReadPlate(p) -if err != nil { - return err -} - - x.Plate = result - return nil -} - -func (x *reqFinderPreviousPlate) toString1() string { // Plate - return fmt.Sprintf("%v", x.Plate) -} - - - -func (x *reqFinderPreviousPlate) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqFinderPreviousPlate"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqFinderPreviousPlate) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.STRING)): // plate - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqFinderPreviousPlate) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqFinderPreviousPlate({") - sb.WriteString(fmt.Sprintf("Plate:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqFinderPreviousPlate) setDefaults() *reqFinderPreviousPlate { - return x. - SetPlateNonCompat(NewPlate()) -} - -type respFinderPreviousPlate struct { - Success *Plate `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respFinderPreviousPlate)(nil) -var _ thrift.WritableResult = (*respFinderPreviousPlate)(nil) - -// Deprecated: FinderPreviousPlateResultDeprecated is deprecated, since it is supposed to be internal. -type FinderPreviousPlateResultDeprecated = respFinderPreviousPlate - -func newRespFinderPreviousPlate() *respFinderPreviousPlate { - return (&respFinderPreviousPlate{}).setDefaults() -} - -func (x *respFinderPreviousPlate) GetSuccess() Plate { - if !x.IsSetSuccess() { - return NewPlate() - } - return *x.Success -} - -func (x *respFinderPreviousPlate) SetSuccessNonCompat(value Plate) *respFinderPreviousPlate { - x.Success = &value - return x -} - -func (x *respFinderPreviousPlate) SetSuccess(value *Plate) *respFinderPreviousPlate { - x.Success = value - return x -} - -func (x *respFinderPreviousPlate) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respFinderPreviousPlate) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.STRING, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - err := WritePlate(item, p) -if err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respFinderPreviousPlate) readField0(p thrift.Decoder) error { // Success - result, err := ReadPlate(p) -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respFinderPreviousPlate) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respFinderPreviousPlate) Exception() thrift.WritableException { - return nil -} - -func (x *respFinderPreviousPlate) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respFinderPreviousPlate"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respFinderPreviousPlate) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.STRING)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respFinderPreviousPlate) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respFinderPreviousPlate({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respFinderPreviousPlate) setDefaults() *respFinderPreviousPlate { - return x -} - - type FinderProcessor struct { processorFunctionMap map[string]thrift.ProcessorFunction diff --git a/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module1/types.go b/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module1/types.go index 76f95f1ec51..6f50d7288e5 100644 --- a/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module1/types.go +++ b/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module1/types.go @@ -1710,6 +1710,889 @@ func (x *Collection) setDefaults() *Collection { } +// Service req/resp structs (below) +type reqFinderByPlate struct { + Plate Plate `thrift:"plate,1" json:"plate" db:"plate"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqFinderByPlate)(nil) + +// Deprecated: FinderByPlateArgsDeprecated is deprecated, since it is supposed to be internal. +type FinderByPlateArgsDeprecated = reqFinderByPlate + +func newReqFinderByPlate() *reqFinderByPlate { + return (&reqFinderByPlate{}).setDefaults() +} + +func (x *reqFinderByPlate) GetPlate() Plate { + return x.Plate +} + +func (x *reqFinderByPlate) SetPlateNonCompat(value Plate) *reqFinderByPlate { + x.Plate = value + return x +} + +func (x *reqFinderByPlate) SetPlate(value Plate) *reqFinderByPlate { + x.Plate = value + return x +} + +func (x *reqFinderByPlate) writeField1(p thrift.Encoder) error { // Plate + if err := p.WriteFieldBegin("plate", thrift.STRING, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Plate + err := WritePlate(item, p) +if err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqFinderByPlate) readField1(p thrift.Decoder) error { // Plate + result, err := ReadPlate(p) +if err != nil { + return err +} + + x.Plate = result + return nil +} + +func (x *reqFinderByPlate) toString1() string { // Plate + return fmt.Sprintf("%v", x.Plate) +} + + + +func (x *reqFinderByPlate) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqFinderByPlate"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqFinderByPlate) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.STRING)): // plate + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqFinderByPlate) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqFinderByPlate({") + sb.WriteString(fmt.Sprintf("Plate:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqFinderByPlate) setDefaults() *reqFinderByPlate { + return x. + SetPlateNonCompat(NewPlate()) +} + +type respFinderByPlate struct { + Success *Automobile `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respFinderByPlate)(nil) +var _ thrift.WritableResult = (*respFinderByPlate)(nil) + +// Deprecated: FinderByPlateResultDeprecated is deprecated, since it is supposed to be internal. +type FinderByPlateResultDeprecated = respFinderByPlate + +func newRespFinderByPlate() *respFinderByPlate { + return (&respFinderByPlate{}).setDefaults() +} + +func (x *respFinderByPlate) GetSuccess() *Automobile { + if !x.IsSetSuccess() { + return nil + } + return x.Success +} + +func (x *respFinderByPlate) SetSuccessNonCompat(value *Automobile) *respFinderByPlate { + x.Success = value + return x +} + +func (x *respFinderByPlate) SetSuccess(value *Automobile) *respFinderByPlate { + x.Success = value + return x +} + +func (x *respFinderByPlate) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respFinderByPlate) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Success + if err := item.Write(p); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respFinderByPlate) readField0(p thrift.Decoder) error { // Success + result := NewAutomobile() +err := result.Read(p) +if err != nil { + return err +} + + x.Success = result + return nil +} + +func (x *respFinderByPlate) toString0() string { // Success + return fmt.Sprintf("%v", x.Success) +} + +// Deprecated: Use newRespFinderByPlate().GetSuccess() instead. +func (x *respFinderByPlate) DefaultGetSuccess() *Automobile { + if !x.IsSetSuccess() { + return NewAutomobile() + } + return x.Success +} + + + +func (x *respFinderByPlate) Exception() thrift.WritableException { + return nil +} + +func (x *respFinderByPlate) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respFinderByPlate"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respFinderByPlate) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.STRUCT)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respFinderByPlate) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respFinderByPlate({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respFinderByPlate) setDefaults() *respFinderByPlate { + return x +} + +type reqFinderAliasByPlate struct { + Plate Plate `thrift:"plate,1" json:"plate" db:"plate"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqFinderAliasByPlate)(nil) + +// Deprecated: FinderAliasByPlateArgsDeprecated is deprecated, since it is supposed to be internal. +type FinderAliasByPlateArgsDeprecated = reqFinderAliasByPlate + +func newReqFinderAliasByPlate() *reqFinderAliasByPlate { + return (&reqFinderAliasByPlate{}).setDefaults() +} + +func (x *reqFinderAliasByPlate) GetPlate() Plate { + return x.Plate +} + +func (x *reqFinderAliasByPlate) SetPlateNonCompat(value Plate) *reqFinderAliasByPlate { + x.Plate = value + return x +} + +func (x *reqFinderAliasByPlate) SetPlate(value Plate) *reqFinderAliasByPlate { + x.Plate = value + return x +} + +func (x *reqFinderAliasByPlate) writeField1(p thrift.Encoder) error { // Plate + if err := p.WriteFieldBegin("plate", thrift.STRING, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Plate + err := WritePlate(item, p) +if err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqFinderAliasByPlate) readField1(p thrift.Decoder) error { // Plate + result, err := ReadPlate(p) +if err != nil { + return err +} + + x.Plate = result + return nil +} + +func (x *reqFinderAliasByPlate) toString1() string { // Plate + return fmt.Sprintf("%v", x.Plate) +} + + + +func (x *reqFinderAliasByPlate) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqFinderAliasByPlate"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqFinderAliasByPlate) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.STRING)): // plate + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqFinderAliasByPlate) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqFinderAliasByPlate({") + sb.WriteString(fmt.Sprintf("Plate:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqFinderAliasByPlate) setDefaults() *reqFinderAliasByPlate { + return x. + SetPlateNonCompat(NewPlate()) +} + +type respFinderAliasByPlate struct { + Success *Car `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respFinderAliasByPlate)(nil) +var _ thrift.WritableResult = (*respFinderAliasByPlate)(nil) + +// Deprecated: FinderAliasByPlateResultDeprecated is deprecated, since it is supposed to be internal. +type FinderAliasByPlateResultDeprecated = respFinderAliasByPlate + +func newRespFinderAliasByPlate() *respFinderAliasByPlate { + return (&respFinderAliasByPlate{}).setDefaults() +} + +func (x *respFinderAliasByPlate) GetSuccess() *Car { + if !x.IsSetSuccess() { + return nil + } + return x.Success +} + +func (x *respFinderAliasByPlate) SetSuccessNonCompat(value *Car) *respFinderAliasByPlate { + x.Success = value + return x +} + +func (x *respFinderAliasByPlate) SetSuccess(value *Car) *respFinderAliasByPlate { + x.Success = value + return x +} + +func (x *respFinderAliasByPlate) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respFinderAliasByPlate) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Success + err := WriteCar(item, p) +if err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respFinderAliasByPlate) readField0(p thrift.Decoder) error { // Success + result, err := ReadCar(p) +if err != nil { + return err +} + + x.Success = result + return nil +} + +func (x *respFinderAliasByPlate) toString0() string { // Success + return fmt.Sprintf("%v", x.Success) +} + +// Deprecated: Use newRespFinderAliasByPlate().GetSuccess() instead. +func (x *respFinderAliasByPlate) DefaultGetSuccess() *Car { + if !x.IsSetSuccess() { + return NewCar() + } + return x.Success +} + + + +func (x *respFinderAliasByPlate) Exception() thrift.WritableException { + return nil +} + +func (x *respFinderAliasByPlate) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respFinderAliasByPlate"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respFinderAliasByPlate) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.STRUCT)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respFinderAliasByPlate) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respFinderAliasByPlate({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respFinderAliasByPlate) setDefaults() *respFinderAliasByPlate { + return x +} + +type reqFinderPreviousPlate struct { + Plate Plate `thrift:"plate,1" json:"plate" db:"plate"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqFinderPreviousPlate)(nil) + +// Deprecated: FinderPreviousPlateArgsDeprecated is deprecated, since it is supposed to be internal. +type FinderPreviousPlateArgsDeprecated = reqFinderPreviousPlate + +func newReqFinderPreviousPlate() *reqFinderPreviousPlate { + return (&reqFinderPreviousPlate{}).setDefaults() +} + +func (x *reqFinderPreviousPlate) GetPlate() Plate { + return x.Plate +} + +func (x *reqFinderPreviousPlate) SetPlateNonCompat(value Plate) *reqFinderPreviousPlate { + x.Plate = value + return x +} + +func (x *reqFinderPreviousPlate) SetPlate(value Plate) *reqFinderPreviousPlate { + x.Plate = value + return x +} + +func (x *reqFinderPreviousPlate) writeField1(p thrift.Encoder) error { // Plate + if err := p.WriteFieldBegin("plate", thrift.STRING, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Plate + err := WritePlate(item, p) +if err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqFinderPreviousPlate) readField1(p thrift.Decoder) error { // Plate + result, err := ReadPlate(p) +if err != nil { + return err +} + + x.Plate = result + return nil +} + +func (x *reqFinderPreviousPlate) toString1() string { // Plate + return fmt.Sprintf("%v", x.Plate) +} + + + +func (x *reqFinderPreviousPlate) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqFinderPreviousPlate"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqFinderPreviousPlate) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.STRING)): // plate + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqFinderPreviousPlate) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqFinderPreviousPlate({") + sb.WriteString(fmt.Sprintf("Plate:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqFinderPreviousPlate) setDefaults() *reqFinderPreviousPlate { + return x. + SetPlateNonCompat(NewPlate()) +} + +type respFinderPreviousPlate struct { + Success *Plate `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respFinderPreviousPlate)(nil) +var _ thrift.WritableResult = (*respFinderPreviousPlate)(nil) + +// Deprecated: FinderPreviousPlateResultDeprecated is deprecated, since it is supposed to be internal. +type FinderPreviousPlateResultDeprecated = respFinderPreviousPlate + +func newRespFinderPreviousPlate() *respFinderPreviousPlate { + return (&respFinderPreviousPlate{}).setDefaults() +} + +func (x *respFinderPreviousPlate) GetSuccess() Plate { + if !x.IsSetSuccess() { + return NewPlate() + } + return *x.Success +} + +func (x *respFinderPreviousPlate) SetSuccessNonCompat(value Plate) *respFinderPreviousPlate { + x.Success = &value + return x +} + +func (x *respFinderPreviousPlate) SetSuccess(value *Plate) *respFinderPreviousPlate { + x.Success = value + return x +} + +func (x *respFinderPreviousPlate) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respFinderPreviousPlate) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.STRING, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + err := WritePlate(item, p) +if err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respFinderPreviousPlate) readField0(p thrift.Decoder) error { // Success + result, err := ReadPlate(p) +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respFinderPreviousPlate) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respFinderPreviousPlate) Exception() thrift.WritableException { + return nil +} + +func (x *respFinderPreviousPlate) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respFinderPreviousPlate"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respFinderPreviousPlate) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.STRING)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respFinderPreviousPlate) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respFinderPreviousPlate({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respFinderPreviousPlate) setDefaults() *respFinderPreviousPlate { + return x +} + + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module2/types.go b/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module2/types.go index c38bda47703..9dc9b4053c8 100644 --- a/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module2/types.go +++ b/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module2/types.go @@ -63,3 +63,4 @@ func EnumFromString(s string) (Enum, error) { } + diff --git a/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/thrift/annotation/go/types.go b/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/thrift/annotation/go/types.go index 9d6a80812e3..628e19ddd57 100644 --- a/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/thrift/annotation/go/types.go +++ b/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/thrift/annotation/go/types.go @@ -284,6 +284,7 @@ func (x *Tag) setDefaults() *Tag { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/thrift/annotation/scope/types.go b/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/thrift/annotation/scope/types.go index c2871133501..c8a6b005a41 100644 --- a/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/thrift/annotation/scope/types.go +++ b/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/thrift/annotation/scope/types.go @@ -1380,6 +1380,7 @@ func (x *Definition) setDefaults() *Definition { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/go-typedef/out/go_module2/gen-go/module2/types.go b/thrift/compiler/test/fixtures/go-typedef/out/go_module2/gen-go/module2/types.go index 5b08e07f5a9..ab996cdef54 100644 --- a/thrift/compiler/test/fixtures/go-typedef/out/go_module2/gen-go/module2/types.go +++ b/thrift/compiler/test/fixtures/go-typedef/out/go_module2/gen-go/module2/types.go @@ -63,3 +63,4 @@ func EnumFromString(s string) (Enum, error) { } + diff --git a/thrift/compiler/test/fixtures/includes/out/go_matching_names/gen-go/IncludesAlso/types.go b/thrift/compiler/test/fixtures/includes/out/go_matching_names/gen-go/IncludesAlso/types.go index 83c383e08a6..4c0bc4cbd4b 100644 --- a/thrift/compiler/test/fixtures/includes/out/go_matching_names/gen-go/IncludesAlso/types.go +++ b/thrift/compiler/test/fixtures/includes/out/go_matching_names/gen-go/IncludesAlso/types.go @@ -100,6 +100,7 @@ func (x *Also) setDefaults() *Also { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/includes/out/go_matching_names/gen-go/matching_names/types.go b/thrift/compiler/test/fixtures/includes/out/go_matching_names/gen-go/matching_names/types.go index be1b84f7b95..4cb1faa31dc 100644 --- a/thrift/compiler/test/fixtures/includes/out/go_matching_names/gen-go/matching_names/types.go +++ b/thrift/compiler/test/fixtures/includes/out/go_matching_names/gen-go/matching_names/types.go @@ -174,6 +174,7 @@ func (x *IncludesAlso) setDefaults() *IncludesAlso { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/includes/types.go b/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/includes/types.go index 83676931e43..d5743e2ada7 100644 --- a/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/includes/types.go +++ b/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/includes/types.go @@ -281,6 +281,7 @@ func (x *Included) setDefaults() *Included { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/module/types.go b/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/module/types.go index 9700966ff01..2fb7f6ff5ff 100644 --- a/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/module/types.go +++ b/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/module/types.go @@ -301,6 +301,7 @@ func (x *MyStruct) setDefaults() *MyStruct { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/service/svcs.go b/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/service/svcs.go index 90f22475fee..c0dd0f5911d 100644 --- a/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/service/svcs.go +++ b/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/service/svcs.go @@ -127,637 +127,6 @@ func (c *MyServiceClient) HasArgDocsContext(ctx context.Context, s *module.MyStr return c.chClient.HasArgDocs(ctx, s, i) } -type reqMyServiceQuery struct { - S *module.MyStruct `thrift:"s,1" json:"s" db:"s"` - I *includes.Included `thrift:"i,2" json:"i" db:"i"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqMyServiceQuery)(nil) - -// Deprecated: MyServiceQueryArgsDeprecated is deprecated, since it is supposed to be internal. -type MyServiceQueryArgsDeprecated = reqMyServiceQuery - -func newReqMyServiceQuery() *reqMyServiceQuery { - return (&reqMyServiceQuery{}).setDefaults() -} - -func (x *reqMyServiceQuery) GetS() *module.MyStruct { - if !x.IsSetS() { - return nil - } - return x.S -} - -func (x *reqMyServiceQuery) GetI() *includes.Included { - if !x.IsSetI() { - return nil - } - return x.I -} - -func (x *reqMyServiceQuery) SetSNonCompat(value *module.MyStruct) *reqMyServiceQuery { - x.S = value - return x -} - -func (x *reqMyServiceQuery) SetS(value *module.MyStruct) *reqMyServiceQuery { - x.S = value - return x -} - -func (x *reqMyServiceQuery) SetINonCompat(value *includes.Included) *reqMyServiceQuery { - x.I = value - return x -} - -func (x *reqMyServiceQuery) SetI(value *includes.Included) *reqMyServiceQuery { - x.I = value - return x -} - -func (x *reqMyServiceQuery) IsSetS() bool { - return x != nil && x.S != nil -} - -func (x *reqMyServiceQuery) IsSetI() bool { - return x != nil && x.I != nil -} - -func (x *reqMyServiceQuery) writeField1(p thrift.Encoder) error { // S - if !x.IsSetS() { - return nil - } - - if err := p.WriteFieldBegin("s", thrift.STRUCT, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.S - if err := item.Write(p); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceQuery) writeField2(p thrift.Encoder) error { // I - if !x.IsSetI() { - return nil - } - - if err := p.WriteFieldBegin("i", thrift.STRUCT, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.I - if err := item.Write(p); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceQuery) readField1(p thrift.Decoder) error { // S - result := module.NewMyStruct() -err := result.Read(p) -if err != nil { - return err -} - - x.S = result - return nil -} - -func (x *reqMyServiceQuery) readField2(p thrift.Decoder) error { // I - result := includes.NewIncluded() -err := result.Read(p) -if err != nil { - return err -} - - x.I = result - return nil -} - -func (x *reqMyServiceQuery) toString1() string { // S - return fmt.Sprintf("%v", x.S) -} - -func (x *reqMyServiceQuery) toString2() string { // I - return fmt.Sprintf("%v", x.I) -} - -// Deprecated: Use newReqMyServiceQuery().GetS() instead. -func (x *reqMyServiceQuery) DefaultGetS() *module.MyStruct { - if !x.IsSetS() { - return module.NewMyStruct() - } - return x.S -} - -// Deprecated: Use newReqMyServiceQuery().GetI() instead. -func (x *reqMyServiceQuery) DefaultGetI() *includes.Included { - if !x.IsSetI() { - return includes.NewIncluded() - } - return x.I -} - - - -func (x *reqMyServiceQuery) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyServiceQuery"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - if err := x.writeField2(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceQuery) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.STRUCT)): // s - fieldReadErr = x.readField1(p) - case (id == 2 && wireType == thrift.Type(thrift.STRUCT)): // i - fieldReadErr = x.readField2(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqMyServiceQuery) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqMyServiceQuery({") - sb.WriteString(fmt.Sprintf("S:%s ", x.toString1())) - sb.WriteString(fmt.Sprintf("I:%s", x.toString2())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyServiceQuery) setDefaults() *reqMyServiceQuery { - return x. - SetSNonCompat(module.NewMyStruct()). - SetINonCompat(includes.NewIncluded()) -} - -type respMyServiceQuery struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyServiceQuery)(nil) -var _ thrift.WritableResult = (*respMyServiceQuery)(nil) - -// Deprecated: MyServiceQueryResultDeprecated is deprecated, since it is supposed to be internal. -type MyServiceQueryResultDeprecated = respMyServiceQuery - -func newRespMyServiceQuery() *respMyServiceQuery { - return (&respMyServiceQuery{}).setDefaults() -} - - - -func (x *respMyServiceQuery) Exception() thrift.WritableException { - return nil -} - -func (x *respMyServiceQuery) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyServiceQuery"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respMyServiceQuery) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respMyServiceQuery) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyServiceQuery({") - sb.WriteString("})") - - return sb.String() -} -func (x *respMyServiceQuery) setDefaults() *respMyServiceQuery { - return x -} - -type reqMyServiceHasArgDocs struct { - S *module.MyStruct `thrift:"s,1" json:"s" db:"s"` - I *includes.Included `thrift:"i,2" json:"i" db:"i"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqMyServiceHasArgDocs)(nil) - -// Deprecated: MyServiceHasArgDocsArgsDeprecated is deprecated, since it is supposed to be internal. -type MyServiceHasArgDocsArgsDeprecated = reqMyServiceHasArgDocs - -func newReqMyServiceHasArgDocs() *reqMyServiceHasArgDocs { - return (&reqMyServiceHasArgDocs{}).setDefaults() -} - -func (x *reqMyServiceHasArgDocs) GetS() *module.MyStruct { - if !x.IsSetS() { - return nil - } - return x.S -} - -func (x *reqMyServiceHasArgDocs) GetI() *includes.Included { - if !x.IsSetI() { - return nil - } - return x.I -} - -func (x *reqMyServiceHasArgDocs) SetSNonCompat(value *module.MyStruct) *reqMyServiceHasArgDocs { - x.S = value - return x -} - -func (x *reqMyServiceHasArgDocs) SetS(value *module.MyStruct) *reqMyServiceHasArgDocs { - x.S = value - return x -} - -func (x *reqMyServiceHasArgDocs) SetINonCompat(value *includes.Included) *reqMyServiceHasArgDocs { - x.I = value - return x -} - -func (x *reqMyServiceHasArgDocs) SetI(value *includes.Included) *reqMyServiceHasArgDocs { - x.I = value - return x -} - -func (x *reqMyServiceHasArgDocs) IsSetS() bool { - return x != nil && x.S != nil -} - -func (x *reqMyServiceHasArgDocs) IsSetI() bool { - return x != nil && x.I != nil -} - -func (x *reqMyServiceHasArgDocs) writeField1(p thrift.Encoder) error { // S - if !x.IsSetS() { - return nil - } - - if err := p.WriteFieldBegin("s", thrift.STRUCT, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.S - if err := item.Write(p); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceHasArgDocs) writeField2(p thrift.Encoder) error { // I - if !x.IsSetI() { - return nil - } - - if err := p.WriteFieldBegin("i", thrift.STRUCT, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.I - if err := item.Write(p); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceHasArgDocs) readField1(p thrift.Decoder) error { // S - result := module.NewMyStruct() -err := result.Read(p) -if err != nil { - return err -} - - x.S = result - return nil -} - -func (x *reqMyServiceHasArgDocs) readField2(p thrift.Decoder) error { // I - result := includes.NewIncluded() -err := result.Read(p) -if err != nil { - return err -} - - x.I = result - return nil -} - -func (x *reqMyServiceHasArgDocs) toString1() string { // S - return fmt.Sprintf("%v", x.S) -} - -func (x *reqMyServiceHasArgDocs) toString2() string { // I - return fmt.Sprintf("%v", x.I) -} - -// Deprecated: Use newReqMyServiceHasArgDocs().GetS() instead. -func (x *reqMyServiceHasArgDocs) DefaultGetS() *module.MyStruct { - if !x.IsSetS() { - return module.NewMyStruct() - } - return x.S -} - -// Deprecated: Use newReqMyServiceHasArgDocs().GetI() instead. -func (x *reqMyServiceHasArgDocs) DefaultGetI() *includes.Included { - if !x.IsSetI() { - return includes.NewIncluded() - } - return x.I -} - - - -func (x *reqMyServiceHasArgDocs) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyServiceHasArgDocs"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - if err := x.writeField2(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceHasArgDocs) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.STRUCT)): // s - fieldReadErr = x.readField1(p) - case (id == 2 && wireType == thrift.Type(thrift.STRUCT)): // i - fieldReadErr = x.readField2(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqMyServiceHasArgDocs) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqMyServiceHasArgDocs({") - sb.WriteString(fmt.Sprintf("S:%s ", x.toString1())) - sb.WriteString(fmt.Sprintf("I:%s", x.toString2())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyServiceHasArgDocs) setDefaults() *reqMyServiceHasArgDocs { - return x. - SetSNonCompat(module.NewMyStruct()). - SetINonCompat(includes.NewIncluded()) -} - -type respMyServiceHasArgDocs struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyServiceHasArgDocs)(nil) -var _ thrift.WritableResult = (*respMyServiceHasArgDocs)(nil) - -// Deprecated: MyServiceHasArgDocsResultDeprecated is deprecated, since it is supposed to be internal. -type MyServiceHasArgDocsResultDeprecated = respMyServiceHasArgDocs - -func newRespMyServiceHasArgDocs() *respMyServiceHasArgDocs { - return (&respMyServiceHasArgDocs{}).setDefaults() -} - - - -func (x *respMyServiceHasArgDocs) Exception() thrift.WritableException { - return nil -} - -func (x *respMyServiceHasArgDocs) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyServiceHasArgDocs"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respMyServiceHasArgDocs) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respMyServiceHasArgDocs) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyServiceHasArgDocs({") - sb.WriteString("})") - - return sb.String() -} -func (x *respMyServiceHasArgDocs) setDefaults() *respMyServiceHasArgDocs { - return x -} - - type MyServiceProcessor struct { processorFunctionMap map[string]thrift.ProcessorFunction diff --git a/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/service/types.go b/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/service/types.go index 9e66355a40e..44b8fcf94a2 100644 --- a/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/service/types.go +++ b/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/service/types.go @@ -78,3 +78,635 @@ if err != nil { return decodeResult, decodeErr } +// Service req/resp structs (below) +type reqMyServiceQuery struct { + S *module.MyStruct `thrift:"s,1" json:"s" db:"s"` + I *includes.Included `thrift:"i,2" json:"i" db:"i"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyServiceQuery)(nil) + +// Deprecated: MyServiceQueryArgsDeprecated is deprecated, since it is supposed to be internal. +type MyServiceQueryArgsDeprecated = reqMyServiceQuery + +func newReqMyServiceQuery() *reqMyServiceQuery { + return (&reqMyServiceQuery{}).setDefaults() +} + +func (x *reqMyServiceQuery) GetS() *module.MyStruct { + if !x.IsSetS() { + return nil + } + return x.S +} + +func (x *reqMyServiceQuery) GetI() *includes.Included { + if !x.IsSetI() { + return nil + } + return x.I +} + +func (x *reqMyServiceQuery) SetSNonCompat(value *module.MyStruct) *reqMyServiceQuery { + x.S = value + return x +} + +func (x *reqMyServiceQuery) SetS(value *module.MyStruct) *reqMyServiceQuery { + x.S = value + return x +} + +func (x *reqMyServiceQuery) SetINonCompat(value *includes.Included) *reqMyServiceQuery { + x.I = value + return x +} + +func (x *reqMyServiceQuery) SetI(value *includes.Included) *reqMyServiceQuery { + x.I = value + return x +} + +func (x *reqMyServiceQuery) IsSetS() bool { + return x != nil && x.S != nil +} + +func (x *reqMyServiceQuery) IsSetI() bool { + return x != nil && x.I != nil +} + +func (x *reqMyServiceQuery) writeField1(p thrift.Encoder) error { // S + if !x.IsSetS() { + return nil + } + + if err := p.WriteFieldBegin("s", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.S + if err := item.Write(p); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceQuery) writeField2(p thrift.Encoder) error { // I + if !x.IsSetI() { + return nil + } + + if err := p.WriteFieldBegin("i", thrift.STRUCT, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.I + if err := item.Write(p); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceQuery) readField1(p thrift.Decoder) error { // S + result := module.NewMyStruct() +err := result.Read(p) +if err != nil { + return err +} + + x.S = result + return nil +} + +func (x *reqMyServiceQuery) readField2(p thrift.Decoder) error { // I + result := includes.NewIncluded() +err := result.Read(p) +if err != nil { + return err +} + + x.I = result + return nil +} + +func (x *reqMyServiceQuery) toString1() string { // S + return fmt.Sprintf("%v", x.S) +} + +func (x *reqMyServiceQuery) toString2() string { // I + return fmt.Sprintf("%v", x.I) +} + +// Deprecated: Use newReqMyServiceQuery().GetS() instead. +func (x *reqMyServiceQuery) DefaultGetS() *module.MyStruct { + if !x.IsSetS() { + return module.NewMyStruct() + } + return x.S +} + +// Deprecated: Use newReqMyServiceQuery().GetI() instead. +func (x *reqMyServiceQuery) DefaultGetI() *includes.Included { + if !x.IsSetI() { + return includes.NewIncluded() + } + return x.I +} + + + +func (x *reqMyServiceQuery) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyServiceQuery"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + if err := x.writeField2(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceQuery) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.STRUCT)): // s + fieldReadErr = x.readField1(p) + case (id == 2 && wireType == thrift.Type(thrift.STRUCT)): // i + fieldReadErr = x.readField2(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyServiceQuery) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyServiceQuery({") + sb.WriteString(fmt.Sprintf("S:%s ", x.toString1())) + sb.WriteString(fmt.Sprintf("I:%s", x.toString2())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyServiceQuery) setDefaults() *reqMyServiceQuery { + return x. + SetSNonCompat(module.NewMyStruct()). + SetINonCompat(includes.NewIncluded()) +} + +type respMyServiceQuery struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyServiceQuery)(nil) +var _ thrift.WritableResult = (*respMyServiceQuery)(nil) + +// Deprecated: MyServiceQueryResultDeprecated is deprecated, since it is supposed to be internal. +type MyServiceQueryResultDeprecated = respMyServiceQuery + +func newRespMyServiceQuery() *respMyServiceQuery { + return (&respMyServiceQuery{}).setDefaults() +} + + + +func (x *respMyServiceQuery) Exception() thrift.WritableException { + return nil +} + +func (x *respMyServiceQuery) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyServiceQuery"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyServiceQuery) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyServiceQuery) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyServiceQuery({") + sb.WriteString("})") + + return sb.String() +} +func (x *respMyServiceQuery) setDefaults() *respMyServiceQuery { + return x +} + +type reqMyServiceHasArgDocs struct { + S *module.MyStruct `thrift:"s,1" json:"s" db:"s"` + I *includes.Included `thrift:"i,2" json:"i" db:"i"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyServiceHasArgDocs)(nil) + +// Deprecated: MyServiceHasArgDocsArgsDeprecated is deprecated, since it is supposed to be internal. +type MyServiceHasArgDocsArgsDeprecated = reqMyServiceHasArgDocs + +func newReqMyServiceHasArgDocs() *reqMyServiceHasArgDocs { + return (&reqMyServiceHasArgDocs{}).setDefaults() +} + +func (x *reqMyServiceHasArgDocs) GetS() *module.MyStruct { + if !x.IsSetS() { + return nil + } + return x.S +} + +func (x *reqMyServiceHasArgDocs) GetI() *includes.Included { + if !x.IsSetI() { + return nil + } + return x.I +} + +func (x *reqMyServiceHasArgDocs) SetSNonCompat(value *module.MyStruct) *reqMyServiceHasArgDocs { + x.S = value + return x +} + +func (x *reqMyServiceHasArgDocs) SetS(value *module.MyStruct) *reqMyServiceHasArgDocs { + x.S = value + return x +} + +func (x *reqMyServiceHasArgDocs) SetINonCompat(value *includes.Included) *reqMyServiceHasArgDocs { + x.I = value + return x +} + +func (x *reqMyServiceHasArgDocs) SetI(value *includes.Included) *reqMyServiceHasArgDocs { + x.I = value + return x +} + +func (x *reqMyServiceHasArgDocs) IsSetS() bool { + return x != nil && x.S != nil +} + +func (x *reqMyServiceHasArgDocs) IsSetI() bool { + return x != nil && x.I != nil +} + +func (x *reqMyServiceHasArgDocs) writeField1(p thrift.Encoder) error { // S + if !x.IsSetS() { + return nil + } + + if err := p.WriteFieldBegin("s", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.S + if err := item.Write(p); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceHasArgDocs) writeField2(p thrift.Encoder) error { // I + if !x.IsSetI() { + return nil + } + + if err := p.WriteFieldBegin("i", thrift.STRUCT, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.I + if err := item.Write(p); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceHasArgDocs) readField1(p thrift.Decoder) error { // S + result := module.NewMyStruct() +err := result.Read(p) +if err != nil { + return err +} + + x.S = result + return nil +} + +func (x *reqMyServiceHasArgDocs) readField2(p thrift.Decoder) error { // I + result := includes.NewIncluded() +err := result.Read(p) +if err != nil { + return err +} + + x.I = result + return nil +} + +func (x *reqMyServiceHasArgDocs) toString1() string { // S + return fmt.Sprintf("%v", x.S) +} + +func (x *reqMyServiceHasArgDocs) toString2() string { // I + return fmt.Sprintf("%v", x.I) +} + +// Deprecated: Use newReqMyServiceHasArgDocs().GetS() instead. +func (x *reqMyServiceHasArgDocs) DefaultGetS() *module.MyStruct { + if !x.IsSetS() { + return module.NewMyStruct() + } + return x.S +} + +// Deprecated: Use newReqMyServiceHasArgDocs().GetI() instead. +func (x *reqMyServiceHasArgDocs) DefaultGetI() *includes.Included { + if !x.IsSetI() { + return includes.NewIncluded() + } + return x.I +} + + + +func (x *reqMyServiceHasArgDocs) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyServiceHasArgDocs"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + if err := x.writeField2(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceHasArgDocs) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.STRUCT)): // s + fieldReadErr = x.readField1(p) + case (id == 2 && wireType == thrift.Type(thrift.STRUCT)): // i + fieldReadErr = x.readField2(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyServiceHasArgDocs) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyServiceHasArgDocs({") + sb.WriteString(fmt.Sprintf("S:%s ", x.toString1())) + sb.WriteString(fmt.Sprintf("I:%s", x.toString2())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyServiceHasArgDocs) setDefaults() *reqMyServiceHasArgDocs { + return x. + SetSNonCompat(module.NewMyStruct()). + SetINonCompat(includes.NewIncluded()) +} + +type respMyServiceHasArgDocs struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyServiceHasArgDocs)(nil) +var _ thrift.WritableResult = (*respMyServiceHasArgDocs)(nil) + +// Deprecated: MyServiceHasArgDocsResultDeprecated is deprecated, since it is supposed to be internal. +type MyServiceHasArgDocsResultDeprecated = respMyServiceHasArgDocs + +func newRespMyServiceHasArgDocs() *respMyServiceHasArgDocs { + return (&respMyServiceHasArgDocs{}).setDefaults() +} + + + +func (x *respMyServiceHasArgDocs) Exception() thrift.WritableException { + return nil +} + +func (x *respMyServiceHasArgDocs) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyServiceHasArgDocs"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyServiceHasArgDocs) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyServiceHasArgDocs) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyServiceHasArgDocs({") + sb.WriteString("})") + + return sb.String() +} +func (x *respMyServiceHasArgDocs) setDefaults() *respMyServiceHasArgDocs { + return x +} + + diff --git a/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/transitive/types.go b/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/transitive/types.go index 4a4f5539259..abf05039c11 100644 --- a/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/transitive/types.go +++ b/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/transitive/types.go @@ -152,6 +152,7 @@ func (x *Foo) setDefaults() *Foo { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/inheritance/out/go/gen-go/module/svcs.go b/thrift/compiler/test/fixtures/inheritance/out/go/gen-go/module/svcs.go index 66c52c78365..9d0b24427dc 100644 --- a/thrift/compiler/test/fixtures/inheritance/out/go/gen-go/module/svcs.go +++ b/thrift/compiler/test/fixtures/inheritance/out/go/gen-go/module/svcs.go @@ -97,178 +97,6 @@ func (c *MyRootClient) DoRootContext(ctx context.Context) (error) { return c.chClient.DoRoot(ctx) } -type reqMyRootDoRoot struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqMyRootDoRoot)(nil) - -// Deprecated: MyRootDoRootArgsDeprecated is deprecated, since it is supposed to be internal. -type MyRootDoRootArgsDeprecated = reqMyRootDoRoot - -func newReqMyRootDoRoot() *reqMyRootDoRoot { - return (&reqMyRootDoRoot{}).setDefaults() -} - - - -func (x *reqMyRootDoRoot) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyRootDoRoot"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyRootDoRoot) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqMyRootDoRoot) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqMyRootDoRoot({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyRootDoRoot) setDefaults() *reqMyRootDoRoot { - return x -} - -type respMyRootDoRoot struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyRootDoRoot)(nil) -var _ thrift.WritableResult = (*respMyRootDoRoot)(nil) - -// Deprecated: MyRootDoRootResultDeprecated is deprecated, since it is supposed to be internal. -type MyRootDoRootResultDeprecated = respMyRootDoRoot - -func newRespMyRootDoRoot() *respMyRootDoRoot { - return (&respMyRootDoRoot{}).setDefaults() -} - - - -func (x *respMyRootDoRoot) Exception() thrift.WritableException { - return nil -} - -func (x *respMyRootDoRoot) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyRootDoRoot"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respMyRootDoRoot) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respMyRootDoRoot) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyRootDoRoot({") - sb.WriteString("})") - - return sb.String() -} -func (x *respMyRootDoRoot) setDefaults() *respMyRootDoRoot { - return x -} - - type MyRootProcessor struct { processorFunctionMap map[string]thrift.ProcessorFunction @@ -450,178 +278,6 @@ func (c *MyNodeClient) DoMidContext(ctx context.Context) (error) { return c.chClient.DoMid(ctx) } -type reqMyNodeDoMid struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqMyNodeDoMid)(nil) - -// Deprecated: MyNodeDoMidArgsDeprecated is deprecated, since it is supposed to be internal. -type MyNodeDoMidArgsDeprecated = reqMyNodeDoMid - -func newReqMyNodeDoMid() *reqMyNodeDoMid { - return (&reqMyNodeDoMid{}).setDefaults() -} - - - -func (x *reqMyNodeDoMid) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyNodeDoMid"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyNodeDoMid) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqMyNodeDoMid) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqMyNodeDoMid({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyNodeDoMid) setDefaults() *reqMyNodeDoMid { - return x -} - -type respMyNodeDoMid struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyNodeDoMid)(nil) -var _ thrift.WritableResult = (*respMyNodeDoMid)(nil) - -// Deprecated: MyNodeDoMidResultDeprecated is deprecated, since it is supposed to be internal. -type MyNodeDoMidResultDeprecated = respMyNodeDoMid - -func newRespMyNodeDoMid() *respMyNodeDoMid { - return (&respMyNodeDoMid{}).setDefaults() -} - - - -func (x *respMyNodeDoMid) Exception() thrift.WritableException { - return nil -} - -func (x *respMyNodeDoMid) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyNodeDoMid"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respMyNodeDoMid) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respMyNodeDoMid) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyNodeDoMid({") - sb.WriteString("})") - - return sb.String() -} -func (x *respMyNodeDoMid) setDefaults() *respMyNodeDoMid { - return x -} - - type MyNodeProcessor struct { // Inherited/extended processor @@ -780,178 +436,6 @@ func (c *MyLeafClient) DoLeafContext(ctx context.Context) (error) { return c.chClient.DoLeaf(ctx) } -type reqMyLeafDoLeaf struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqMyLeafDoLeaf)(nil) - -// Deprecated: MyLeafDoLeafArgsDeprecated is deprecated, since it is supposed to be internal. -type MyLeafDoLeafArgsDeprecated = reqMyLeafDoLeaf - -func newReqMyLeafDoLeaf() *reqMyLeafDoLeaf { - return (&reqMyLeafDoLeaf{}).setDefaults() -} - - - -func (x *reqMyLeafDoLeaf) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyLeafDoLeaf"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyLeafDoLeaf) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqMyLeafDoLeaf) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqMyLeafDoLeaf({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyLeafDoLeaf) setDefaults() *reqMyLeafDoLeaf { - return x -} - -type respMyLeafDoLeaf struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyLeafDoLeaf)(nil) -var _ thrift.WritableResult = (*respMyLeafDoLeaf)(nil) - -// Deprecated: MyLeafDoLeafResultDeprecated is deprecated, since it is supposed to be internal. -type MyLeafDoLeafResultDeprecated = respMyLeafDoLeaf - -func newRespMyLeafDoLeaf() *respMyLeafDoLeaf { - return (&respMyLeafDoLeaf{}).setDefaults() -} - - - -func (x *respMyLeafDoLeaf) Exception() thrift.WritableException { - return nil -} - -func (x *respMyLeafDoLeaf) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyLeafDoLeaf"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respMyLeafDoLeaf) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respMyLeafDoLeaf) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyLeafDoLeaf({") - sb.WriteString("})") - - return sb.String() -} -func (x *respMyLeafDoLeaf) setDefaults() *respMyLeafDoLeaf { - return x -} - - type MyLeafProcessor struct { // Inherited/extended processor diff --git a/thrift/compiler/test/fixtures/inheritance/out/go/gen-go/module/types.go b/thrift/compiler/test/fixtures/inheritance/out/go/gen-go/module/types.go index 96f2c5ddc4c..c37354b31aa 100644 --- a/thrift/compiler/test/fixtures/inheritance/out/go/gen-go/module/types.go +++ b/thrift/compiler/test/fixtures/inheritance/out/go/gen-go/module/types.go @@ -20,3 +20,518 @@ var _ = strings.Split var _ = thrift.ZERO +// Service req/resp structs (below) +type reqMyRootDoRoot struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyRootDoRoot)(nil) + +// Deprecated: MyRootDoRootArgsDeprecated is deprecated, since it is supposed to be internal. +type MyRootDoRootArgsDeprecated = reqMyRootDoRoot + +func newReqMyRootDoRoot() *reqMyRootDoRoot { + return (&reqMyRootDoRoot{}).setDefaults() +} + + + +func (x *reqMyRootDoRoot) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyRootDoRoot"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyRootDoRoot) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyRootDoRoot) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyRootDoRoot({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyRootDoRoot) setDefaults() *reqMyRootDoRoot { + return x +} + +type respMyRootDoRoot struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyRootDoRoot)(nil) +var _ thrift.WritableResult = (*respMyRootDoRoot)(nil) + +// Deprecated: MyRootDoRootResultDeprecated is deprecated, since it is supposed to be internal. +type MyRootDoRootResultDeprecated = respMyRootDoRoot + +func newRespMyRootDoRoot() *respMyRootDoRoot { + return (&respMyRootDoRoot{}).setDefaults() +} + + + +func (x *respMyRootDoRoot) Exception() thrift.WritableException { + return nil +} + +func (x *respMyRootDoRoot) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyRootDoRoot"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyRootDoRoot) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyRootDoRoot) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyRootDoRoot({") + sb.WriteString("})") + + return sb.String() +} +func (x *respMyRootDoRoot) setDefaults() *respMyRootDoRoot { + return x +} + +type reqMyNodeDoMid struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyNodeDoMid)(nil) + +// Deprecated: MyNodeDoMidArgsDeprecated is deprecated, since it is supposed to be internal. +type MyNodeDoMidArgsDeprecated = reqMyNodeDoMid + +func newReqMyNodeDoMid() *reqMyNodeDoMid { + return (&reqMyNodeDoMid{}).setDefaults() +} + + + +func (x *reqMyNodeDoMid) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyNodeDoMid"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyNodeDoMid) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyNodeDoMid) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyNodeDoMid({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyNodeDoMid) setDefaults() *reqMyNodeDoMid { + return x +} + +type respMyNodeDoMid struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyNodeDoMid)(nil) +var _ thrift.WritableResult = (*respMyNodeDoMid)(nil) + +// Deprecated: MyNodeDoMidResultDeprecated is deprecated, since it is supposed to be internal. +type MyNodeDoMidResultDeprecated = respMyNodeDoMid + +func newRespMyNodeDoMid() *respMyNodeDoMid { + return (&respMyNodeDoMid{}).setDefaults() +} + + + +func (x *respMyNodeDoMid) Exception() thrift.WritableException { + return nil +} + +func (x *respMyNodeDoMid) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyNodeDoMid"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyNodeDoMid) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyNodeDoMid) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyNodeDoMid({") + sb.WriteString("})") + + return sb.String() +} +func (x *respMyNodeDoMid) setDefaults() *respMyNodeDoMid { + return x +} + +type reqMyLeafDoLeaf struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyLeafDoLeaf)(nil) + +// Deprecated: MyLeafDoLeafArgsDeprecated is deprecated, since it is supposed to be internal. +type MyLeafDoLeafArgsDeprecated = reqMyLeafDoLeaf + +func newReqMyLeafDoLeaf() *reqMyLeafDoLeaf { + return (&reqMyLeafDoLeaf{}).setDefaults() +} + + + +func (x *reqMyLeafDoLeaf) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyLeafDoLeaf"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyLeafDoLeaf) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyLeafDoLeaf) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyLeafDoLeaf({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyLeafDoLeaf) setDefaults() *reqMyLeafDoLeaf { + return x +} + +type respMyLeafDoLeaf struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyLeafDoLeaf)(nil) +var _ thrift.WritableResult = (*respMyLeafDoLeaf)(nil) + +// Deprecated: MyLeafDoLeafResultDeprecated is deprecated, since it is supposed to be internal. +type MyLeafDoLeafResultDeprecated = respMyLeafDoLeaf + +func newRespMyLeafDoLeaf() *respMyLeafDoLeaf { + return (&respMyLeafDoLeaf{}).setDefaults() +} + + + +func (x *respMyLeafDoLeaf) Exception() thrift.WritableException { + return nil +} + +func (x *respMyLeafDoLeaf) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyLeafDoLeaf"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyLeafDoLeaf) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyLeafDoLeaf) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyLeafDoLeaf({") + sb.WriteString("})") + + return sb.String() +} +func (x *respMyLeafDoLeaf) setDefaults() *respMyLeafDoLeaf { + return x +} + + diff --git a/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/foo/types.go b/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/foo/types.go index a7d23fcde91..9fffa0063a5 100644 --- a/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/foo/types.go +++ b/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/foo/types.go @@ -284,6 +284,7 @@ func (x *Fields) setDefaults() *Fields { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/module/types.go b/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/module/types.go index af92588105d..d5b1f6da2b8 100644 --- a/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/module/types.go +++ b/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/module/types.go @@ -786,6 +786,7 @@ func (x *FieldsInjectedWithIncludedStruct) setDefaults() *FieldsInjectedWithIncl } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/internals/types.go b/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/internals/types.go index fe26f22ab68..3395def8594 100644 --- a/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/internals/types.go +++ b/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/internals/types.go @@ -152,6 +152,7 @@ func (x *InjectMetadataFields) setDefaults() *InjectMetadataFields { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/scope/types.go b/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/scope/types.go index c2871133501..c8a6b005a41 100644 --- a/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/scope/types.go +++ b/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/scope/types.go @@ -1380,6 +1380,7 @@ func (x *Definition) setDefaults() *Definition { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/thrift/types.go b/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/thrift/types.go index 85cadd20f65..ba562235211 100644 --- a/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/thrift/types.go +++ b/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/thrift/types.go @@ -1804,6 +1804,7 @@ func (x *AllowReservedFilename) setDefaults() *AllowReservedFilename { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/interactions/out/go/gen-go/module/svcs.go b/thrift/compiler/test/fixtures/interactions/out/go/gen-go/module/svcs.go index 7eb014ed000..c3144e36bb6 100644 --- a/thrift/compiler/test/fixtures/interactions/out/go/gen-go/module/svcs.go +++ b/thrift/compiler/test/fixtures/interactions/out/go/gen-go/module/svcs.go @@ -99,178 +99,6 @@ func (c *MyServiceClient) FooContext(ctx context.Context) (error) { return c.chClient.Foo(ctx) } -type reqMyServiceFoo struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqMyServiceFoo)(nil) - -// Deprecated: MyServiceFooArgsDeprecated is deprecated, since it is supposed to be internal. -type MyServiceFooArgsDeprecated = reqMyServiceFoo - -func newReqMyServiceFoo() *reqMyServiceFoo { - return (&reqMyServiceFoo{}).setDefaults() -} - - - -func (x *reqMyServiceFoo) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqMyServiceFoo"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqMyServiceFoo) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqMyServiceFoo) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqMyServiceFoo({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqMyServiceFoo) setDefaults() *reqMyServiceFoo { - return x -} - -type respMyServiceFoo struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respMyServiceFoo)(nil) -var _ thrift.WritableResult = (*respMyServiceFoo)(nil) - -// Deprecated: MyServiceFooResultDeprecated is deprecated, since it is supposed to be internal. -type MyServiceFooResultDeprecated = respMyServiceFoo - -func newRespMyServiceFoo() *respMyServiceFoo { - return (&respMyServiceFoo{}).setDefaults() -} - - - -func (x *respMyServiceFoo) Exception() thrift.WritableException { - return nil -} - -func (x *respMyServiceFoo) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respMyServiceFoo"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respMyServiceFoo) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respMyServiceFoo) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respMyServiceFoo({") - sb.WriteString("})") - - return sb.String() -} -func (x *respMyServiceFoo) setDefaults() *respMyServiceFoo { - return x -} - - type MyServiceProcessor struct { processorFunctionMap map[string]thrift.ProcessorFunction @@ -440,178 +268,6 @@ func (c *FactoriesClient) FooContext(ctx context.Context) (error) { return c.chClient.Foo(ctx) } -type reqFactoriesFoo struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqFactoriesFoo)(nil) - -// Deprecated: FactoriesFooArgsDeprecated is deprecated, since it is supposed to be internal. -type FactoriesFooArgsDeprecated = reqFactoriesFoo - -func newReqFactoriesFoo() *reqFactoriesFoo { - return (&reqFactoriesFoo{}).setDefaults() -} - - - -func (x *reqFactoriesFoo) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqFactoriesFoo"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqFactoriesFoo) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqFactoriesFoo) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqFactoriesFoo({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqFactoriesFoo) setDefaults() *reqFactoriesFoo { - return x -} - -type respFactoriesFoo struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respFactoriesFoo)(nil) -var _ thrift.WritableResult = (*respFactoriesFoo)(nil) - -// Deprecated: FactoriesFooResultDeprecated is deprecated, since it is supposed to be internal. -type FactoriesFooResultDeprecated = respFactoriesFoo - -func newRespFactoriesFoo() *respFactoriesFoo { - return (&respFactoriesFoo{}).setDefaults() -} - - - -func (x *respFactoriesFoo) Exception() thrift.WritableException { - return nil -} - -func (x *respFactoriesFoo) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respFactoriesFoo"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respFactoriesFoo) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respFactoriesFoo) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respFactoriesFoo({") - sb.WriteString("})") - - return sb.String() -} -func (x *respFactoriesFoo) setDefaults() *respFactoriesFoo { - return x -} - - type FactoriesProcessor struct { processorFunctionMap map[string]thrift.ProcessorFunction @@ -781,178 +437,6 @@ func (c *PerformClient) FooContext(ctx context.Context) (error) { return c.chClient.Foo(ctx) } -type reqPerformFoo struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqPerformFoo)(nil) - -// Deprecated: PerformFooArgsDeprecated is deprecated, since it is supposed to be internal. -type PerformFooArgsDeprecated = reqPerformFoo - -func newReqPerformFoo() *reqPerformFoo { - return (&reqPerformFoo{}).setDefaults() -} - - - -func (x *reqPerformFoo) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqPerformFoo"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqPerformFoo) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqPerformFoo) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqPerformFoo({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqPerformFoo) setDefaults() *reqPerformFoo { - return x -} - -type respPerformFoo struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respPerformFoo)(nil) -var _ thrift.WritableResult = (*respPerformFoo)(nil) - -// Deprecated: PerformFooResultDeprecated is deprecated, since it is supposed to be internal. -type PerformFooResultDeprecated = respPerformFoo - -func newRespPerformFoo() *respPerformFoo { - return (&respPerformFoo{}).setDefaults() -} - - - -func (x *respPerformFoo) Exception() thrift.WritableException { - return nil -} - -func (x *respPerformFoo) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respPerformFoo"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respPerformFoo) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respPerformFoo) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respPerformFoo({") - sb.WriteString("})") - - return sb.String() -} -func (x *respPerformFoo) setDefaults() *respPerformFoo { - return x -} - - type PerformProcessor struct { processorFunctionMap map[string]thrift.ProcessorFunction @@ -1122,249 +606,6 @@ func (c *InteractWithSharedClient) DoSomeSimilarThingsContext(ctx context.Contex return c.chClient.DoSomeSimilarThings(ctx) } -type reqInteractWithSharedDoSomeSimilarThings struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqInteractWithSharedDoSomeSimilarThings)(nil) - -// Deprecated: InteractWithSharedDoSomeSimilarThingsArgsDeprecated is deprecated, since it is supposed to be internal. -type InteractWithSharedDoSomeSimilarThingsArgsDeprecated = reqInteractWithSharedDoSomeSimilarThings - -func newReqInteractWithSharedDoSomeSimilarThings() *reqInteractWithSharedDoSomeSimilarThings { - return (&reqInteractWithSharedDoSomeSimilarThings{}).setDefaults() -} - - - -func (x *reqInteractWithSharedDoSomeSimilarThings) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqInteractWithSharedDoSomeSimilarThings"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqInteractWithSharedDoSomeSimilarThings) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqInteractWithSharedDoSomeSimilarThings) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqInteractWithSharedDoSomeSimilarThings({") - sb.WriteString("})") - - return sb.String() -} -func (x *reqInteractWithSharedDoSomeSimilarThings) setDefaults() *reqInteractWithSharedDoSomeSimilarThings { - return x -} - -type respInteractWithSharedDoSomeSimilarThings struct { - Success *shared.DoSomethingResult `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respInteractWithSharedDoSomeSimilarThings)(nil) -var _ thrift.WritableResult = (*respInteractWithSharedDoSomeSimilarThings)(nil) - -// Deprecated: InteractWithSharedDoSomeSimilarThingsResultDeprecated is deprecated, since it is supposed to be internal. -type InteractWithSharedDoSomeSimilarThingsResultDeprecated = respInteractWithSharedDoSomeSimilarThings - -func newRespInteractWithSharedDoSomeSimilarThings() *respInteractWithSharedDoSomeSimilarThings { - return (&respInteractWithSharedDoSomeSimilarThings{}).setDefaults() -} - -func (x *respInteractWithSharedDoSomeSimilarThings) GetSuccess() *shared.DoSomethingResult { - if !x.IsSetSuccess() { - return nil - } - return x.Success -} - -func (x *respInteractWithSharedDoSomeSimilarThings) SetSuccessNonCompat(value *shared.DoSomethingResult) *respInteractWithSharedDoSomeSimilarThings { - x.Success = value - return x -} - -func (x *respInteractWithSharedDoSomeSimilarThings) SetSuccess(value *shared.DoSomethingResult) *respInteractWithSharedDoSomeSimilarThings { - x.Success = value - return x -} - -func (x *respInteractWithSharedDoSomeSimilarThings) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respInteractWithSharedDoSomeSimilarThings) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Success - if err := item.Write(p); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respInteractWithSharedDoSomeSimilarThings) readField0(p thrift.Decoder) error { // Success - result := shared.NewDoSomethingResult() -err := result.Read(p) -if err != nil { - return err -} - - x.Success = result - return nil -} - -func (x *respInteractWithSharedDoSomeSimilarThings) toString0() string { // Success - return fmt.Sprintf("%v", x.Success) -} - -// Deprecated: Use newRespInteractWithSharedDoSomeSimilarThings().GetSuccess() instead. -func (x *respInteractWithSharedDoSomeSimilarThings) DefaultGetSuccess() *shared.DoSomethingResult { - if !x.IsSetSuccess() { - return shared.NewDoSomethingResult() - } - return x.Success -} - - - -func (x *respInteractWithSharedDoSomeSimilarThings) Exception() thrift.WritableException { - return nil -} - -func (x *respInteractWithSharedDoSomeSimilarThings) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respInteractWithSharedDoSomeSimilarThings"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respInteractWithSharedDoSomeSimilarThings) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.STRUCT)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respInteractWithSharedDoSomeSimilarThings) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respInteractWithSharedDoSomeSimilarThings({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respInteractWithSharedDoSomeSimilarThings) setDefaults() *respInteractWithSharedDoSomeSimilarThings { - return x -} - - type InteractWithSharedProcessor struct { processorFunctionMap map[string]thrift.ProcessorFunction diff --git a/thrift/compiler/test/fixtures/interactions/out/go/gen-go/module/types.go b/thrift/compiler/test/fixtures/interactions/out/go/gen-go/module/types.go index 361fd1e028e..33d7f5425f7 100644 --- a/thrift/compiler/test/fixtures/interactions/out/go/gen-go/module/types.go +++ b/thrift/compiler/test/fixtures/interactions/out/go/gen-go/module/types.go @@ -157,6 +157,763 @@ func (x *CustomException) Error() string { return x.String() } +// Service req/resp structs (below) +type reqMyServiceFoo struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqMyServiceFoo)(nil) + +// Deprecated: MyServiceFooArgsDeprecated is deprecated, since it is supposed to be internal. +type MyServiceFooArgsDeprecated = reqMyServiceFoo + +func newReqMyServiceFoo() *reqMyServiceFoo { + return (&reqMyServiceFoo{}).setDefaults() +} + + + +func (x *reqMyServiceFoo) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqMyServiceFoo"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqMyServiceFoo) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqMyServiceFoo) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqMyServiceFoo({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqMyServiceFoo) setDefaults() *reqMyServiceFoo { + return x +} + +type respMyServiceFoo struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respMyServiceFoo)(nil) +var _ thrift.WritableResult = (*respMyServiceFoo)(nil) + +// Deprecated: MyServiceFooResultDeprecated is deprecated, since it is supposed to be internal. +type MyServiceFooResultDeprecated = respMyServiceFoo + +func newRespMyServiceFoo() *respMyServiceFoo { + return (&respMyServiceFoo{}).setDefaults() +} + + + +func (x *respMyServiceFoo) Exception() thrift.WritableException { + return nil +} + +func (x *respMyServiceFoo) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respMyServiceFoo"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respMyServiceFoo) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respMyServiceFoo) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respMyServiceFoo({") + sb.WriteString("})") + + return sb.String() +} +func (x *respMyServiceFoo) setDefaults() *respMyServiceFoo { + return x +} + +type reqFactoriesFoo struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqFactoriesFoo)(nil) + +// Deprecated: FactoriesFooArgsDeprecated is deprecated, since it is supposed to be internal. +type FactoriesFooArgsDeprecated = reqFactoriesFoo + +func newReqFactoriesFoo() *reqFactoriesFoo { + return (&reqFactoriesFoo{}).setDefaults() +} + + + +func (x *reqFactoriesFoo) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqFactoriesFoo"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqFactoriesFoo) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqFactoriesFoo) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqFactoriesFoo({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqFactoriesFoo) setDefaults() *reqFactoriesFoo { + return x +} + +type respFactoriesFoo struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respFactoriesFoo)(nil) +var _ thrift.WritableResult = (*respFactoriesFoo)(nil) + +// Deprecated: FactoriesFooResultDeprecated is deprecated, since it is supposed to be internal. +type FactoriesFooResultDeprecated = respFactoriesFoo + +func newRespFactoriesFoo() *respFactoriesFoo { + return (&respFactoriesFoo{}).setDefaults() +} + + + +func (x *respFactoriesFoo) Exception() thrift.WritableException { + return nil +} + +func (x *respFactoriesFoo) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respFactoriesFoo"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respFactoriesFoo) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respFactoriesFoo) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respFactoriesFoo({") + sb.WriteString("})") + + return sb.String() +} +func (x *respFactoriesFoo) setDefaults() *respFactoriesFoo { + return x +} + +type reqPerformFoo struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqPerformFoo)(nil) + +// Deprecated: PerformFooArgsDeprecated is deprecated, since it is supposed to be internal. +type PerformFooArgsDeprecated = reqPerformFoo + +func newReqPerformFoo() *reqPerformFoo { + return (&reqPerformFoo{}).setDefaults() +} + + + +func (x *reqPerformFoo) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqPerformFoo"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqPerformFoo) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqPerformFoo) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqPerformFoo({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqPerformFoo) setDefaults() *reqPerformFoo { + return x +} + +type respPerformFoo struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respPerformFoo)(nil) +var _ thrift.WritableResult = (*respPerformFoo)(nil) + +// Deprecated: PerformFooResultDeprecated is deprecated, since it is supposed to be internal. +type PerformFooResultDeprecated = respPerformFoo + +func newRespPerformFoo() *respPerformFoo { + return (&respPerformFoo{}).setDefaults() +} + + + +func (x *respPerformFoo) Exception() thrift.WritableException { + return nil +} + +func (x *respPerformFoo) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respPerformFoo"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respPerformFoo) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respPerformFoo) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respPerformFoo({") + sb.WriteString("})") + + return sb.String() +} +func (x *respPerformFoo) setDefaults() *respPerformFoo { + return x +} + +type reqInteractWithSharedDoSomeSimilarThings struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqInteractWithSharedDoSomeSimilarThings)(nil) + +// Deprecated: InteractWithSharedDoSomeSimilarThingsArgsDeprecated is deprecated, since it is supposed to be internal. +type InteractWithSharedDoSomeSimilarThingsArgsDeprecated = reqInteractWithSharedDoSomeSimilarThings + +func newReqInteractWithSharedDoSomeSimilarThings() *reqInteractWithSharedDoSomeSimilarThings { + return (&reqInteractWithSharedDoSomeSimilarThings{}).setDefaults() +} + + + +func (x *reqInteractWithSharedDoSomeSimilarThings) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqInteractWithSharedDoSomeSimilarThings"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqInteractWithSharedDoSomeSimilarThings) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqInteractWithSharedDoSomeSimilarThings) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqInteractWithSharedDoSomeSimilarThings({") + sb.WriteString("})") + + return sb.String() +} +func (x *reqInteractWithSharedDoSomeSimilarThings) setDefaults() *reqInteractWithSharedDoSomeSimilarThings { + return x +} + +type respInteractWithSharedDoSomeSimilarThings struct { + Success *shared.DoSomethingResult `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respInteractWithSharedDoSomeSimilarThings)(nil) +var _ thrift.WritableResult = (*respInteractWithSharedDoSomeSimilarThings)(nil) + +// Deprecated: InteractWithSharedDoSomeSimilarThingsResultDeprecated is deprecated, since it is supposed to be internal. +type InteractWithSharedDoSomeSimilarThingsResultDeprecated = respInteractWithSharedDoSomeSimilarThings + +func newRespInteractWithSharedDoSomeSimilarThings() *respInteractWithSharedDoSomeSimilarThings { + return (&respInteractWithSharedDoSomeSimilarThings{}).setDefaults() +} + +func (x *respInteractWithSharedDoSomeSimilarThings) GetSuccess() *shared.DoSomethingResult { + if !x.IsSetSuccess() { + return nil + } + return x.Success +} + +func (x *respInteractWithSharedDoSomeSimilarThings) SetSuccessNonCompat(value *shared.DoSomethingResult) *respInteractWithSharedDoSomeSimilarThings { + x.Success = value + return x +} + +func (x *respInteractWithSharedDoSomeSimilarThings) SetSuccess(value *shared.DoSomethingResult) *respInteractWithSharedDoSomeSimilarThings { + x.Success = value + return x +} + +func (x *respInteractWithSharedDoSomeSimilarThings) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respInteractWithSharedDoSomeSimilarThings) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Success + if err := item.Write(p); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respInteractWithSharedDoSomeSimilarThings) readField0(p thrift.Decoder) error { // Success + result := shared.NewDoSomethingResult() +err := result.Read(p) +if err != nil { + return err +} + + x.Success = result + return nil +} + +func (x *respInteractWithSharedDoSomeSimilarThings) toString0() string { // Success + return fmt.Sprintf("%v", x.Success) +} + +// Deprecated: Use newRespInteractWithSharedDoSomeSimilarThings().GetSuccess() instead. +func (x *respInteractWithSharedDoSomeSimilarThings) DefaultGetSuccess() *shared.DoSomethingResult { + if !x.IsSetSuccess() { + return shared.NewDoSomethingResult() + } + return x.Success +} + + + +func (x *respInteractWithSharedDoSomeSimilarThings) Exception() thrift.WritableException { + return nil +} + +func (x *respInteractWithSharedDoSomeSimilarThings) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respInteractWithSharedDoSomeSimilarThings"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respInteractWithSharedDoSomeSimilarThings) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.STRUCT)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respInteractWithSharedDoSomeSimilarThings) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respInteractWithSharedDoSomeSimilarThings({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respInteractWithSharedDoSomeSimilarThings) setDefaults() *respInteractWithSharedDoSomeSimilarThings { + return x +} + + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/interactions/out/go/gen-go/shared/svcs.go b/thrift/compiler/test/fixtures/interactions/out/go/gen-go/shared/svcs.go index fdcd90c1080..d2331494b7a 100644 --- a/thrift/compiler/test/fixtures/interactions/out/go/gen-go/shared/svcs.go +++ b/thrift/compiler/test/fixtures/interactions/out/go/gen-go/shared/svcs.go @@ -76,7 +76,6 @@ func (c *InteractLocallyClient) Close() error { } - type InteractLocallyProcessor struct { processorFunctionMap map[string]thrift.ProcessorFunction functionServiceMap map[string]string diff --git a/thrift/compiler/test/fixtures/interactions/out/go/gen-go/shared/types.go b/thrift/compiler/test/fixtures/interactions/out/go/gen-go/shared/types.go index e380c748790..4df559d2dd7 100644 --- a/thrift/compiler/test/fixtures/interactions/out/go/gen-go/shared/types.go +++ b/thrift/compiler/test/fixtures/interactions/out/go/gen-go/shared/types.go @@ -204,6 +204,8 @@ func (x *DoSomethingResult) setDefaults() *DoSomethingResult { } +// Service req/resp structs (below) + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/cpp/types.go b/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/cpp/types.go index b7608402504..fde8434e68b 100644 --- a/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/cpp/types.go +++ b/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/cpp/types.go @@ -2282,6 +2282,7 @@ func (x *GenerateDeprecatedHeaderClientMethods) setDefaults() *GenerateDeprecate } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/scope/types.go b/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/scope/types.go index c2871133501..c8a6b005a41 100644 --- a/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/scope/types.go +++ b/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/scope/types.go @@ -1380,6 +1380,7 @@ func (x *Definition) setDefaults() *Definition { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/thrift/types.go b/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/thrift/types.go index 85cadd20f65..ba562235211 100644 --- a/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/thrift/types.go +++ b/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/thrift/types.go @@ -1804,6 +1804,7 @@ func (x *AllowReservedFilename) setDefaults() *AllowReservedFilename { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/namespace/out/go/gen-go/my/namespacing/test/module/svcs.go b/thrift/compiler/test/fixtures/namespace/out/go/gen-go/my/namespacing/test/module/svcs.go index 127a5b189f0..d9e79e750e0 100644 --- a/thrift/compiler/test/fixtures/namespace/out/go/gen-go/my/namespacing/test/module/svcs.go +++ b/thrift/compiler/test/fixtures/namespace/out/go/gen-go/my/namespacing/test/module/svcs.go @@ -98,296 +98,6 @@ func (c *TestServiceClient) InitContext(ctx context.Context, int1 int64) (int64, return c.chClient.Init(ctx, int1) } -type reqTestServiceInit struct { - Int1 int64 `thrift:"int1,1" json:"int1" db:"int1"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqTestServiceInit)(nil) - -// Deprecated: TestServiceInitArgsDeprecated is deprecated, since it is supposed to be internal. -type TestServiceInitArgsDeprecated = reqTestServiceInit - -func newReqTestServiceInit() *reqTestServiceInit { - return (&reqTestServiceInit{}).setDefaults() -} - -func (x *reqTestServiceInit) GetInt1() int64 { - return x.Int1 -} - -func (x *reqTestServiceInit) SetInt1NonCompat(value int64) *reqTestServiceInit { - x.Int1 = value - return x -} - -func (x *reqTestServiceInit) SetInt1(value int64) *reqTestServiceInit { - x.Int1 = value - return x -} - -func (x *reqTestServiceInit) writeField1(p thrift.Encoder) error { // Int1 - if err := p.WriteFieldBegin("int1", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Int1 - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqTestServiceInit) readField1(p thrift.Decoder) error { // Int1 - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Int1 = result - return nil -} - -func (x *reqTestServiceInit) toString1() string { // Int1 - return fmt.Sprintf("%v", x.Int1) -} - - - -func (x *reqTestServiceInit) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqTestServiceInit"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqTestServiceInit) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // int1 - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqTestServiceInit) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqTestServiceInit({") - sb.WriteString(fmt.Sprintf("Int1:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqTestServiceInit) setDefaults() *reqTestServiceInit { - return x. - SetInt1NonCompat(0) -} - -type respTestServiceInit struct { - Success *int64 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respTestServiceInit)(nil) -var _ thrift.WritableResult = (*respTestServiceInit)(nil) - -// Deprecated: TestServiceInitResultDeprecated is deprecated, since it is supposed to be internal. -type TestServiceInitResultDeprecated = respTestServiceInit - -func newRespTestServiceInit() *respTestServiceInit { - return (&respTestServiceInit{}).setDefaults() -} - -func (x *respTestServiceInit) GetSuccess() int64 { - if !x.IsSetSuccess() { - return 0 - } - return *x.Success -} - -func (x *respTestServiceInit) SetSuccessNonCompat(value int64) *respTestServiceInit { - x.Success = &value - return x -} - -func (x *respTestServiceInit) SetSuccess(value *int64) *respTestServiceInit { - x.Success = value - return x -} - -func (x *respTestServiceInit) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respTestServiceInit) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.I64, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respTestServiceInit) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respTestServiceInit) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respTestServiceInit) Exception() thrift.WritableException { - return nil -} - -func (x *respTestServiceInit) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respTestServiceInit"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respTestServiceInit) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.I64)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respTestServiceInit) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respTestServiceInit({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respTestServiceInit) setDefaults() *respTestServiceInit { - return x -} - - type TestServiceProcessor struct { processorFunctionMap map[string]thrift.ProcessorFunction diff --git a/thrift/compiler/test/fixtures/namespace/out/go/gen-go/my/namespacing/test/module/types.go b/thrift/compiler/test/fixtures/namespace/out/go/gen-go/my/namespacing/test/module/types.go index 634ff307e4e..40cf4d91144 100644 --- a/thrift/compiler/test/fixtures/namespace/out/go/gen-go/my/namespacing/test/module/types.go +++ b/thrift/compiler/test/fixtures/namespace/out/go/gen-go/my/namespacing/test/module/types.go @@ -152,6 +152,297 @@ func (x *Foo) setDefaults() *Foo { } +// Service req/resp structs (below) +type reqTestServiceInit struct { + Int1 int64 `thrift:"int1,1" json:"int1" db:"int1"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqTestServiceInit)(nil) + +// Deprecated: TestServiceInitArgsDeprecated is deprecated, since it is supposed to be internal. +type TestServiceInitArgsDeprecated = reqTestServiceInit + +func newReqTestServiceInit() *reqTestServiceInit { + return (&reqTestServiceInit{}).setDefaults() +} + +func (x *reqTestServiceInit) GetInt1() int64 { + return x.Int1 +} + +func (x *reqTestServiceInit) SetInt1NonCompat(value int64) *reqTestServiceInit { + x.Int1 = value + return x +} + +func (x *reqTestServiceInit) SetInt1(value int64) *reqTestServiceInit { + x.Int1 = value + return x +} + +func (x *reqTestServiceInit) writeField1(p thrift.Encoder) error { // Int1 + if err := p.WriteFieldBegin("int1", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Int1 + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqTestServiceInit) readField1(p thrift.Decoder) error { // Int1 + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Int1 = result + return nil +} + +func (x *reqTestServiceInit) toString1() string { // Int1 + return fmt.Sprintf("%v", x.Int1) +} + + + +func (x *reqTestServiceInit) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqTestServiceInit"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqTestServiceInit) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // int1 + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqTestServiceInit) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqTestServiceInit({") + sb.WriteString(fmt.Sprintf("Int1:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqTestServiceInit) setDefaults() *reqTestServiceInit { + return x. + SetInt1NonCompat(0) +} + +type respTestServiceInit struct { + Success *int64 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respTestServiceInit)(nil) +var _ thrift.WritableResult = (*respTestServiceInit)(nil) + +// Deprecated: TestServiceInitResultDeprecated is deprecated, since it is supposed to be internal. +type TestServiceInitResultDeprecated = respTestServiceInit + +func newRespTestServiceInit() *respTestServiceInit { + return (&respTestServiceInit{}).setDefaults() +} + +func (x *respTestServiceInit) GetSuccess() int64 { + if !x.IsSetSuccess() { + return 0 + } + return *x.Success +} + +func (x *respTestServiceInit) SetSuccessNonCompat(value int64) *respTestServiceInit { + x.Success = &value + return x +} + +func (x *respTestServiceInit) SetSuccess(value *int64) *respTestServiceInit { + x.Success = value + return x +} + +func (x *respTestServiceInit) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respTestServiceInit) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.I64, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respTestServiceInit) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respTestServiceInit) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respTestServiceInit) Exception() thrift.WritableException { + return nil +} + +func (x *respTestServiceInit) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respTestServiceInit"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respTestServiceInit) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.I64)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respTestServiceInit) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respTestServiceInit({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respTestServiceInit) setDefaults() *respTestServiceInit { + return x +} + + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/namespace/out/go_emptyns/gen-go/emptyns/svcs.go b/thrift/compiler/test/fixtures/namespace/out/go_emptyns/gen-go/emptyns/svcs.go index 37710d0ff46..d342bef14b5 100644 --- a/thrift/compiler/test/fixtures/namespace/out/go_emptyns/gen-go/emptyns/svcs.go +++ b/thrift/compiler/test/fixtures/namespace/out/go_emptyns/gen-go/emptyns/svcs.go @@ -98,296 +98,6 @@ func (c *TestServiceClient) InitContext(ctx context.Context, int1 int64) (int64, return c.chClient.Init(ctx, int1) } -type reqTestServiceInit struct { - Int1 int64 `thrift:"int1,1" json:"int1" db:"int1"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqTestServiceInit)(nil) - -// Deprecated: TestServiceInitArgsDeprecated is deprecated, since it is supposed to be internal. -type TestServiceInitArgsDeprecated = reqTestServiceInit - -func newReqTestServiceInit() *reqTestServiceInit { - return (&reqTestServiceInit{}).setDefaults() -} - -func (x *reqTestServiceInit) GetInt1() int64 { - return x.Int1 -} - -func (x *reqTestServiceInit) SetInt1NonCompat(value int64) *reqTestServiceInit { - x.Int1 = value - return x -} - -func (x *reqTestServiceInit) SetInt1(value int64) *reqTestServiceInit { - x.Int1 = value - return x -} - -func (x *reqTestServiceInit) writeField1(p thrift.Encoder) error { // Int1 - if err := p.WriteFieldBegin("int1", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Int1 - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqTestServiceInit) readField1(p thrift.Decoder) error { // Int1 - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Int1 = result - return nil -} - -func (x *reqTestServiceInit) toString1() string { // Int1 - return fmt.Sprintf("%v", x.Int1) -} - - - -func (x *reqTestServiceInit) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqTestServiceInit"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqTestServiceInit) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // int1 - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqTestServiceInit) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqTestServiceInit({") - sb.WriteString(fmt.Sprintf("Int1:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqTestServiceInit) setDefaults() *reqTestServiceInit { - return x. - SetInt1NonCompat(0) -} - -type respTestServiceInit struct { - Success *int64 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respTestServiceInit)(nil) -var _ thrift.WritableResult = (*respTestServiceInit)(nil) - -// Deprecated: TestServiceInitResultDeprecated is deprecated, since it is supposed to be internal. -type TestServiceInitResultDeprecated = respTestServiceInit - -func newRespTestServiceInit() *respTestServiceInit { - return (&respTestServiceInit{}).setDefaults() -} - -func (x *respTestServiceInit) GetSuccess() int64 { - if !x.IsSetSuccess() { - return 0 - } - return *x.Success -} - -func (x *respTestServiceInit) SetSuccessNonCompat(value int64) *respTestServiceInit { - x.Success = &value - return x -} - -func (x *respTestServiceInit) SetSuccess(value *int64) *respTestServiceInit { - x.Success = value - return x -} - -func (x *respTestServiceInit) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respTestServiceInit) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.I64, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respTestServiceInit) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respTestServiceInit) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respTestServiceInit) Exception() thrift.WritableException { - return nil -} - -func (x *respTestServiceInit) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respTestServiceInit"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respTestServiceInit) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.I64)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respTestServiceInit) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respTestServiceInit({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respTestServiceInit) setDefaults() *respTestServiceInit { - return x -} - - type TestServiceProcessor struct { processorFunctionMap map[string]thrift.ProcessorFunction diff --git a/thrift/compiler/test/fixtures/namespace/out/go_emptyns/gen-go/emptyns/types.go b/thrift/compiler/test/fixtures/namespace/out/go_emptyns/gen-go/emptyns/types.go index b4eb737c05e..b439b2670e6 100644 --- a/thrift/compiler/test/fixtures/namespace/out/go_emptyns/gen-go/emptyns/types.go +++ b/thrift/compiler/test/fixtures/namespace/out/go_emptyns/gen-go/emptyns/types.go @@ -152,6 +152,297 @@ func (x *Foo) setDefaults() *Foo { } +// Service req/resp structs (below) +type reqTestServiceInit struct { + Int1 int64 `thrift:"int1,1" json:"int1" db:"int1"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqTestServiceInit)(nil) + +// Deprecated: TestServiceInitArgsDeprecated is deprecated, since it is supposed to be internal. +type TestServiceInitArgsDeprecated = reqTestServiceInit + +func newReqTestServiceInit() *reqTestServiceInit { + return (&reqTestServiceInit{}).setDefaults() +} + +func (x *reqTestServiceInit) GetInt1() int64 { + return x.Int1 +} + +func (x *reqTestServiceInit) SetInt1NonCompat(value int64) *reqTestServiceInit { + x.Int1 = value + return x +} + +func (x *reqTestServiceInit) SetInt1(value int64) *reqTestServiceInit { + x.Int1 = value + return x +} + +func (x *reqTestServiceInit) writeField1(p thrift.Encoder) error { // Int1 + if err := p.WriteFieldBegin("int1", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Int1 + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqTestServiceInit) readField1(p thrift.Decoder) error { // Int1 + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Int1 = result + return nil +} + +func (x *reqTestServiceInit) toString1() string { // Int1 + return fmt.Sprintf("%v", x.Int1) +} + + + +func (x *reqTestServiceInit) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqTestServiceInit"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqTestServiceInit) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // int1 + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqTestServiceInit) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqTestServiceInit({") + sb.WriteString(fmt.Sprintf("Int1:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqTestServiceInit) setDefaults() *reqTestServiceInit { + return x. + SetInt1NonCompat(0) +} + +type respTestServiceInit struct { + Success *int64 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respTestServiceInit)(nil) +var _ thrift.WritableResult = (*respTestServiceInit)(nil) + +// Deprecated: TestServiceInitResultDeprecated is deprecated, since it is supposed to be internal. +type TestServiceInitResultDeprecated = respTestServiceInit + +func newRespTestServiceInit() *respTestServiceInit { + return (&respTestServiceInit{}).setDefaults() +} + +func (x *respTestServiceInit) GetSuccess() int64 { + if !x.IsSetSuccess() { + return 0 + } + return *x.Success +} + +func (x *respTestServiceInit) SetSuccessNonCompat(value int64) *respTestServiceInit { + x.Success = &value + return x +} + +func (x *respTestServiceInit) SetSuccess(value *int64) *respTestServiceInit { + x.Success = value + return x +} + +func (x *respTestServiceInit) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respTestServiceInit) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.I64, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respTestServiceInit) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respTestServiceInit) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respTestServiceInit) Exception() thrift.WritableException { + return nil +} + +func (x *respTestServiceInit) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respTestServiceInit"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respTestServiceInit) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.I64)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respTestServiceInit) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respTestServiceInit({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respTestServiceInit) setDefaults() *respTestServiceInit { + return x +} + + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/extend/test/svcs.go b/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/extend/test/svcs.go index 28f4a6ce72d..4d70daeb16e 100644 --- a/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/extend/test/svcs.go +++ b/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/extend/test/svcs.go @@ -112,316 +112,6 @@ func (c *ExtendTestServiceClient) CheckContext(ctx context.Context, struct1 *tes return c.chClient.Check(ctx, struct1) } -type reqExtendTestServiceCheck struct { - Struct1 *test0.HsFoo `thrift:"struct1,1" json:"struct1" db:"struct1"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqExtendTestServiceCheck)(nil) - -// Deprecated: ExtendTestServiceCheckArgsDeprecated is deprecated, since it is supposed to be internal. -type ExtendTestServiceCheckArgsDeprecated = reqExtendTestServiceCheck - -func newReqExtendTestServiceCheck() *reqExtendTestServiceCheck { - return (&reqExtendTestServiceCheck{}).setDefaults() -} - -func (x *reqExtendTestServiceCheck) GetStruct1() *test0.HsFoo { - if !x.IsSetStruct1() { - return nil - } - return x.Struct1 -} - -func (x *reqExtendTestServiceCheck) SetStruct1NonCompat(value *test0.HsFoo) *reqExtendTestServiceCheck { - x.Struct1 = value - return x -} - -func (x *reqExtendTestServiceCheck) SetStruct1(value *test0.HsFoo) *reqExtendTestServiceCheck { - x.Struct1 = value - return x -} - -func (x *reqExtendTestServiceCheck) IsSetStruct1() bool { - return x != nil && x.Struct1 != nil -} - -func (x *reqExtendTestServiceCheck) writeField1(p thrift.Encoder) error { // Struct1 - if !x.IsSetStruct1() { - return nil - } - - if err := p.WriteFieldBegin("struct1", thrift.STRUCT, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Struct1 - if err := item.Write(p); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqExtendTestServiceCheck) readField1(p thrift.Decoder) error { // Struct1 - result := test0.NewHsFoo() -err := result.Read(p) -if err != nil { - return err -} - - x.Struct1 = result - return nil -} - -func (x *reqExtendTestServiceCheck) toString1() string { // Struct1 - return fmt.Sprintf("%v", x.Struct1) -} - -// Deprecated: Use newReqExtendTestServiceCheck().GetStruct1() instead. -func (x *reqExtendTestServiceCheck) DefaultGetStruct1() *test0.HsFoo { - if !x.IsSetStruct1() { - return test0.NewHsFoo() - } - return x.Struct1 -} - - - -func (x *reqExtendTestServiceCheck) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqExtendTestServiceCheck"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqExtendTestServiceCheck) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.STRUCT)): // struct1 - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqExtendTestServiceCheck) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqExtendTestServiceCheck({") - sb.WriteString(fmt.Sprintf("Struct1:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqExtendTestServiceCheck) setDefaults() *reqExtendTestServiceCheck { - return x. - SetStruct1NonCompat(test0.NewHsFoo()) -} - -type respExtendTestServiceCheck struct { - Success *bool `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respExtendTestServiceCheck)(nil) -var _ thrift.WritableResult = (*respExtendTestServiceCheck)(nil) - -// Deprecated: ExtendTestServiceCheckResultDeprecated is deprecated, since it is supposed to be internal. -type ExtendTestServiceCheckResultDeprecated = respExtendTestServiceCheck - -func newRespExtendTestServiceCheck() *respExtendTestServiceCheck { - return (&respExtendTestServiceCheck{}).setDefaults() -} - -func (x *respExtendTestServiceCheck) GetSuccess() bool { - if !x.IsSetSuccess() { - return false - } - return *x.Success -} - -func (x *respExtendTestServiceCheck) SetSuccessNonCompat(value bool) *respExtendTestServiceCheck { - x.Success = &value - return x -} - -func (x *respExtendTestServiceCheck) SetSuccess(value *bool) *respExtendTestServiceCheck { - x.Success = value - return x -} - -func (x *respExtendTestServiceCheck) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respExtendTestServiceCheck) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.BOOL, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteBool(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respExtendTestServiceCheck) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadBool() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respExtendTestServiceCheck) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respExtendTestServiceCheck) Exception() thrift.WritableException { - return nil -} - -func (x *respExtendTestServiceCheck) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respExtendTestServiceCheck"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respExtendTestServiceCheck) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.BOOL)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respExtendTestServiceCheck) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respExtendTestServiceCheck({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respExtendTestServiceCheck) setDefaults() *respExtendTestServiceCheck { - return x -} - - type ExtendTestServiceProcessor struct { // Inherited/extended processor diff --git a/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/extend/test/types.go b/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/extend/test/types.go index 85867acc76f..d235418eb44 100644 --- a/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/extend/test/types.go +++ b/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/extend/test/types.go @@ -22,3 +22,314 @@ var _ = strings.Split var _ = thrift.ZERO +// Service req/resp structs (below) +type reqExtendTestServiceCheck struct { + Struct1 *test0.HsFoo `thrift:"struct1,1" json:"struct1" db:"struct1"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqExtendTestServiceCheck)(nil) + +// Deprecated: ExtendTestServiceCheckArgsDeprecated is deprecated, since it is supposed to be internal. +type ExtendTestServiceCheckArgsDeprecated = reqExtendTestServiceCheck + +func newReqExtendTestServiceCheck() *reqExtendTestServiceCheck { + return (&reqExtendTestServiceCheck{}).setDefaults() +} + +func (x *reqExtendTestServiceCheck) GetStruct1() *test0.HsFoo { + if !x.IsSetStruct1() { + return nil + } + return x.Struct1 +} + +func (x *reqExtendTestServiceCheck) SetStruct1NonCompat(value *test0.HsFoo) *reqExtendTestServiceCheck { + x.Struct1 = value + return x +} + +func (x *reqExtendTestServiceCheck) SetStruct1(value *test0.HsFoo) *reqExtendTestServiceCheck { + x.Struct1 = value + return x +} + +func (x *reqExtendTestServiceCheck) IsSetStruct1() bool { + return x != nil && x.Struct1 != nil +} + +func (x *reqExtendTestServiceCheck) writeField1(p thrift.Encoder) error { // Struct1 + if !x.IsSetStruct1() { + return nil + } + + if err := p.WriteFieldBegin("struct1", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Struct1 + if err := item.Write(p); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqExtendTestServiceCheck) readField1(p thrift.Decoder) error { // Struct1 + result := test0.NewHsFoo() +err := result.Read(p) +if err != nil { + return err +} + + x.Struct1 = result + return nil +} + +func (x *reqExtendTestServiceCheck) toString1() string { // Struct1 + return fmt.Sprintf("%v", x.Struct1) +} + +// Deprecated: Use newReqExtendTestServiceCheck().GetStruct1() instead. +func (x *reqExtendTestServiceCheck) DefaultGetStruct1() *test0.HsFoo { + if !x.IsSetStruct1() { + return test0.NewHsFoo() + } + return x.Struct1 +} + + + +func (x *reqExtendTestServiceCheck) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqExtendTestServiceCheck"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqExtendTestServiceCheck) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.STRUCT)): // struct1 + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqExtendTestServiceCheck) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqExtendTestServiceCheck({") + sb.WriteString(fmt.Sprintf("Struct1:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqExtendTestServiceCheck) setDefaults() *reqExtendTestServiceCheck { + return x. + SetStruct1NonCompat(test0.NewHsFoo()) +} + +type respExtendTestServiceCheck struct { + Success *bool `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respExtendTestServiceCheck)(nil) +var _ thrift.WritableResult = (*respExtendTestServiceCheck)(nil) + +// Deprecated: ExtendTestServiceCheckResultDeprecated is deprecated, since it is supposed to be internal. +type ExtendTestServiceCheckResultDeprecated = respExtendTestServiceCheck + +func newRespExtendTestServiceCheck() *respExtendTestServiceCheck { + return (&respExtendTestServiceCheck{}).setDefaults() +} + +func (x *respExtendTestServiceCheck) GetSuccess() bool { + if !x.IsSetSuccess() { + return false + } + return *x.Success +} + +func (x *respExtendTestServiceCheck) SetSuccessNonCompat(value bool) *respExtendTestServiceCheck { + x.Success = &value + return x +} + +func (x *respExtendTestServiceCheck) SetSuccess(value *bool) *respExtendTestServiceCheck { + x.Success = value + return x +} + +func (x *respExtendTestServiceCheck) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respExtendTestServiceCheck) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.BOOL, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteBool(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respExtendTestServiceCheck) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadBool() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respExtendTestServiceCheck) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respExtendTestServiceCheck) Exception() thrift.WritableException { + return nil +} + +func (x *respExtendTestServiceCheck) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respExtendTestServiceCheck"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respExtendTestServiceCheck) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.BOOL)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respExtendTestServiceCheck) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respExtendTestServiceCheck({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respExtendTestServiceCheck) setDefaults() *respExtendTestServiceCheck { + return x +} + + diff --git a/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/test/svcs.go b/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/test/svcs.go index 6951ef1dc66..fe415985e25 100644 --- a/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/test/svcs.go +++ b/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/test/svcs.go @@ -98,296 +98,6 @@ func (c *HsTestServiceClient) InitContext(ctx context.Context, int1 int64) (int6 return c.chClient.Init(ctx, int1) } -type reqHsTestServiceInit struct { - Int1 int64 `thrift:"int1,1" json:"int1" db:"int1"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqHsTestServiceInit)(nil) - -// Deprecated: HsTestServiceInitArgsDeprecated is deprecated, since it is supposed to be internal. -type HsTestServiceInitArgsDeprecated = reqHsTestServiceInit - -func newReqHsTestServiceInit() *reqHsTestServiceInit { - return (&reqHsTestServiceInit{}).setDefaults() -} - -func (x *reqHsTestServiceInit) GetInt1() int64 { - return x.Int1 -} - -func (x *reqHsTestServiceInit) SetInt1NonCompat(value int64) *reqHsTestServiceInit { - x.Int1 = value - return x -} - -func (x *reqHsTestServiceInit) SetInt1(value int64) *reqHsTestServiceInit { - x.Int1 = value - return x -} - -func (x *reqHsTestServiceInit) writeField1(p thrift.Encoder) error { // Int1 - if err := p.WriteFieldBegin("int1", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Int1 - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqHsTestServiceInit) readField1(p thrift.Decoder) error { // Int1 - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Int1 = result - return nil -} - -func (x *reqHsTestServiceInit) toString1() string { // Int1 - return fmt.Sprintf("%v", x.Int1) -} - - - -func (x *reqHsTestServiceInit) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqHsTestServiceInit"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqHsTestServiceInit) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // int1 - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqHsTestServiceInit) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqHsTestServiceInit({") - sb.WriteString(fmt.Sprintf("Int1:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqHsTestServiceInit) setDefaults() *reqHsTestServiceInit { - return x. - SetInt1NonCompat(0) -} - -type respHsTestServiceInit struct { - Success *int64 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respHsTestServiceInit)(nil) -var _ thrift.WritableResult = (*respHsTestServiceInit)(nil) - -// Deprecated: HsTestServiceInitResultDeprecated is deprecated, since it is supposed to be internal. -type HsTestServiceInitResultDeprecated = respHsTestServiceInit - -func newRespHsTestServiceInit() *respHsTestServiceInit { - return (&respHsTestServiceInit{}).setDefaults() -} - -func (x *respHsTestServiceInit) GetSuccess() int64 { - if !x.IsSetSuccess() { - return 0 - } - return *x.Success -} - -func (x *respHsTestServiceInit) SetSuccessNonCompat(value int64) *respHsTestServiceInit { - x.Success = &value - return x -} - -func (x *respHsTestServiceInit) SetSuccess(value *int64) *respHsTestServiceInit { - x.Success = value - return x -} - -func (x *respHsTestServiceInit) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respHsTestServiceInit) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.I64, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respHsTestServiceInit) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respHsTestServiceInit) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respHsTestServiceInit) Exception() thrift.WritableException { - return nil -} - -func (x *respHsTestServiceInit) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respHsTestServiceInit"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respHsTestServiceInit) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.I64)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respHsTestServiceInit) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respHsTestServiceInit({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respHsTestServiceInit) setDefaults() *respHsTestServiceInit { - return x -} - - type HsTestServiceProcessor struct { processorFunctionMap map[string]thrift.ProcessorFunction diff --git a/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/test/types.go b/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/test/types.go index 3d05a40ad69..775a4d2221f 100644 --- a/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/test/types.go +++ b/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/test/types.go @@ -152,6 +152,297 @@ func (x *HsFoo) setDefaults() *HsFoo { } +// Service req/resp structs (below) +type reqHsTestServiceInit struct { + Int1 int64 `thrift:"int1,1" json:"int1" db:"int1"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqHsTestServiceInit)(nil) + +// Deprecated: HsTestServiceInitArgsDeprecated is deprecated, since it is supposed to be internal. +type HsTestServiceInitArgsDeprecated = reqHsTestServiceInit + +func newReqHsTestServiceInit() *reqHsTestServiceInit { + return (&reqHsTestServiceInit{}).setDefaults() +} + +func (x *reqHsTestServiceInit) GetInt1() int64 { + return x.Int1 +} + +func (x *reqHsTestServiceInit) SetInt1NonCompat(value int64) *reqHsTestServiceInit { + x.Int1 = value + return x +} + +func (x *reqHsTestServiceInit) SetInt1(value int64) *reqHsTestServiceInit { + x.Int1 = value + return x +} + +func (x *reqHsTestServiceInit) writeField1(p thrift.Encoder) error { // Int1 + if err := p.WriteFieldBegin("int1", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Int1 + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqHsTestServiceInit) readField1(p thrift.Decoder) error { // Int1 + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Int1 = result + return nil +} + +func (x *reqHsTestServiceInit) toString1() string { // Int1 + return fmt.Sprintf("%v", x.Int1) +} + + + +func (x *reqHsTestServiceInit) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqHsTestServiceInit"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqHsTestServiceInit) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // int1 + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqHsTestServiceInit) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqHsTestServiceInit({") + sb.WriteString(fmt.Sprintf("Int1:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqHsTestServiceInit) setDefaults() *reqHsTestServiceInit { + return x. + SetInt1NonCompat(0) +} + +type respHsTestServiceInit struct { + Success *int64 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respHsTestServiceInit)(nil) +var _ thrift.WritableResult = (*respHsTestServiceInit)(nil) + +// Deprecated: HsTestServiceInitResultDeprecated is deprecated, since it is supposed to be internal. +type HsTestServiceInitResultDeprecated = respHsTestServiceInit + +func newRespHsTestServiceInit() *respHsTestServiceInit { + return (&respHsTestServiceInit{}).setDefaults() +} + +func (x *respHsTestServiceInit) GetSuccess() int64 { + if !x.IsSetSuccess() { + return 0 + } + return *x.Success +} + +func (x *respHsTestServiceInit) SetSuccessNonCompat(value int64) *respHsTestServiceInit { + x.Success = &value + return x +} + +func (x *respHsTestServiceInit) SetSuccess(value *int64) *respHsTestServiceInit { + x.Success = value + return x +} + +func (x *respHsTestServiceInit) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respHsTestServiceInit) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.I64, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respHsTestServiceInit) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respHsTestServiceInit) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respHsTestServiceInit) Exception() thrift.WritableException { + return nil +} + +func (x *respHsTestServiceInit) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respHsTestServiceInit"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respHsTestServiceInit) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.I64)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respHsTestServiceInit) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respHsTestServiceInit({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respHsTestServiceInit) setDefaults() *respHsTestServiceInit { + return x +} + + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/namespace/out/go_hsmodule/gen-go/my/namespacing/test/svcs.go b/thrift/compiler/test/fixtures/namespace/out/go_hsmodule/gen-go/my/namespacing/test/svcs.go index ac6c3698fce..8a74a8db72f 100644 --- a/thrift/compiler/test/fixtures/namespace/out/go_hsmodule/gen-go/my/namespacing/test/svcs.go +++ b/thrift/compiler/test/fixtures/namespace/out/go_hsmodule/gen-go/my/namespacing/test/svcs.go @@ -98,296 +98,6 @@ func (c *HsTestServiceClient) InitContext(ctx context.Context, int1 int64) (int6 return c.chClient.Init(ctx, int1) } -type reqHsTestServiceInit struct { - Int1 int64 `thrift:"int1,1" json:"int1" db:"int1"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqHsTestServiceInit)(nil) - -// Deprecated: HsTestServiceInitArgsDeprecated is deprecated, since it is supposed to be internal. -type HsTestServiceInitArgsDeprecated = reqHsTestServiceInit - -func newReqHsTestServiceInit() *reqHsTestServiceInit { - return (&reqHsTestServiceInit{}).setDefaults() -} - -func (x *reqHsTestServiceInit) GetInt1() int64 { - return x.Int1 -} - -func (x *reqHsTestServiceInit) SetInt1NonCompat(value int64) *reqHsTestServiceInit { - x.Int1 = value - return x -} - -func (x *reqHsTestServiceInit) SetInt1(value int64) *reqHsTestServiceInit { - x.Int1 = value - return x -} - -func (x *reqHsTestServiceInit) writeField1(p thrift.Encoder) error { // Int1 - if err := p.WriteFieldBegin("int1", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Int1 - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqHsTestServiceInit) readField1(p thrift.Decoder) error { // Int1 - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Int1 = result - return nil -} - -func (x *reqHsTestServiceInit) toString1() string { // Int1 - return fmt.Sprintf("%v", x.Int1) -} - - - -func (x *reqHsTestServiceInit) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqHsTestServiceInit"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqHsTestServiceInit) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // int1 - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqHsTestServiceInit) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqHsTestServiceInit({") - sb.WriteString(fmt.Sprintf("Int1:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqHsTestServiceInit) setDefaults() *reqHsTestServiceInit { - return x. - SetInt1NonCompat(0) -} - -type respHsTestServiceInit struct { - Success *int64 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respHsTestServiceInit)(nil) -var _ thrift.WritableResult = (*respHsTestServiceInit)(nil) - -// Deprecated: HsTestServiceInitResultDeprecated is deprecated, since it is supposed to be internal. -type HsTestServiceInitResultDeprecated = respHsTestServiceInit - -func newRespHsTestServiceInit() *respHsTestServiceInit { - return (&respHsTestServiceInit{}).setDefaults() -} - -func (x *respHsTestServiceInit) GetSuccess() int64 { - if !x.IsSetSuccess() { - return 0 - } - return *x.Success -} - -func (x *respHsTestServiceInit) SetSuccessNonCompat(value int64) *respHsTestServiceInit { - x.Success = &value - return x -} - -func (x *respHsTestServiceInit) SetSuccess(value *int64) *respHsTestServiceInit { - x.Success = value - return x -} - -func (x *respHsTestServiceInit) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respHsTestServiceInit) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.I64, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respHsTestServiceInit) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respHsTestServiceInit) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respHsTestServiceInit) Exception() thrift.WritableException { - return nil -} - -func (x *respHsTestServiceInit) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respHsTestServiceInit"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respHsTestServiceInit) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.I64)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respHsTestServiceInit) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respHsTestServiceInit({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respHsTestServiceInit) setDefaults() *respHsTestServiceInit { - return x -} - - type HsTestServiceProcessor struct { processorFunctionMap map[string]thrift.ProcessorFunction diff --git a/thrift/compiler/test/fixtures/namespace/out/go_hsmodule/gen-go/my/namespacing/test/types.go b/thrift/compiler/test/fixtures/namespace/out/go_hsmodule/gen-go/my/namespacing/test/types.go index 6315052e0d1..4cb2b9426e3 100644 --- a/thrift/compiler/test/fixtures/namespace/out/go_hsmodule/gen-go/my/namespacing/test/types.go +++ b/thrift/compiler/test/fixtures/namespace/out/go_hsmodule/gen-go/my/namespacing/test/types.go @@ -152,6 +152,297 @@ func (x *HsFoo) setDefaults() *HsFoo { } +// Service req/resp structs (below) +type reqHsTestServiceInit struct { + Int1 int64 `thrift:"int1,1" json:"int1" db:"int1"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqHsTestServiceInit)(nil) + +// Deprecated: HsTestServiceInitArgsDeprecated is deprecated, since it is supposed to be internal. +type HsTestServiceInitArgsDeprecated = reqHsTestServiceInit + +func newReqHsTestServiceInit() *reqHsTestServiceInit { + return (&reqHsTestServiceInit{}).setDefaults() +} + +func (x *reqHsTestServiceInit) GetInt1() int64 { + return x.Int1 +} + +func (x *reqHsTestServiceInit) SetInt1NonCompat(value int64) *reqHsTestServiceInit { + x.Int1 = value + return x +} + +func (x *reqHsTestServiceInit) SetInt1(value int64) *reqHsTestServiceInit { + x.Int1 = value + return x +} + +func (x *reqHsTestServiceInit) writeField1(p thrift.Encoder) error { // Int1 + if err := p.WriteFieldBegin("int1", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Int1 + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqHsTestServiceInit) readField1(p thrift.Decoder) error { // Int1 + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Int1 = result + return nil +} + +func (x *reqHsTestServiceInit) toString1() string { // Int1 + return fmt.Sprintf("%v", x.Int1) +} + + + +func (x *reqHsTestServiceInit) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqHsTestServiceInit"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqHsTestServiceInit) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // int1 + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqHsTestServiceInit) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqHsTestServiceInit({") + sb.WriteString(fmt.Sprintf("Int1:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqHsTestServiceInit) setDefaults() *reqHsTestServiceInit { + return x. + SetInt1NonCompat(0) +} + +type respHsTestServiceInit struct { + Success *int64 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respHsTestServiceInit)(nil) +var _ thrift.WritableResult = (*respHsTestServiceInit)(nil) + +// Deprecated: HsTestServiceInitResultDeprecated is deprecated, since it is supposed to be internal. +type HsTestServiceInitResultDeprecated = respHsTestServiceInit + +func newRespHsTestServiceInit() *respHsTestServiceInit { + return (&respHsTestServiceInit{}).setDefaults() +} + +func (x *respHsTestServiceInit) GetSuccess() int64 { + if !x.IsSetSuccess() { + return 0 + } + return *x.Success +} + +func (x *respHsTestServiceInit) SetSuccessNonCompat(value int64) *respHsTestServiceInit { + x.Success = &value + return x +} + +func (x *respHsTestServiceInit) SetSuccess(value *int64) *respHsTestServiceInit { + x.Success = value + return x +} + +func (x *respHsTestServiceInit) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respHsTestServiceInit) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.I64, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respHsTestServiceInit) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respHsTestServiceInit) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respHsTestServiceInit) Exception() thrift.WritableException { + return nil +} + +func (x *respHsTestServiceInit) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respHsTestServiceInit"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respHsTestServiceInit) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.I64)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respHsTestServiceInit) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respHsTestServiceInit({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respHsTestServiceInit) setDefaults() *respHsTestServiceInit { + return x +} + + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/namespace/out/go_quoted/gen-go/my/namespacing/test/module/svcs.go b/thrift/compiler/test/fixtures/namespace/out/go_quoted/gen-go/my/namespacing/test/module/svcs.go index 9af67648bfa..b7563fc0c10 100644 --- a/thrift/compiler/test/fixtures/namespace/out/go_quoted/gen-go/my/namespacing/test/module/svcs.go +++ b/thrift/compiler/test/fixtures/namespace/out/go_quoted/gen-go/my/namespacing/test/module/svcs.go @@ -98,296 +98,6 @@ func (c *TestServiceClient) InitContext(ctx context.Context, int1 int64) (int64, return c.chClient.Init(ctx, int1) } -type reqTestServiceInit struct { - Int1 int64 `thrift:"int1,1" json:"int1" db:"int1"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqTestServiceInit)(nil) - -// Deprecated: TestServiceInitArgsDeprecated is deprecated, since it is supposed to be internal. -type TestServiceInitArgsDeprecated = reqTestServiceInit - -func newReqTestServiceInit() *reqTestServiceInit { - return (&reqTestServiceInit{}).setDefaults() -} - -func (x *reqTestServiceInit) GetInt1() int64 { - return x.Int1 -} - -func (x *reqTestServiceInit) SetInt1NonCompat(value int64) *reqTestServiceInit { - x.Int1 = value - return x -} - -func (x *reqTestServiceInit) SetInt1(value int64) *reqTestServiceInit { - x.Int1 = value - return x -} - -func (x *reqTestServiceInit) writeField1(p thrift.Encoder) error { // Int1 - if err := p.WriteFieldBegin("int1", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Int1 - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqTestServiceInit) readField1(p thrift.Decoder) error { // Int1 - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Int1 = result - return nil -} - -func (x *reqTestServiceInit) toString1() string { // Int1 - return fmt.Sprintf("%v", x.Int1) -} - - - -func (x *reqTestServiceInit) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqTestServiceInit"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqTestServiceInit) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // int1 - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqTestServiceInit) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqTestServiceInit({") - sb.WriteString(fmt.Sprintf("Int1:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqTestServiceInit) setDefaults() *reqTestServiceInit { - return x. - SetInt1NonCompat(0) -} - -type respTestServiceInit struct { - Success *int64 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respTestServiceInit)(nil) -var _ thrift.WritableResult = (*respTestServiceInit)(nil) - -// Deprecated: TestServiceInitResultDeprecated is deprecated, since it is supposed to be internal. -type TestServiceInitResultDeprecated = respTestServiceInit - -func newRespTestServiceInit() *respTestServiceInit { - return (&respTestServiceInit{}).setDefaults() -} - -func (x *respTestServiceInit) GetSuccess() int64 { - if !x.IsSetSuccess() { - return 0 - } - return *x.Success -} - -func (x *respTestServiceInit) SetSuccessNonCompat(value int64) *respTestServiceInit { - x.Success = &value - return x -} - -func (x *respTestServiceInit) SetSuccess(value *int64) *respTestServiceInit { - x.Success = value - return x -} - -func (x *respTestServiceInit) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respTestServiceInit) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.I64, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respTestServiceInit) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respTestServiceInit) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respTestServiceInit) Exception() thrift.WritableException { - return nil -} - -func (x *respTestServiceInit) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respTestServiceInit"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respTestServiceInit) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.I64)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respTestServiceInit) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respTestServiceInit({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respTestServiceInit) setDefaults() *respTestServiceInit { - return x -} - - type TestServiceProcessor struct { processorFunctionMap map[string]thrift.ProcessorFunction diff --git a/thrift/compiler/test/fixtures/namespace/out/go_quoted/gen-go/my/namespacing/test/module/types.go b/thrift/compiler/test/fixtures/namespace/out/go_quoted/gen-go/my/namespacing/test/module/types.go index a854af213cb..54e089a751f 100644 --- a/thrift/compiler/test/fixtures/namespace/out/go_quoted/gen-go/my/namespacing/test/module/types.go +++ b/thrift/compiler/test/fixtures/namespace/out/go_quoted/gen-go/my/namespacing/test/module/types.go @@ -152,6 +152,297 @@ func (x *Foo) setDefaults() *Foo { } +// Service req/resp structs (below) +type reqTestServiceInit struct { + Int1 int64 `thrift:"int1,1" json:"int1" db:"int1"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqTestServiceInit)(nil) + +// Deprecated: TestServiceInitArgsDeprecated is deprecated, since it is supposed to be internal. +type TestServiceInitArgsDeprecated = reqTestServiceInit + +func newReqTestServiceInit() *reqTestServiceInit { + return (&reqTestServiceInit{}).setDefaults() +} + +func (x *reqTestServiceInit) GetInt1() int64 { + return x.Int1 +} + +func (x *reqTestServiceInit) SetInt1NonCompat(value int64) *reqTestServiceInit { + x.Int1 = value + return x +} + +func (x *reqTestServiceInit) SetInt1(value int64) *reqTestServiceInit { + x.Int1 = value + return x +} + +func (x *reqTestServiceInit) writeField1(p thrift.Encoder) error { // Int1 + if err := p.WriteFieldBegin("int1", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Int1 + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqTestServiceInit) readField1(p thrift.Decoder) error { // Int1 + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Int1 = result + return nil +} + +func (x *reqTestServiceInit) toString1() string { // Int1 + return fmt.Sprintf("%v", x.Int1) +} + + + +func (x *reqTestServiceInit) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqTestServiceInit"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqTestServiceInit) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // int1 + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqTestServiceInit) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqTestServiceInit({") + sb.WriteString(fmt.Sprintf("Int1:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqTestServiceInit) setDefaults() *reqTestServiceInit { + return x. + SetInt1NonCompat(0) +} + +type respTestServiceInit struct { + Success *int64 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respTestServiceInit)(nil) +var _ thrift.WritableResult = (*respTestServiceInit)(nil) + +// Deprecated: TestServiceInitResultDeprecated is deprecated, since it is supposed to be internal. +type TestServiceInitResultDeprecated = respTestServiceInit + +func newRespTestServiceInit() *respTestServiceInit { + return (&respTestServiceInit{}).setDefaults() +} + +func (x *respTestServiceInit) GetSuccess() int64 { + if !x.IsSetSuccess() { + return 0 + } + return *x.Success +} + +func (x *respTestServiceInit) SetSuccessNonCompat(value int64) *respTestServiceInit { + x.Success = &value + return x +} + +func (x *respTestServiceInit) SetSuccess(value *int64) *respTestServiceInit { + x.Success = value + return x +} + +func (x *respTestServiceInit) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respTestServiceInit) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.I64, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respTestServiceInit) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respTestServiceInit) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respTestServiceInit) Exception() thrift.WritableException { + return nil +} + +func (x *respTestServiceInit) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respTestServiceInit"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respTestServiceInit) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.I64)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respTestServiceInit) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respTestServiceInit({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respTestServiceInit) setDefaults() *respTestServiceInit { + return x +} + + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/namespace_from_package/out/go/gen-go/namespace_from_package/module/svcs.go b/thrift/compiler/test/fixtures/namespace_from_package/out/go/gen-go/namespace_from_package/module/svcs.go index 4021a0d263e..a176deee8e3 100644 --- a/thrift/compiler/test/fixtures/namespace_from_package/out/go/gen-go/namespace_from_package/module/svcs.go +++ b/thrift/compiler/test/fixtures/namespace_from_package/out/go/gen-go/namespace_from_package/module/svcs.go @@ -98,296 +98,6 @@ func (c *TestServiceClient) InitContext(ctx context.Context, int1 int64) (int64, return c.chClient.Init(ctx, int1) } -type reqTestServiceInit struct { - Int1 int64 `thrift:"int1,1" json:"int1" db:"int1"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqTestServiceInit)(nil) - -// Deprecated: TestServiceInitArgsDeprecated is deprecated, since it is supposed to be internal. -type TestServiceInitArgsDeprecated = reqTestServiceInit - -func newReqTestServiceInit() *reqTestServiceInit { - return (&reqTestServiceInit{}).setDefaults() -} - -func (x *reqTestServiceInit) GetInt1() int64 { - return x.Int1 -} - -func (x *reqTestServiceInit) SetInt1NonCompat(value int64) *reqTestServiceInit { - x.Int1 = value - return x -} - -func (x *reqTestServiceInit) SetInt1(value int64) *reqTestServiceInit { - x.Int1 = value - return x -} - -func (x *reqTestServiceInit) writeField1(p thrift.Encoder) error { // Int1 - if err := p.WriteFieldBegin("int1", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Int1 - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqTestServiceInit) readField1(p thrift.Decoder) error { // Int1 - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Int1 = result - return nil -} - -func (x *reqTestServiceInit) toString1() string { // Int1 - return fmt.Sprintf("%v", x.Int1) -} - - - -func (x *reqTestServiceInit) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqTestServiceInit"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqTestServiceInit) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // int1 - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqTestServiceInit) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqTestServiceInit({") - sb.WriteString(fmt.Sprintf("Int1:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqTestServiceInit) setDefaults() *reqTestServiceInit { - return x. - SetInt1NonCompat(0) -} - -type respTestServiceInit struct { - Success *int64 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respTestServiceInit)(nil) -var _ thrift.WritableResult = (*respTestServiceInit)(nil) - -// Deprecated: TestServiceInitResultDeprecated is deprecated, since it is supposed to be internal. -type TestServiceInitResultDeprecated = respTestServiceInit - -func newRespTestServiceInit() *respTestServiceInit { - return (&respTestServiceInit{}).setDefaults() -} - -func (x *respTestServiceInit) GetSuccess() int64 { - if !x.IsSetSuccess() { - return 0 - } - return *x.Success -} - -func (x *respTestServiceInit) SetSuccessNonCompat(value int64) *respTestServiceInit { - x.Success = &value - return x -} - -func (x *respTestServiceInit) SetSuccess(value *int64) *respTestServiceInit { - x.Success = value - return x -} - -func (x *respTestServiceInit) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respTestServiceInit) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.I64, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respTestServiceInit) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respTestServiceInit) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respTestServiceInit) Exception() thrift.WritableException { - return nil -} - -func (x *respTestServiceInit) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respTestServiceInit"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respTestServiceInit) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.I64)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respTestServiceInit) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respTestServiceInit({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respTestServiceInit) setDefaults() *respTestServiceInit { - return x -} - - type TestServiceProcessor struct { processorFunctionMap map[string]thrift.ProcessorFunction diff --git a/thrift/compiler/test/fixtures/namespace_from_package/out/go/gen-go/namespace_from_package/module/types.go b/thrift/compiler/test/fixtures/namespace_from_package/out/go/gen-go/namespace_from_package/module/types.go index 0b21f7f8f53..9fe149d246b 100644 --- a/thrift/compiler/test/fixtures/namespace_from_package/out/go/gen-go/namespace_from_package/module/types.go +++ b/thrift/compiler/test/fixtures/namespace_from_package/out/go/gen-go/namespace_from_package/module/types.go @@ -152,6 +152,297 @@ func (x *Foo) setDefaults() *Foo { } +// Service req/resp structs (below) +type reqTestServiceInit struct { + Int1 int64 `thrift:"int1,1" json:"int1" db:"int1"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqTestServiceInit)(nil) + +// Deprecated: TestServiceInitArgsDeprecated is deprecated, since it is supposed to be internal. +type TestServiceInitArgsDeprecated = reqTestServiceInit + +func newReqTestServiceInit() *reqTestServiceInit { + return (&reqTestServiceInit{}).setDefaults() +} + +func (x *reqTestServiceInit) GetInt1() int64 { + return x.Int1 +} + +func (x *reqTestServiceInit) SetInt1NonCompat(value int64) *reqTestServiceInit { + x.Int1 = value + return x +} + +func (x *reqTestServiceInit) SetInt1(value int64) *reqTestServiceInit { + x.Int1 = value + return x +} + +func (x *reqTestServiceInit) writeField1(p thrift.Encoder) error { // Int1 + if err := p.WriteFieldBegin("int1", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Int1 + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqTestServiceInit) readField1(p thrift.Decoder) error { // Int1 + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Int1 = result + return nil +} + +func (x *reqTestServiceInit) toString1() string { // Int1 + return fmt.Sprintf("%v", x.Int1) +} + + + +func (x *reqTestServiceInit) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqTestServiceInit"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqTestServiceInit) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // int1 + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqTestServiceInit) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqTestServiceInit({") + sb.WriteString(fmt.Sprintf("Int1:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqTestServiceInit) setDefaults() *reqTestServiceInit { + return x. + SetInt1NonCompat(0) +} + +type respTestServiceInit struct { + Success *int64 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respTestServiceInit)(nil) +var _ thrift.WritableResult = (*respTestServiceInit)(nil) + +// Deprecated: TestServiceInitResultDeprecated is deprecated, since it is supposed to be internal. +type TestServiceInitResultDeprecated = respTestServiceInit + +func newRespTestServiceInit() *respTestServiceInit { + return (&respTestServiceInit{}).setDefaults() +} + +func (x *respTestServiceInit) GetSuccess() int64 { + if !x.IsSetSuccess() { + return 0 + } + return *x.Success +} + +func (x *respTestServiceInit) SetSuccessNonCompat(value int64) *respTestServiceInit { + x.Success = &value + return x +} + +func (x *respTestServiceInit) SetSuccess(value *int64) *respTestServiceInit { + x.Success = value + return x +} + +func (x *respTestServiceInit) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respTestServiceInit) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.I64, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respTestServiceInit) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respTestServiceInit) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respTestServiceInit) Exception() thrift.WritableException { + return nil +} + +func (x *respTestServiceInit) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respTestServiceInit"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respTestServiceInit) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.I64)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respTestServiceInit) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respTestServiceInit({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respTestServiceInit) setDefaults() *respTestServiceInit { + return x +} + + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/go/gen-go/namespace_from_package_without_module_name/module/svcs.go b/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/go/gen-go/namespace_from_package_without_module_name/module/svcs.go index 9098d1b3d8a..48ce5583123 100644 --- a/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/go/gen-go/namespace_from_package_without_module_name/module/svcs.go +++ b/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/go/gen-go/namespace_from_package_without_module_name/module/svcs.go @@ -98,296 +98,6 @@ func (c *TestServiceClient) InitContext(ctx context.Context, int1 int64) (int64, return c.chClient.Init(ctx, int1) } -type reqTestServiceInit struct { - Int1 int64 `thrift:"int1,1" json:"int1" db:"int1"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqTestServiceInit)(nil) - -// Deprecated: TestServiceInitArgsDeprecated is deprecated, since it is supposed to be internal. -type TestServiceInitArgsDeprecated = reqTestServiceInit - -func newReqTestServiceInit() *reqTestServiceInit { - return (&reqTestServiceInit{}).setDefaults() -} - -func (x *reqTestServiceInit) GetInt1() int64 { - return x.Int1 -} - -func (x *reqTestServiceInit) SetInt1NonCompat(value int64) *reqTestServiceInit { - x.Int1 = value - return x -} - -func (x *reqTestServiceInit) SetInt1(value int64) *reqTestServiceInit { - x.Int1 = value - return x -} - -func (x *reqTestServiceInit) writeField1(p thrift.Encoder) error { // Int1 - if err := p.WriteFieldBegin("int1", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Int1 - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqTestServiceInit) readField1(p thrift.Decoder) error { // Int1 - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Int1 = result - return nil -} - -func (x *reqTestServiceInit) toString1() string { // Int1 - return fmt.Sprintf("%v", x.Int1) -} - - - -func (x *reqTestServiceInit) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqTestServiceInit"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqTestServiceInit) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.I64)): // int1 - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqTestServiceInit) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqTestServiceInit({") - sb.WriteString(fmt.Sprintf("Int1:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqTestServiceInit) setDefaults() *reqTestServiceInit { - return x. - SetInt1NonCompat(0) -} - -type respTestServiceInit struct { - Success *int64 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respTestServiceInit)(nil) -var _ thrift.WritableResult = (*respTestServiceInit)(nil) - -// Deprecated: TestServiceInitResultDeprecated is deprecated, since it is supposed to be internal. -type TestServiceInitResultDeprecated = respTestServiceInit - -func newRespTestServiceInit() *respTestServiceInit { - return (&respTestServiceInit{}).setDefaults() -} - -func (x *respTestServiceInit) GetSuccess() int64 { - if !x.IsSetSuccess() { - return 0 - } - return *x.Success -} - -func (x *respTestServiceInit) SetSuccessNonCompat(value int64) *respTestServiceInit { - x.Success = &value - return x -} - -func (x *respTestServiceInit) SetSuccess(value *int64) *respTestServiceInit { - x.Success = value - return x -} - -func (x *respTestServiceInit) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respTestServiceInit) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.I64, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := *x.Success - if err := p.WriteI64(item); err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respTestServiceInit) readField0(p thrift.Decoder) error { // Success - result, err := p.ReadI64() -if err != nil { - return err -} - - x.Success = &result - return nil -} - -func (x *respTestServiceInit) toString0() string { // Success - if x.IsSetSuccess() { - return fmt.Sprintf("%v", *x.Success) - } - return fmt.Sprintf("%v", x.Success) -} - - - - -func (x *respTestServiceInit) Exception() thrift.WritableException { - return nil -} - -func (x *respTestServiceInit) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respTestServiceInit"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respTestServiceInit) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.I64)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respTestServiceInit) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respTestServiceInit({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respTestServiceInit) setDefaults() *respTestServiceInit { - return x -} - - type TestServiceProcessor struct { processorFunctionMap map[string]thrift.ProcessorFunction diff --git a/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/go/gen-go/namespace_from_package_without_module_name/module/types.go b/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/go/gen-go/namespace_from_package_without_module_name/module/types.go index 200bfd25b0d..ce5d824c2ae 100644 --- a/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/go/gen-go/namespace_from_package_without_module_name/module/types.go +++ b/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/go/gen-go/namespace_from_package_without_module_name/module/types.go @@ -152,6 +152,297 @@ func (x *Foo) setDefaults() *Foo { } +// Service req/resp structs (below) +type reqTestServiceInit struct { + Int1 int64 `thrift:"int1,1" json:"int1" db:"int1"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqTestServiceInit)(nil) + +// Deprecated: TestServiceInitArgsDeprecated is deprecated, since it is supposed to be internal. +type TestServiceInitArgsDeprecated = reqTestServiceInit + +func newReqTestServiceInit() *reqTestServiceInit { + return (&reqTestServiceInit{}).setDefaults() +} + +func (x *reqTestServiceInit) GetInt1() int64 { + return x.Int1 +} + +func (x *reqTestServiceInit) SetInt1NonCompat(value int64) *reqTestServiceInit { + x.Int1 = value + return x +} + +func (x *reqTestServiceInit) SetInt1(value int64) *reqTestServiceInit { + x.Int1 = value + return x +} + +func (x *reqTestServiceInit) writeField1(p thrift.Encoder) error { // Int1 + if err := p.WriteFieldBegin("int1", thrift.I64, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Int1 + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqTestServiceInit) readField1(p thrift.Decoder) error { // Int1 + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Int1 = result + return nil +} + +func (x *reqTestServiceInit) toString1() string { // Int1 + return fmt.Sprintf("%v", x.Int1) +} + + + +func (x *reqTestServiceInit) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqTestServiceInit"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqTestServiceInit) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.I64)): // int1 + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqTestServiceInit) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqTestServiceInit({") + sb.WriteString(fmt.Sprintf("Int1:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqTestServiceInit) setDefaults() *reqTestServiceInit { + return x. + SetInt1NonCompat(0) +} + +type respTestServiceInit struct { + Success *int64 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respTestServiceInit)(nil) +var _ thrift.WritableResult = (*respTestServiceInit)(nil) + +// Deprecated: TestServiceInitResultDeprecated is deprecated, since it is supposed to be internal. +type TestServiceInitResultDeprecated = respTestServiceInit + +func newRespTestServiceInit() *respTestServiceInit { + return (&respTestServiceInit{}).setDefaults() +} + +func (x *respTestServiceInit) GetSuccess() int64 { + if !x.IsSetSuccess() { + return 0 + } + return *x.Success +} + +func (x *respTestServiceInit) SetSuccessNonCompat(value int64) *respTestServiceInit { + x.Success = &value + return x +} + +func (x *respTestServiceInit) SetSuccess(value *int64) *respTestServiceInit { + x.Success = value + return x +} + +func (x *respTestServiceInit) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respTestServiceInit) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.I64, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := *x.Success + if err := p.WriteI64(item); err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respTestServiceInit) readField0(p thrift.Decoder) error { // Success + result, err := p.ReadI64() +if err != nil { + return err +} + + x.Success = &result + return nil +} + +func (x *respTestServiceInit) toString0() string { // Success + if x.IsSetSuccess() { + return fmt.Sprintf("%v", *x.Success) + } + return fmt.Sprintf("%v", x.Success) +} + + + + +func (x *respTestServiceInit) Exception() thrift.WritableException { + return nil +} + +func (x *respTestServiceInit) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respTestServiceInit"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respTestServiceInit) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.I64)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respTestServiceInit) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respTestServiceInit({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respTestServiceInit) setDefaults() *respTestServiceInit { + return x +} + + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/optionals/out/go/gen-go/module/types.go b/thrift/compiler/test/fixtures/optionals/out/go/gen-go/module/types.go index d4ae3fd7b1d..7800c83f3a6 100644 --- a/thrift/compiler/test/fixtures/optionals/out/go/gen-go/module/types.go +++ b/thrift/compiler/test/fixtures/optionals/out/go/gen-go/module/types.go @@ -1609,6 +1609,7 @@ func (x *Person) setDefaults() *Person { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/params/out/go/gen-go/module/svcs.go b/thrift/compiler/test/fixtures/params/out/go/gen-go/module/svcs.go index 315df4dc8ea..200473a6f3a 100644 --- a/thrift/compiler/test/fixtures/params/out/go/gen-go/module/svcs.go +++ b/thrift/compiler/test/fixtures/params/out/go/gen-go/module/svcs.go @@ -190,1619 +190,6 @@ func (c *NestedContainersClient) TurtlesContext(ctx context.Context, foo [][]map return c.chClient.Turtles(ctx, foo) } -type reqNestedContainersMapList struct { - Foo map[int32][]int32 `thrift:"foo,1" json:"foo" db:"foo"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqNestedContainersMapList)(nil) - -// Deprecated: NestedContainersMapListArgsDeprecated is deprecated, since it is supposed to be internal. -type NestedContainersMapListArgsDeprecated = reqNestedContainersMapList - -func newReqNestedContainersMapList() *reqNestedContainersMapList { - return (&reqNestedContainersMapList{}).setDefaults() -} - -func (x *reqNestedContainersMapList) GetFoo() map[int32][]int32 { - if !x.IsSetFoo() { - return make(map[int32][]int32) - } - return x.Foo -} - -func (x *reqNestedContainersMapList) SetFooNonCompat(value map[int32][]int32) *reqNestedContainersMapList { - x.Foo = value - return x -} - -func (x *reqNestedContainersMapList) SetFoo(value map[int32][]int32) *reqNestedContainersMapList { - x.Foo = value - return x -} - -func (x *reqNestedContainersMapList) IsSetFoo() bool { - return x != nil && x.Foo != nil -} - -func (x *reqNestedContainersMapList) writeField1(p thrift.Encoder) error { // Foo - if err := p.WriteFieldBegin("foo", thrift.MAP, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Foo - if err := p.WriteMapBegin(thrift.I32, thrift.LIST, len(item)); err != nil { - return thrift.PrependError("error writing map begin: ", err) -} -for k, v := range item { - { - item := k - if err := p.WriteI32(item); err != nil { - return err -} - } - - { - item := v - if err := p.WriteListBegin(thrift.I32, len(item)); err != nil { - return thrift.PrependError("error writing list begin: ", err) -} -for _, v := range item { - { - item := v - if err := p.WriteI32(item); err != nil { - return err -} - } -} -if err := p.WriteListEnd(); err != nil { - return thrift.PrependError("error writing list end: ", err) -} - } -} -if err := p.WriteMapEnd(); err != nil { - return thrift.PrependError("error writing map end: ", err) -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqNestedContainersMapList) readField1(p thrift.Decoder) error { // Foo - _ /* keyType */, _ /* valueType */, size, err := p.ReadMapBegin() -if err != nil { - return thrift.PrependError("error reading map begin: ", err) -} - -mapResult := make(map[int32][]int32, size) -for i := 0; i < size; i++ { - var key int32 - { - result, err := p.ReadI32() -if err != nil { - return err -} - key = result - } - - var value []int32 - { - _ /* elemType */, size, err := p.ReadListBegin() -if err != nil { - return thrift.PrependError("error reading list begin: ", err) -} - -listResult := make([]int32, 0, size) -for i := 0; i < size; i++ { - var elem int32 - { - result, err := p.ReadI32() -if err != nil { - return err -} - elem = result - } - listResult = append(listResult, elem) -} - -if err := p.ReadListEnd(); err != nil { - return thrift.PrependError("error reading list end: ", err) -} -result := listResult - value = result - } - - mapResult[key] = value -} - -if err := p.ReadMapEnd(); err != nil { - return thrift.PrependError("error reading map end: ", err) -} -result := mapResult - - x.Foo = result - return nil -} - -func (x *reqNestedContainersMapList) toString1() string { // Foo - return fmt.Sprintf("%v", x.Foo) -} - - - -func (x *reqNestedContainersMapList) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqNestedContainersMapList"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqNestedContainersMapList) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.MAP)): // foo - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqNestedContainersMapList) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqNestedContainersMapList({") - sb.WriteString(fmt.Sprintf("Foo:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqNestedContainersMapList) setDefaults() *reqNestedContainersMapList { - return x. - SetFooNonCompat(make(map[int32][]int32)) -} - -type respNestedContainersMapList struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respNestedContainersMapList)(nil) -var _ thrift.WritableResult = (*respNestedContainersMapList)(nil) - -// Deprecated: NestedContainersMapListResultDeprecated is deprecated, since it is supposed to be internal. -type NestedContainersMapListResultDeprecated = respNestedContainersMapList - -func newRespNestedContainersMapList() *respNestedContainersMapList { - return (&respNestedContainersMapList{}).setDefaults() -} - - - -func (x *respNestedContainersMapList) Exception() thrift.WritableException { - return nil -} - -func (x *respNestedContainersMapList) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respNestedContainersMapList"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respNestedContainersMapList) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respNestedContainersMapList) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respNestedContainersMapList({") - sb.WriteString("})") - - return sb.String() -} -func (x *respNestedContainersMapList) setDefaults() *respNestedContainersMapList { - return x -} - -type reqNestedContainersMapSet struct { - Foo map[int32][]int32 `thrift:"foo,1" json:"foo" db:"foo"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqNestedContainersMapSet)(nil) - -// Deprecated: NestedContainersMapSetArgsDeprecated is deprecated, since it is supposed to be internal. -type NestedContainersMapSetArgsDeprecated = reqNestedContainersMapSet - -func newReqNestedContainersMapSet() *reqNestedContainersMapSet { - return (&reqNestedContainersMapSet{}).setDefaults() -} - -func (x *reqNestedContainersMapSet) GetFoo() map[int32][]int32 { - if !x.IsSetFoo() { - return make(map[int32][]int32) - } - return x.Foo -} - -func (x *reqNestedContainersMapSet) SetFooNonCompat(value map[int32][]int32) *reqNestedContainersMapSet { - x.Foo = value - return x -} - -func (x *reqNestedContainersMapSet) SetFoo(value map[int32][]int32) *reqNestedContainersMapSet { - x.Foo = value - return x -} - -func (x *reqNestedContainersMapSet) IsSetFoo() bool { - return x != nil && x.Foo != nil -} - -func (x *reqNestedContainersMapSet) writeField1(p thrift.Encoder) error { // Foo - if err := p.WriteFieldBegin("foo", thrift.MAP, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Foo - if err := p.WriteMapBegin(thrift.I32, thrift.SET, len(item)); err != nil { - return thrift.PrependError("error writing map begin: ", err) -} -for k, v := range item { - { - item := k - if err := p.WriteI32(item); err != nil { - return err -} - } - - { - item := v - if err := p.WriteSetBegin(thrift.I32, len(item)); err != nil { - return thrift.PrependError("error writing set begin: ", err) -} -for _, v := range item { - { - item := v - if err := p.WriteI32(item); err != nil { - return err -} - } -} -if err := p.WriteSetEnd(); err != nil { - return thrift.PrependError("error writing set end: ", err) -} - } -} -if err := p.WriteMapEnd(); err != nil { - return thrift.PrependError("error writing map end: ", err) -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqNestedContainersMapSet) readField1(p thrift.Decoder) error { // Foo - _ /* keyType */, _ /* valueType */, size, err := p.ReadMapBegin() -if err != nil { - return thrift.PrependError("error reading map begin: ", err) -} - -mapResult := make(map[int32][]int32, size) -for i := 0; i < size; i++ { - var key int32 - { - result, err := p.ReadI32() -if err != nil { - return err -} - key = result - } - - var value []int32 - { - _ /* elemType */, size, err := p.ReadSetBegin() -if err != nil { - return thrift.PrependError("error reading set begin: ", err) -} - -setResult := make([]int32, 0, size) -for i := 0; i < size; i++ { - var elem int32 - { - result, err := p.ReadI32() -if err != nil { - return err -} - elem = result - } - setResult = append(setResult, elem) -} - -if err := p.ReadSetEnd(); err != nil { - return thrift.PrependError("error reading set end: ", err) -} -result := setResult - value = result - } - - mapResult[key] = value -} - -if err := p.ReadMapEnd(); err != nil { - return thrift.PrependError("error reading map end: ", err) -} -result := mapResult - - x.Foo = result - return nil -} - -func (x *reqNestedContainersMapSet) toString1() string { // Foo - return fmt.Sprintf("%v", x.Foo) -} - - - -func (x *reqNestedContainersMapSet) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqNestedContainersMapSet"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqNestedContainersMapSet) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.MAP)): // foo - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqNestedContainersMapSet) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqNestedContainersMapSet({") - sb.WriteString(fmt.Sprintf("Foo:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqNestedContainersMapSet) setDefaults() *reqNestedContainersMapSet { - return x. - SetFooNonCompat(make(map[int32][]int32)) -} - -type respNestedContainersMapSet struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respNestedContainersMapSet)(nil) -var _ thrift.WritableResult = (*respNestedContainersMapSet)(nil) - -// Deprecated: NestedContainersMapSetResultDeprecated is deprecated, since it is supposed to be internal. -type NestedContainersMapSetResultDeprecated = respNestedContainersMapSet - -func newRespNestedContainersMapSet() *respNestedContainersMapSet { - return (&respNestedContainersMapSet{}).setDefaults() -} - - - -func (x *respNestedContainersMapSet) Exception() thrift.WritableException { - return nil -} - -func (x *respNestedContainersMapSet) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respNestedContainersMapSet"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respNestedContainersMapSet) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respNestedContainersMapSet) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respNestedContainersMapSet({") - sb.WriteString("})") - - return sb.String() -} -func (x *respNestedContainersMapSet) setDefaults() *respNestedContainersMapSet { - return x -} - -type reqNestedContainersListMap struct { - Foo []map[int32]int32 `thrift:"foo,1" json:"foo" db:"foo"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqNestedContainersListMap)(nil) - -// Deprecated: NestedContainersListMapArgsDeprecated is deprecated, since it is supposed to be internal. -type NestedContainersListMapArgsDeprecated = reqNestedContainersListMap - -func newReqNestedContainersListMap() *reqNestedContainersListMap { - return (&reqNestedContainersListMap{}).setDefaults() -} - -func (x *reqNestedContainersListMap) GetFoo() []map[int32]int32 { - if !x.IsSetFoo() { - return make([]map[int32]int32, 0) - } - return x.Foo -} - -func (x *reqNestedContainersListMap) SetFooNonCompat(value []map[int32]int32) *reqNestedContainersListMap { - x.Foo = value - return x -} - -func (x *reqNestedContainersListMap) SetFoo(value []map[int32]int32) *reqNestedContainersListMap { - x.Foo = value - return x -} - -func (x *reqNestedContainersListMap) IsSetFoo() bool { - return x != nil && x.Foo != nil -} - -func (x *reqNestedContainersListMap) writeField1(p thrift.Encoder) error { // Foo - if err := p.WriteFieldBegin("foo", thrift.LIST, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Foo - if err := p.WriteListBegin(thrift.MAP, len(item)); err != nil { - return thrift.PrependError("error writing list begin: ", err) -} -for _, v := range item { - { - item := v - if err := p.WriteMapBegin(thrift.I32, thrift.I32, len(item)); err != nil { - return thrift.PrependError("error writing map begin: ", err) -} -for k, v := range item { - { - item := k - if err := p.WriteI32(item); err != nil { - return err -} - } - - { - item := v - if err := p.WriteI32(item); err != nil { - return err -} - } -} -if err := p.WriteMapEnd(); err != nil { - return thrift.PrependError("error writing map end: ", err) -} - } -} -if err := p.WriteListEnd(); err != nil { - return thrift.PrependError("error writing list end: ", err) -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqNestedContainersListMap) readField1(p thrift.Decoder) error { // Foo - _ /* elemType */, size, err := p.ReadListBegin() -if err != nil { - return thrift.PrependError("error reading list begin: ", err) -} - -listResult := make([]map[int32]int32, 0, size) -for i := 0; i < size; i++ { - var elem map[int32]int32 - { - _ /* keyType */, _ /* valueType */, size, err := p.ReadMapBegin() -if err != nil { - return thrift.PrependError("error reading map begin: ", err) -} - -mapResult := make(map[int32]int32, size) -for i := 0; i < size; i++ { - var key int32 - { - result, err := p.ReadI32() -if err != nil { - return err -} - key = result - } - - var value int32 - { - result, err := p.ReadI32() -if err != nil { - return err -} - value = result - } - - mapResult[key] = value -} - -if err := p.ReadMapEnd(); err != nil { - return thrift.PrependError("error reading map end: ", err) -} -result := mapResult - elem = result - } - listResult = append(listResult, elem) -} - -if err := p.ReadListEnd(); err != nil { - return thrift.PrependError("error reading list end: ", err) -} -result := listResult - - x.Foo = result - return nil -} - -func (x *reqNestedContainersListMap) toString1() string { // Foo - return fmt.Sprintf("%v", x.Foo) -} - - - -func (x *reqNestedContainersListMap) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqNestedContainersListMap"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqNestedContainersListMap) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.LIST)): // foo - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqNestedContainersListMap) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqNestedContainersListMap({") - sb.WriteString(fmt.Sprintf("Foo:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqNestedContainersListMap) setDefaults() *reqNestedContainersListMap { - return x. - SetFooNonCompat(make([]map[int32]int32, 0)) -} - -type respNestedContainersListMap struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respNestedContainersListMap)(nil) -var _ thrift.WritableResult = (*respNestedContainersListMap)(nil) - -// Deprecated: NestedContainersListMapResultDeprecated is deprecated, since it is supposed to be internal. -type NestedContainersListMapResultDeprecated = respNestedContainersListMap - -func newRespNestedContainersListMap() *respNestedContainersListMap { - return (&respNestedContainersListMap{}).setDefaults() -} - - - -func (x *respNestedContainersListMap) Exception() thrift.WritableException { - return nil -} - -func (x *respNestedContainersListMap) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respNestedContainersListMap"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respNestedContainersListMap) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respNestedContainersListMap) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respNestedContainersListMap({") - sb.WriteString("})") - - return sb.String() -} -func (x *respNestedContainersListMap) setDefaults() *respNestedContainersListMap { - return x -} - -type reqNestedContainersListSet struct { - Foo [][]int32 `thrift:"foo,1" json:"foo" db:"foo"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqNestedContainersListSet)(nil) - -// Deprecated: NestedContainersListSetArgsDeprecated is deprecated, since it is supposed to be internal. -type NestedContainersListSetArgsDeprecated = reqNestedContainersListSet - -func newReqNestedContainersListSet() *reqNestedContainersListSet { - return (&reqNestedContainersListSet{}).setDefaults() -} - -func (x *reqNestedContainersListSet) GetFoo() [][]int32 { - if !x.IsSetFoo() { - return make([][]int32, 0) - } - return x.Foo -} - -func (x *reqNestedContainersListSet) SetFooNonCompat(value [][]int32) *reqNestedContainersListSet { - x.Foo = value - return x -} - -func (x *reqNestedContainersListSet) SetFoo(value [][]int32) *reqNestedContainersListSet { - x.Foo = value - return x -} - -func (x *reqNestedContainersListSet) IsSetFoo() bool { - return x != nil && x.Foo != nil -} - -func (x *reqNestedContainersListSet) writeField1(p thrift.Encoder) error { // Foo - if err := p.WriteFieldBegin("foo", thrift.LIST, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Foo - if err := p.WriteListBegin(thrift.SET, len(item)); err != nil { - return thrift.PrependError("error writing list begin: ", err) -} -for _, v := range item { - { - item := v - if err := p.WriteSetBegin(thrift.I32, len(item)); err != nil { - return thrift.PrependError("error writing set begin: ", err) -} -for _, v := range item { - { - item := v - if err := p.WriteI32(item); err != nil { - return err -} - } -} -if err := p.WriteSetEnd(); err != nil { - return thrift.PrependError("error writing set end: ", err) -} - } -} -if err := p.WriteListEnd(); err != nil { - return thrift.PrependError("error writing list end: ", err) -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqNestedContainersListSet) readField1(p thrift.Decoder) error { // Foo - _ /* elemType */, size, err := p.ReadListBegin() -if err != nil { - return thrift.PrependError("error reading list begin: ", err) -} - -listResult := make([][]int32, 0, size) -for i := 0; i < size; i++ { - var elem []int32 - { - _ /* elemType */, size, err := p.ReadSetBegin() -if err != nil { - return thrift.PrependError("error reading set begin: ", err) -} - -setResult := make([]int32, 0, size) -for i := 0; i < size; i++ { - var elem int32 - { - result, err := p.ReadI32() -if err != nil { - return err -} - elem = result - } - setResult = append(setResult, elem) -} - -if err := p.ReadSetEnd(); err != nil { - return thrift.PrependError("error reading set end: ", err) -} -result := setResult - elem = result - } - listResult = append(listResult, elem) -} - -if err := p.ReadListEnd(); err != nil { - return thrift.PrependError("error reading list end: ", err) -} -result := listResult - - x.Foo = result - return nil -} - -func (x *reqNestedContainersListSet) toString1() string { // Foo - return fmt.Sprintf("%v", x.Foo) -} - - - -func (x *reqNestedContainersListSet) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqNestedContainersListSet"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqNestedContainersListSet) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.LIST)): // foo - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqNestedContainersListSet) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqNestedContainersListSet({") - sb.WriteString(fmt.Sprintf("Foo:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqNestedContainersListSet) setDefaults() *reqNestedContainersListSet { - return x. - SetFooNonCompat(make([][]int32, 0)) -} - -type respNestedContainersListSet struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respNestedContainersListSet)(nil) -var _ thrift.WritableResult = (*respNestedContainersListSet)(nil) - -// Deprecated: NestedContainersListSetResultDeprecated is deprecated, since it is supposed to be internal. -type NestedContainersListSetResultDeprecated = respNestedContainersListSet - -func newRespNestedContainersListSet() *respNestedContainersListSet { - return (&respNestedContainersListSet{}).setDefaults() -} - - - -func (x *respNestedContainersListSet) Exception() thrift.WritableException { - return nil -} - -func (x *respNestedContainersListSet) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respNestedContainersListSet"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respNestedContainersListSet) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respNestedContainersListSet) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respNestedContainersListSet({") - sb.WriteString("})") - - return sb.String() -} -func (x *respNestedContainersListSet) setDefaults() *respNestedContainersListSet { - return x -} - -type reqNestedContainersTurtles struct { - Foo [][]map[int32]map[int32][]int32 `thrift:"foo,1" json:"foo" db:"foo"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqNestedContainersTurtles)(nil) - -// Deprecated: NestedContainersTurtlesArgsDeprecated is deprecated, since it is supposed to be internal. -type NestedContainersTurtlesArgsDeprecated = reqNestedContainersTurtles - -func newReqNestedContainersTurtles() *reqNestedContainersTurtles { - return (&reqNestedContainersTurtles{}).setDefaults() -} - -func (x *reqNestedContainersTurtles) GetFoo() [][]map[int32]map[int32][]int32 { - if !x.IsSetFoo() { - return make([][]map[int32]map[int32][]int32, 0) - } - return x.Foo -} - -func (x *reqNestedContainersTurtles) SetFooNonCompat(value [][]map[int32]map[int32][]int32) *reqNestedContainersTurtles { - x.Foo = value - return x -} - -func (x *reqNestedContainersTurtles) SetFoo(value [][]map[int32]map[int32][]int32) *reqNestedContainersTurtles { - x.Foo = value - return x -} - -func (x *reqNestedContainersTurtles) IsSetFoo() bool { - return x != nil && x.Foo != nil -} - -func (x *reqNestedContainersTurtles) writeField1(p thrift.Encoder) error { // Foo - if err := p.WriteFieldBegin("foo", thrift.LIST, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Foo - if err := p.WriteListBegin(thrift.LIST, len(item)); err != nil { - return thrift.PrependError("error writing list begin: ", err) -} -for _, v := range item { - { - item := v - if err := p.WriteListBegin(thrift.MAP, len(item)); err != nil { - return thrift.PrependError("error writing list begin: ", err) -} -for _, v := range item { - { - item := v - if err := p.WriteMapBegin(thrift.I32, thrift.MAP, len(item)); err != nil { - return thrift.PrependError("error writing map begin: ", err) -} -for k, v := range item { - { - item := k - if err := p.WriteI32(item); err != nil { - return err -} - } - - { - item := v - if err := p.WriteMapBegin(thrift.I32, thrift.SET, len(item)); err != nil { - return thrift.PrependError("error writing map begin: ", err) -} -for k, v := range item { - { - item := k - if err := p.WriteI32(item); err != nil { - return err -} - } - - { - item := v - if err := p.WriteSetBegin(thrift.I32, len(item)); err != nil { - return thrift.PrependError("error writing set begin: ", err) -} -for _, v := range item { - { - item := v - if err := p.WriteI32(item); err != nil { - return err -} - } -} -if err := p.WriteSetEnd(); err != nil { - return thrift.PrependError("error writing set end: ", err) -} - } -} -if err := p.WriteMapEnd(); err != nil { - return thrift.PrependError("error writing map end: ", err) -} - } -} -if err := p.WriteMapEnd(); err != nil { - return thrift.PrependError("error writing map end: ", err) -} - } -} -if err := p.WriteListEnd(); err != nil { - return thrift.PrependError("error writing list end: ", err) -} - } -} -if err := p.WriteListEnd(); err != nil { - return thrift.PrependError("error writing list end: ", err) -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqNestedContainersTurtles) readField1(p thrift.Decoder) error { // Foo - _ /* elemType */, size, err := p.ReadListBegin() -if err != nil { - return thrift.PrependError("error reading list begin: ", err) -} - -listResult := make([][]map[int32]map[int32][]int32, 0, size) -for i := 0; i < size; i++ { - var elem []map[int32]map[int32][]int32 - { - _ /* elemType */, size, err := p.ReadListBegin() -if err != nil { - return thrift.PrependError("error reading list begin: ", err) -} - -listResult := make([]map[int32]map[int32][]int32, 0, size) -for i := 0; i < size; i++ { - var elem map[int32]map[int32][]int32 - { - _ /* keyType */, _ /* valueType */, size, err := p.ReadMapBegin() -if err != nil { - return thrift.PrependError("error reading map begin: ", err) -} - -mapResult := make(map[int32]map[int32][]int32, size) -for i := 0; i < size; i++ { - var key int32 - { - result, err := p.ReadI32() -if err != nil { - return err -} - key = result - } - - var value map[int32][]int32 - { - _ /* keyType */, _ /* valueType */, size, err := p.ReadMapBegin() -if err != nil { - return thrift.PrependError("error reading map begin: ", err) -} - -mapResult := make(map[int32][]int32, size) -for i := 0; i < size; i++ { - var key int32 - { - result, err := p.ReadI32() -if err != nil { - return err -} - key = result - } - - var value []int32 - { - _ /* elemType */, size, err := p.ReadSetBegin() -if err != nil { - return thrift.PrependError("error reading set begin: ", err) -} - -setResult := make([]int32, 0, size) -for i := 0; i < size; i++ { - var elem int32 - { - result, err := p.ReadI32() -if err != nil { - return err -} - elem = result - } - setResult = append(setResult, elem) -} - -if err := p.ReadSetEnd(); err != nil { - return thrift.PrependError("error reading set end: ", err) -} -result := setResult - value = result - } - - mapResult[key] = value -} - -if err := p.ReadMapEnd(); err != nil { - return thrift.PrependError("error reading map end: ", err) -} -result := mapResult - value = result - } - - mapResult[key] = value -} - -if err := p.ReadMapEnd(); err != nil { - return thrift.PrependError("error reading map end: ", err) -} -result := mapResult - elem = result - } - listResult = append(listResult, elem) -} - -if err := p.ReadListEnd(); err != nil { - return thrift.PrependError("error reading list end: ", err) -} -result := listResult - elem = result - } - listResult = append(listResult, elem) -} - -if err := p.ReadListEnd(); err != nil { - return thrift.PrependError("error reading list end: ", err) -} -result := listResult - - x.Foo = result - return nil -} - -func (x *reqNestedContainersTurtles) toString1() string { // Foo - return fmt.Sprintf("%v", x.Foo) -} - - - -func (x *reqNestedContainersTurtles) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqNestedContainersTurtles"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqNestedContainersTurtles) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.LIST)): // foo - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqNestedContainersTurtles) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqNestedContainersTurtles({") - sb.WriteString(fmt.Sprintf("Foo:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqNestedContainersTurtles) setDefaults() *reqNestedContainersTurtles { - return x. - SetFooNonCompat(make([][]map[int32]map[int32][]int32, 0)) -} - -type respNestedContainersTurtles struct { -} -// Compile time interface enforcer -var _ thrift.Struct = (*respNestedContainersTurtles)(nil) -var _ thrift.WritableResult = (*respNestedContainersTurtles)(nil) - -// Deprecated: NestedContainersTurtlesResultDeprecated is deprecated, since it is supposed to be internal. -type NestedContainersTurtlesResultDeprecated = respNestedContainersTurtles - -func newRespNestedContainersTurtles() *respNestedContainersTurtles { - return (&respNestedContainersTurtles{}).setDefaults() -} - - - -func (x *respNestedContainersTurtles) Exception() thrift.WritableException { - return nil -} - -func (x *respNestedContainersTurtles) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respNestedContainersTurtles"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respNestedContainersTurtles) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respNestedContainersTurtles) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respNestedContainersTurtles({") - sb.WriteString("})") - - return sb.String() -} -func (x *respNestedContainersTurtles) setDefaults() *respNestedContainersTurtles { - return x -} - - type NestedContainersProcessor struct { processorFunctionMap map[string]thrift.ProcessorFunction diff --git a/thrift/compiler/test/fixtures/params/out/go/gen-go/module/types.go b/thrift/compiler/test/fixtures/params/out/go/gen-go/module/types.go index 4f00dac85fa..865c7d21b5e 100644 --- a/thrift/compiler/test/fixtures/params/out/go/gen-go/module/types.go +++ b/thrift/compiler/test/fixtures/params/out/go/gen-go/module/types.go @@ -20,3 +20,1617 @@ var _ = strings.Split var _ = thrift.ZERO +// Service req/resp structs (below) +type reqNestedContainersMapList struct { + Foo map[int32][]int32 `thrift:"foo,1" json:"foo" db:"foo"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqNestedContainersMapList)(nil) + +// Deprecated: NestedContainersMapListArgsDeprecated is deprecated, since it is supposed to be internal. +type NestedContainersMapListArgsDeprecated = reqNestedContainersMapList + +func newReqNestedContainersMapList() *reqNestedContainersMapList { + return (&reqNestedContainersMapList{}).setDefaults() +} + +func (x *reqNestedContainersMapList) GetFoo() map[int32][]int32 { + if !x.IsSetFoo() { + return make(map[int32][]int32) + } + return x.Foo +} + +func (x *reqNestedContainersMapList) SetFooNonCompat(value map[int32][]int32) *reqNestedContainersMapList { + x.Foo = value + return x +} + +func (x *reqNestedContainersMapList) SetFoo(value map[int32][]int32) *reqNestedContainersMapList { + x.Foo = value + return x +} + +func (x *reqNestedContainersMapList) IsSetFoo() bool { + return x != nil && x.Foo != nil +} + +func (x *reqNestedContainersMapList) writeField1(p thrift.Encoder) error { // Foo + if err := p.WriteFieldBegin("foo", thrift.MAP, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Foo + if err := p.WriteMapBegin(thrift.I32, thrift.LIST, len(item)); err != nil { + return thrift.PrependError("error writing map begin: ", err) +} +for k, v := range item { + { + item := k + if err := p.WriteI32(item); err != nil { + return err +} + } + + { + item := v + if err := p.WriteListBegin(thrift.I32, len(item)); err != nil { + return thrift.PrependError("error writing list begin: ", err) +} +for _, v := range item { + { + item := v + if err := p.WriteI32(item); err != nil { + return err +} + } +} +if err := p.WriteListEnd(); err != nil { + return thrift.PrependError("error writing list end: ", err) +} + } +} +if err := p.WriteMapEnd(); err != nil { + return thrift.PrependError("error writing map end: ", err) +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqNestedContainersMapList) readField1(p thrift.Decoder) error { // Foo + _ /* keyType */, _ /* valueType */, size, err := p.ReadMapBegin() +if err != nil { + return thrift.PrependError("error reading map begin: ", err) +} + +mapResult := make(map[int32][]int32, size) +for i := 0; i < size; i++ { + var key int32 + { + result, err := p.ReadI32() +if err != nil { + return err +} + key = result + } + + var value []int32 + { + _ /* elemType */, size, err := p.ReadListBegin() +if err != nil { + return thrift.PrependError("error reading list begin: ", err) +} + +listResult := make([]int32, 0, size) +for i := 0; i < size; i++ { + var elem int32 + { + result, err := p.ReadI32() +if err != nil { + return err +} + elem = result + } + listResult = append(listResult, elem) +} + +if err := p.ReadListEnd(); err != nil { + return thrift.PrependError("error reading list end: ", err) +} +result := listResult + value = result + } + + mapResult[key] = value +} + +if err := p.ReadMapEnd(); err != nil { + return thrift.PrependError("error reading map end: ", err) +} +result := mapResult + + x.Foo = result + return nil +} + +func (x *reqNestedContainersMapList) toString1() string { // Foo + return fmt.Sprintf("%v", x.Foo) +} + + + +func (x *reqNestedContainersMapList) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqNestedContainersMapList"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqNestedContainersMapList) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.MAP)): // foo + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqNestedContainersMapList) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqNestedContainersMapList({") + sb.WriteString(fmt.Sprintf("Foo:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqNestedContainersMapList) setDefaults() *reqNestedContainersMapList { + return x. + SetFooNonCompat(make(map[int32][]int32)) +} + +type respNestedContainersMapList struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respNestedContainersMapList)(nil) +var _ thrift.WritableResult = (*respNestedContainersMapList)(nil) + +// Deprecated: NestedContainersMapListResultDeprecated is deprecated, since it is supposed to be internal. +type NestedContainersMapListResultDeprecated = respNestedContainersMapList + +func newRespNestedContainersMapList() *respNestedContainersMapList { + return (&respNestedContainersMapList{}).setDefaults() +} + + + +func (x *respNestedContainersMapList) Exception() thrift.WritableException { + return nil +} + +func (x *respNestedContainersMapList) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respNestedContainersMapList"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respNestedContainersMapList) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respNestedContainersMapList) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respNestedContainersMapList({") + sb.WriteString("})") + + return sb.String() +} +func (x *respNestedContainersMapList) setDefaults() *respNestedContainersMapList { + return x +} + +type reqNestedContainersMapSet struct { + Foo map[int32][]int32 `thrift:"foo,1" json:"foo" db:"foo"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqNestedContainersMapSet)(nil) + +// Deprecated: NestedContainersMapSetArgsDeprecated is deprecated, since it is supposed to be internal. +type NestedContainersMapSetArgsDeprecated = reqNestedContainersMapSet + +func newReqNestedContainersMapSet() *reqNestedContainersMapSet { + return (&reqNestedContainersMapSet{}).setDefaults() +} + +func (x *reqNestedContainersMapSet) GetFoo() map[int32][]int32 { + if !x.IsSetFoo() { + return make(map[int32][]int32) + } + return x.Foo +} + +func (x *reqNestedContainersMapSet) SetFooNonCompat(value map[int32][]int32) *reqNestedContainersMapSet { + x.Foo = value + return x +} + +func (x *reqNestedContainersMapSet) SetFoo(value map[int32][]int32) *reqNestedContainersMapSet { + x.Foo = value + return x +} + +func (x *reqNestedContainersMapSet) IsSetFoo() bool { + return x != nil && x.Foo != nil +} + +func (x *reqNestedContainersMapSet) writeField1(p thrift.Encoder) error { // Foo + if err := p.WriteFieldBegin("foo", thrift.MAP, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Foo + if err := p.WriteMapBegin(thrift.I32, thrift.SET, len(item)); err != nil { + return thrift.PrependError("error writing map begin: ", err) +} +for k, v := range item { + { + item := k + if err := p.WriteI32(item); err != nil { + return err +} + } + + { + item := v + if err := p.WriteSetBegin(thrift.I32, len(item)); err != nil { + return thrift.PrependError("error writing set begin: ", err) +} +for _, v := range item { + { + item := v + if err := p.WriteI32(item); err != nil { + return err +} + } +} +if err := p.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) +} + } +} +if err := p.WriteMapEnd(); err != nil { + return thrift.PrependError("error writing map end: ", err) +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqNestedContainersMapSet) readField1(p thrift.Decoder) error { // Foo + _ /* keyType */, _ /* valueType */, size, err := p.ReadMapBegin() +if err != nil { + return thrift.PrependError("error reading map begin: ", err) +} + +mapResult := make(map[int32][]int32, size) +for i := 0; i < size; i++ { + var key int32 + { + result, err := p.ReadI32() +if err != nil { + return err +} + key = result + } + + var value []int32 + { + _ /* elemType */, size, err := p.ReadSetBegin() +if err != nil { + return thrift.PrependError("error reading set begin: ", err) +} + +setResult := make([]int32, 0, size) +for i := 0; i < size; i++ { + var elem int32 + { + result, err := p.ReadI32() +if err != nil { + return err +} + elem = result + } + setResult = append(setResult, elem) +} + +if err := p.ReadSetEnd(); err != nil { + return thrift.PrependError("error reading set end: ", err) +} +result := setResult + value = result + } + + mapResult[key] = value +} + +if err := p.ReadMapEnd(); err != nil { + return thrift.PrependError("error reading map end: ", err) +} +result := mapResult + + x.Foo = result + return nil +} + +func (x *reqNestedContainersMapSet) toString1() string { // Foo + return fmt.Sprintf("%v", x.Foo) +} + + + +func (x *reqNestedContainersMapSet) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqNestedContainersMapSet"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqNestedContainersMapSet) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.MAP)): // foo + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqNestedContainersMapSet) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqNestedContainersMapSet({") + sb.WriteString(fmt.Sprintf("Foo:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqNestedContainersMapSet) setDefaults() *reqNestedContainersMapSet { + return x. + SetFooNonCompat(make(map[int32][]int32)) +} + +type respNestedContainersMapSet struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respNestedContainersMapSet)(nil) +var _ thrift.WritableResult = (*respNestedContainersMapSet)(nil) + +// Deprecated: NestedContainersMapSetResultDeprecated is deprecated, since it is supposed to be internal. +type NestedContainersMapSetResultDeprecated = respNestedContainersMapSet + +func newRespNestedContainersMapSet() *respNestedContainersMapSet { + return (&respNestedContainersMapSet{}).setDefaults() +} + + + +func (x *respNestedContainersMapSet) Exception() thrift.WritableException { + return nil +} + +func (x *respNestedContainersMapSet) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respNestedContainersMapSet"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respNestedContainersMapSet) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respNestedContainersMapSet) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respNestedContainersMapSet({") + sb.WriteString("})") + + return sb.String() +} +func (x *respNestedContainersMapSet) setDefaults() *respNestedContainersMapSet { + return x +} + +type reqNestedContainersListMap struct { + Foo []map[int32]int32 `thrift:"foo,1" json:"foo" db:"foo"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqNestedContainersListMap)(nil) + +// Deprecated: NestedContainersListMapArgsDeprecated is deprecated, since it is supposed to be internal. +type NestedContainersListMapArgsDeprecated = reqNestedContainersListMap + +func newReqNestedContainersListMap() *reqNestedContainersListMap { + return (&reqNestedContainersListMap{}).setDefaults() +} + +func (x *reqNestedContainersListMap) GetFoo() []map[int32]int32 { + if !x.IsSetFoo() { + return make([]map[int32]int32, 0) + } + return x.Foo +} + +func (x *reqNestedContainersListMap) SetFooNonCompat(value []map[int32]int32) *reqNestedContainersListMap { + x.Foo = value + return x +} + +func (x *reqNestedContainersListMap) SetFoo(value []map[int32]int32) *reqNestedContainersListMap { + x.Foo = value + return x +} + +func (x *reqNestedContainersListMap) IsSetFoo() bool { + return x != nil && x.Foo != nil +} + +func (x *reqNestedContainersListMap) writeField1(p thrift.Encoder) error { // Foo + if err := p.WriteFieldBegin("foo", thrift.LIST, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Foo + if err := p.WriteListBegin(thrift.MAP, len(item)); err != nil { + return thrift.PrependError("error writing list begin: ", err) +} +for _, v := range item { + { + item := v + if err := p.WriteMapBegin(thrift.I32, thrift.I32, len(item)); err != nil { + return thrift.PrependError("error writing map begin: ", err) +} +for k, v := range item { + { + item := k + if err := p.WriteI32(item); err != nil { + return err +} + } + + { + item := v + if err := p.WriteI32(item); err != nil { + return err +} + } +} +if err := p.WriteMapEnd(); err != nil { + return thrift.PrependError("error writing map end: ", err) +} + } +} +if err := p.WriteListEnd(); err != nil { + return thrift.PrependError("error writing list end: ", err) +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqNestedContainersListMap) readField1(p thrift.Decoder) error { // Foo + _ /* elemType */, size, err := p.ReadListBegin() +if err != nil { + return thrift.PrependError("error reading list begin: ", err) +} + +listResult := make([]map[int32]int32, 0, size) +for i := 0; i < size; i++ { + var elem map[int32]int32 + { + _ /* keyType */, _ /* valueType */, size, err := p.ReadMapBegin() +if err != nil { + return thrift.PrependError("error reading map begin: ", err) +} + +mapResult := make(map[int32]int32, size) +for i := 0; i < size; i++ { + var key int32 + { + result, err := p.ReadI32() +if err != nil { + return err +} + key = result + } + + var value int32 + { + result, err := p.ReadI32() +if err != nil { + return err +} + value = result + } + + mapResult[key] = value +} + +if err := p.ReadMapEnd(); err != nil { + return thrift.PrependError("error reading map end: ", err) +} +result := mapResult + elem = result + } + listResult = append(listResult, elem) +} + +if err := p.ReadListEnd(); err != nil { + return thrift.PrependError("error reading list end: ", err) +} +result := listResult + + x.Foo = result + return nil +} + +func (x *reqNestedContainersListMap) toString1() string { // Foo + return fmt.Sprintf("%v", x.Foo) +} + + + +func (x *reqNestedContainersListMap) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqNestedContainersListMap"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqNestedContainersListMap) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.LIST)): // foo + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqNestedContainersListMap) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqNestedContainersListMap({") + sb.WriteString(fmt.Sprintf("Foo:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqNestedContainersListMap) setDefaults() *reqNestedContainersListMap { + return x. + SetFooNonCompat(make([]map[int32]int32, 0)) +} + +type respNestedContainersListMap struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respNestedContainersListMap)(nil) +var _ thrift.WritableResult = (*respNestedContainersListMap)(nil) + +// Deprecated: NestedContainersListMapResultDeprecated is deprecated, since it is supposed to be internal. +type NestedContainersListMapResultDeprecated = respNestedContainersListMap + +func newRespNestedContainersListMap() *respNestedContainersListMap { + return (&respNestedContainersListMap{}).setDefaults() +} + + + +func (x *respNestedContainersListMap) Exception() thrift.WritableException { + return nil +} + +func (x *respNestedContainersListMap) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respNestedContainersListMap"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respNestedContainersListMap) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respNestedContainersListMap) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respNestedContainersListMap({") + sb.WriteString("})") + + return sb.String() +} +func (x *respNestedContainersListMap) setDefaults() *respNestedContainersListMap { + return x +} + +type reqNestedContainersListSet struct { + Foo [][]int32 `thrift:"foo,1" json:"foo" db:"foo"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqNestedContainersListSet)(nil) + +// Deprecated: NestedContainersListSetArgsDeprecated is deprecated, since it is supposed to be internal. +type NestedContainersListSetArgsDeprecated = reqNestedContainersListSet + +func newReqNestedContainersListSet() *reqNestedContainersListSet { + return (&reqNestedContainersListSet{}).setDefaults() +} + +func (x *reqNestedContainersListSet) GetFoo() [][]int32 { + if !x.IsSetFoo() { + return make([][]int32, 0) + } + return x.Foo +} + +func (x *reqNestedContainersListSet) SetFooNonCompat(value [][]int32) *reqNestedContainersListSet { + x.Foo = value + return x +} + +func (x *reqNestedContainersListSet) SetFoo(value [][]int32) *reqNestedContainersListSet { + x.Foo = value + return x +} + +func (x *reqNestedContainersListSet) IsSetFoo() bool { + return x != nil && x.Foo != nil +} + +func (x *reqNestedContainersListSet) writeField1(p thrift.Encoder) error { // Foo + if err := p.WriteFieldBegin("foo", thrift.LIST, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Foo + if err := p.WriteListBegin(thrift.SET, len(item)); err != nil { + return thrift.PrependError("error writing list begin: ", err) +} +for _, v := range item { + { + item := v + if err := p.WriteSetBegin(thrift.I32, len(item)); err != nil { + return thrift.PrependError("error writing set begin: ", err) +} +for _, v := range item { + { + item := v + if err := p.WriteI32(item); err != nil { + return err +} + } +} +if err := p.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) +} + } +} +if err := p.WriteListEnd(); err != nil { + return thrift.PrependError("error writing list end: ", err) +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqNestedContainersListSet) readField1(p thrift.Decoder) error { // Foo + _ /* elemType */, size, err := p.ReadListBegin() +if err != nil { + return thrift.PrependError("error reading list begin: ", err) +} + +listResult := make([][]int32, 0, size) +for i := 0; i < size; i++ { + var elem []int32 + { + _ /* elemType */, size, err := p.ReadSetBegin() +if err != nil { + return thrift.PrependError("error reading set begin: ", err) +} + +setResult := make([]int32, 0, size) +for i := 0; i < size; i++ { + var elem int32 + { + result, err := p.ReadI32() +if err != nil { + return err +} + elem = result + } + setResult = append(setResult, elem) +} + +if err := p.ReadSetEnd(); err != nil { + return thrift.PrependError("error reading set end: ", err) +} +result := setResult + elem = result + } + listResult = append(listResult, elem) +} + +if err := p.ReadListEnd(); err != nil { + return thrift.PrependError("error reading list end: ", err) +} +result := listResult + + x.Foo = result + return nil +} + +func (x *reqNestedContainersListSet) toString1() string { // Foo + return fmt.Sprintf("%v", x.Foo) +} + + + +func (x *reqNestedContainersListSet) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqNestedContainersListSet"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqNestedContainersListSet) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.LIST)): // foo + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqNestedContainersListSet) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqNestedContainersListSet({") + sb.WriteString(fmt.Sprintf("Foo:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqNestedContainersListSet) setDefaults() *reqNestedContainersListSet { + return x. + SetFooNonCompat(make([][]int32, 0)) +} + +type respNestedContainersListSet struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respNestedContainersListSet)(nil) +var _ thrift.WritableResult = (*respNestedContainersListSet)(nil) + +// Deprecated: NestedContainersListSetResultDeprecated is deprecated, since it is supposed to be internal. +type NestedContainersListSetResultDeprecated = respNestedContainersListSet + +func newRespNestedContainersListSet() *respNestedContainersListSet { + return (&respNestedContainersListSet{}).setDefaults() +} + + + +func (x *respNestedContainersListSet) Exception() thrift.WritableException { + return nil +} + +func (x *respNestedContainersListSet) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respNestedContainersListSet"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respNestedContainersListSet) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respNestedContainersListSet) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respNestedContainersListSet({") + sb.WriteString("})") + + return sb.String() +} +func (x *respNestedContainersListSet) setDefaults() *respNestedContainersListSet { + return x +} + +type reqNestedContainersTurtles struct { + Foo [][]map[int32]map[int32][]int32 `thrift:"foo,1" json:"foo" db:"foo"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqNestedContainersTurtles)(nil) + +// Deprecated: NestedContainersTurtlesArgsDeprecated is deprecated, since it is supposed to be internal. +type NestedContainersTurtlesArgsDeprecated = reqNestedContainersTurtles + +func newReqNestedContainersTurtles() *reqNestedContainersTurtles { + return (&reqNestedContainersTurtles{}).setDefaults() +} + +func (x *reqNestedContainersTurtles) GetFoo() [][]map[int32]map[int32][]int32 { + if !x.IsSetFoo() { + return make([][]map[int32]map[int32][]int32, 0) + } + return x.Foo +} + +func (x *reqNestedContainersTurtles) SetFooNonCompat(value [][]map[int32]map[int32][]int32) *reqNestedContainersTurtles { + x.Foo = value + return x +} + +func (x *reqNestedContainersTurtles) SetFoo(value [][]map[int32]map[int32][]int32) *reqNestedContainersTurtles { + x.Foo = value + return x +} + +func (x *reqNestedContainersTurtles) IsSetFoo() bool { + return x != nil && x.Foo != nil +} + +func (x *reqNestedContainersTurtles) writeField1(p thrift.Encoder) error { // Foo + if err := p.WriteFieldBegin("foo", thrift.LIST, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Foo + if err := p.WriteListBegin(thrift.LIST, len(item)); err != nil { + return thrift.PrependError("error writing list begin: ", err) +} +for _, v := range item { + { + item := v + if err := p.WriteListBegin(thrift.MAP, len(item)); err != nil { + return thrift.PrependError("error writing list begin: ", err) +} +for _, v := range item { + { + item := v + if err := p.WriteMapBegin(thrift.I32, thrift.MAP, len(item)); err != nil { + return thrift.PrependError("error writing map begin: ", err) +} +for k, v := range item { + { + item := k + if err := p.WriteI32(item); err != nil { + return err +} + } + + { + item := v + if err := p.WriteMapBegin(thrift.I32, thrift.SET, len(item)); err != nil { + return thrift.PrependError("error writing map begin: ", err) +} +for k, v := range item { + { + item := k + if err := p.WriteI32(item); err != nil { + return err +} + } + + { + item := v + if err := p.WriteSetBegin(thrift.I32, len(item)); err != nil { + return thrift.PrependError("error writing set begin: ", err) +} +for _, v := range item { + { + item := v + if err := p.WriteI32(item); err != nil { + return err +} + } +} +if err := p.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) +} + } +} +if err := p.WriteMapEnd(); err != nil { + return thrift.PrependError("error writing map end: ", err) +} + } +} +if err := p.WriteMapEnd(); err != nil { + return thrift.PrependError("error writing map end: ", err) +} + } +} +if err := p.WriteListEnd(); err != nil { + return thrift.PrependError("error writing list end: ", err) +} + } +} +if err := p.WriteListEnd(); err != nil { + return thrift.PrependError("error writing list end: ", err) +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqNestedContainersTurtles) readField1(p thrift.Decoder) error { // Foo + _ /* elemType */, size, err := p.ReadListBegin() +if err != nil { + return thrift.PrependError("error reading list begin: ", err) +} + +listResult := make([][]map[int32]map[int32][]int32, 0, size) +for i := 0; i < size; i++ { + var elem []map[int32]map[int32][]int32 + { + _ /* elemType */, size, err := p.ReadListBegin() +if err != nil { + return thrift.PrependError("error reading list begin: ", err) +} + +listResult := make([]map[int32]map[int32][]int32, 0, size) +for i := 0; i < size; i++ { + var elem map[int32]map[int32][]int32 + { + _ /* keyType */, _ /* valueType */, size, err := p.ReadMapBegin() +if err != nil { + return thrift.PrependError("error reading map begin: ", err) +} + +mapResult := make(map[int32]map[int32][]int32, size) +for i := 0; i < size; i++ { + var key int32 + { + result, err := p.ReadI32() +if err != nil { + return err +} + key = result + } + + var value map[int32][]int32 + { + _ /* keyType */, _ /* valueType */, size, err := p.ReadMapBegin() +if err != nil { + return thrift.PrependError("error reading map begin: ", err) +} + +mapResult := make(map[int32][]int32, size) +for i := 0; i < size; i++ { + var key int32 + { + result, err := p.ReadI32() +if err != nil { + return err +} + key = result + } + + var value []int32 + { + _ /* elemType */, size, err := p.ReadSetBegin() +if err != nil { + return thrift.PrependError("error reading set begin: ", err) +} + +setResult := make([]int32, 0, size) +for i := 0; i < size; i++ { + var elem int32 + { + result, err := p.ReadI32() +if err != nil { + return err +} + elem = result + } + setResult = append(setResult, elem) +} + +if err := p.ReadSetEnd(); err != nil { + return thrift.PrependError("error reading set end: ", err) +} +result := setResult + value = result + } + + mapResult[key] = value +} + +if err := p.ReadMapEnd(); err != nil { + return thrift.PrependError("error reading map end: ", err) +} +result := mapResult + value = result + } + + mapResult[key] = value +} + +if err := p.ReadMapEnd(); err != nil { + return thrift.PrependError("error reading map end: ", err) +} +result := mapResult + elem = result + } + listResult = append(listResult, elem) +} + +if err := p.ReadListEnd(); err != nil { + return thrift.PrependError("error reading list end: ", err) +} +result := listResult + elem = result + } + listResult = append(listResult, elem) +} + +if err := p.ReadListEnd(); err != nil { + return thrift.PrependError("error reading list end: ", err) +} +result := listResult + + x.Foo = result + return nil +} + +func (x *reqNestedContainersTurtles) toString1() string { // Foo + return fmt.Sprintf("%v", x.Foo) +} + + + +func (x *reqNestedContainersTurtles) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqNestedContainersTurtles"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqNestedContainersTurtles) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.LIST)): // foo + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqNestedContainersTurtles) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqNestedContainersTurtles({") + sb.WriteString(fmt.Sprintf("Foo:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqNestedContainersTurtles) setDefaults() *reqNestedContainersTurtles { + return x. + SetFooNonCompat(make([][]map[int32]map[int32][]int32, 0)) +} + +type respNestedContainersTurtles struct { +} +// Compile time interface enforcer +var _ thrift.Struct = (*respNestedContainersTurtles)(nil) +var _ thrift.WritableResult = (*respNestedContainersTurtles)(nil) + +// Deprecated: NestedContainersTurtlesResultDeprecated is deprecated, since it is supposed to be internal. +type NestedContainersTurtlesResultDeprecated = respNestedContainersTurtles + +func newRespNestedContainersTurtles() *respNestedContainersTurtles { + return (&respNestedContainersTurtles{}).setDefaults() +} + + + +func (x *respNestedContainersTurtles) Exception() thrift.WritableException { + return nil +} + +func (x *respNestedContainersTurtles) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respNestedContainersTurtles"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respNestedContainersTurtles) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respNestedContainersTurtles) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respNestedContainersTurtles({") + sb.WriteString("})") + + return sb.String() +} +func (x *respNestedContainersTurtles) setDefaults() *respNestedContainersTurtles { + return x +} + + diff --git a/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/module/types.go b/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/module/types.go index 2a884cd230f..6bd9d59e51d 100644 --- a/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/module/types.go +++ b/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/module/types.go @@ -492,6 +492,7 @@ func (x *Foo2) setDefaults() *Foo2 { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/thrift/annotation/scope/types.go b/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/thrift/annotation/scope/types.go index c2871133501..c8a6b005a41 100644 --- a/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/thrift/annotation/scope/types.go +++ b/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/thrift/annotation/scope/types.go @@ -1380,6 +1380,7 @@ func (x *Definition) setDefaults() *Definition { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/thrift/annotation/thrift/types.go b/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/thrift/annotation/thrift/types.go index 85cadd20f65..ba562235211 100644 --- a/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/thrift/annotation/thrift/types.go +++ b/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/thrift/annotation/thrift/types.go @@ -1804,6 +1804,7 @@ func (x *AllowReservedFilename) setDefaults() *AllowReservedFilename { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/terse_write/types.go b/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/terse_write/types.go index 932cff63454..5f183098426 100644 --- a/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/terse_write/types.go +++ b/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/terse_write/types.go @@ -5960,6 +5960,7 @@ func (x *TerseException) Error() string { return x.String() } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/cpp/types.go b/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/cpp/types.go index b7608402504..fde8434e68b 100644 --- a/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/cpp/types.go +++ b/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/cpp/types.go @@ -2282,6 +2282,7 @@ func (x *GenerateDeprecatedHeaderClientMethods) setDefaults() *GenerateDeprecate } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/hack/types.go b/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/hack/types.go index 25397ae334e..42eacb139df 100644 --- a/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/hack/types.go +++ b/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/hack/types.go @@ -1464,6 +1464,7 @@ func (x *ModuleInternal) setDefaults() *ModuleInternal { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/scope/types.go b/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/scope/types.go index c2871133501..c8a6b005a41 100644 --- a/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/scope/types.go +++ b/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/scope/types.go @@ -1380,6 +1380,7 @@ func (x *Definition) setDefaults() *Definition { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/thrift/types.go b/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/thrift/types.go index 85cadd20f65..ba562235211 100644 --- a/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/thrift/types.go +++ b/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/thrift/types.go @@ -1804,6 +1804,7 @@ func (x *AllowReservedFilename) setDefaults() *AllowReservedFilename { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/types/out/go/gen-go/included/types.go b/thrift/compiler/test/fixtures/types/out/go/gen-go/included/types.go index cb082423889..13353ee2664 100644 --- a/thrift/compiler/test/fixtures/types/out/go/gen-go/included/types.go +++ b/thrift/compiler/test/fixtures/types/out/go/gen-go/included/types.go @@ -148,3 +148,4 @@ result := listResult return decodeResult, decodeErr } + diff --git a/thrift/compiler/test/fixtures/types/out/go/gen-go/module/svcs.go b/thrift/compiler/test/fixtures/types/out/go/gen-go/module/svcs.go index 571b51f30e9..2c4ef0e4355 100644 --- a/thrift/compiler/test/fixtures/types/out/go/gen-go/module/svcs.go +++ b/thrift/compiler/test/fixtures/types/out/go/gen-go/module/svcs.go @@ -123,673 +123,6 @@ func (c *SomeServiceClient) BinaryKeyedMapContext(ctx context.Context, r []int64 return c.chClient.BinaryKeyedMap(ctx, r) } -type reqSomeServiceBounceMap struct { - M included.SomeMap `thrift:"m,1" json:"m" db:"m"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqSomeServiceBounceMap)(nil) - -// Deprecated: SomeServiceBounceMapArgsDeprecated is deprecated, since it is supposed to be internal. -type SomeServiceBounceMapArgsDeprecated = reqSomeServiceBounceMap - -func newReqSomeServiceBounceMap() *reqSomeServiceBounceMap { - return (&reqSomeServiceBounceMap{}).setDefaults() -} - -func (x *reqSomeServiceBounceMap) GetM() included.SomeMap { - if !x.IsSetM() { - return included.NewSomeMap() - } - return x.M -} - -func (x *reqSomeServiceBounceMap) SetMNonCompat(value included.SomeMap) *reqSomeServiceBounceMap { - x.M = value - return x -} - -func (x *reqSomeServiceBounceMap) SetM(value included.SomeMap) *reqSomeServiceBounceMap { - x.M = value - return x -} - -func (x *reqSomeServiceBounceMap) IsSetM() bool { - return x != nil && x.M != nil -} - -func (x *reqSomeServiceBounceMap) writeField1(p thrift.Encoder) error { // M - if err := p.WriteFieldBegin("m", thrift.MAP, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.M - err := included.WriteSomeMap(item, p) -if err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqSomeServiceBounceMap) readField1(p thrift.Decoder) error { // M - result, err := included.ReadSomeMap(p) -if err != nil { - return err -} - - x.M = result - return nil -} - -func (x *reqSomeServiceBounceMap) toString1() string { // M - return fmt.Sprintf("%v", x.M) -} - - - -func (x *reqSomeServiceBounceMap) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqSomeServiceBounceMap"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqSomeServiceBounceMap) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.MAP)): // m - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqSomeServiceBounceMap) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqSomeServiceBounceMap({") - sb.WriteString(fmt.Sprintf("M:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqSomeServiceBounceMap) setDefaults() *reqSomeServiceBounceMap { - return x. - SetMNonCompat(included.NewSomeMap()) -} - -type respSomeServiceBounceMap struct { - Success included.SomeMap `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respSomeServiceBounceMap)(nil) -var _ thrift.WritableResult = (*respSomeServiceBounceMap)(nil) - -// Deprecated: SomeServiceBounceMapResultDeprecated is deprecated, since it is supposed to be internal. -type SomeServiceBounceMapResultDeprecated = respSomeServiceBounceMap - -func newRespSomeServiceBounceMap() *respSomeServiceBounceMap { - return (&respSomeServiceBounceMap{}).setDefaults() -} - -func (x *respSomeServiceBounceMap) GetSuccess() included.SomeMap { - if !x.IsSetSuccess() { - return included.NewSomeMap() - } - return x.Success -} - -func (x *respSomeServiceBounceMap) SetSuccessNonCompat(value included.SomeMap) *respSomeServiceBounceMap { - x.Success = value - return x -} - -func (x *respSomeServiceBounceMap) SetSuccess(value included.SomeMap) *respSomeServiceBounceMap { - x.Success = value - return x -} - -func (x *respSomeServiceBounceMap) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respSomeServiceBounceMap) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.MAP, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Success - err := included.WriteSomeMap(item, p) -if err != nil { - return err -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respSomeServiceBounceMap) readField0(p thrift.Decoder) error { // Success - result, err := included.ReadSomeMap(p) -if err != nil { - return err -} - - x.Success = result - return nil -} - -func (x *respSomeServiceBounceMap) toString0() string { // Success - return fmt.Sprintf("%v", x.Success) -} - - - -func (x *respSomeServiceBounceMap) Exception() thrift.WritableException { - return nil -} - -func (x *respSomeServiceBounceMap) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respSomeServiceBounceMap"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respSomeServiceBounceMap) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.MAP)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respSomeServiceBounceMap) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respSomeServiceBounceMap({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respSomeServiceBounceMap) setDefaults() *respSomeServiceBounceMap { - return x -} - -type reqSomeServiceBinaryKeyedMap struct { - R []int64 `thrift:"r,1" json:"r" db:"r"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*reqSomeServiceBinaryKeyedMap)(nil) - -// Deprecated: SomeServiceBinaryKeyedMapArgsDeprecated is deprecated, since it is supposed to be internal. -type SomeServiceBinaryKeyedMapArgsDeprecated = reqSomeServiceBinaryKeyedMap - -func newReqSomeServiceBinaryKeyedMap() *reqSomeServiceBinaryKeyedMap { - return (&reqSomeServiceBinaryKeyedMap{}).setDefaults() -} - -func (x *reqSomeServiceBinaryKeyedMap) GetR() []int64 { - if !x.IsSetR() { - return make([]int64, 0) - } - return x.R -} - -func (x *reqSomeServiceBinaryKeyedMap) SetRNonCompat(value []int64) *reqSomeServiceBinaryKeyedMap { - x.R = value - return x -} - -func (x *reqSomeServiceBinaryKeyedMap) SetR(value []int64) *reqSomeServiceBinaryKeyedMap { - x.R = value - return x -} - -func (x *reqSomeServiceBinaryKeyedMap) IsSetR() bool { - return x != nil && x.R != nil -} - -func (x *reqSomeServiceBinaryKeyedMap) writeField1(p thrift.Encoder) error { // R - if err := p.WriteFieldBegin("r", thrift.LIST, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.R - if err := p.WriteListBegin(thrift.I64, len(item)); err != nil { - return thrift.PrependError("error writing list begin: ", err) -} -for _, v := range item { - { - item := v - if err := p.WriteI64(item); err != nil { - return err -} - } -} -if err := p.WriteListEnd(); err != nil { - return thrift.PrependError("error writing list end: ", err) -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *reqSomeServiceBinaryKeyedMap) readField1(p thrift.Decoder) error { // R - _ /* elemType */, size, err := p.ReadListBegin() -if err != nil { - return thrift.PrependError("error reading list begin: ", err) -} - -listResult := make([]int64, 0, size) -for i := 0; i < size; i++ { - var elem int64 - { - result, err := p.ReadI64() -if err != nil { - return err -} - elem = result - } - listResult = append(listResult, elem) -} - -if err := p.ReadListEnd(); err != nil { - return thrift.PrependError("error reading list end: ", err) -} -result := listResult - - x.R = result - return nil -} - -func (x *reqSomeServiceBinaryKeyedMap) toString1() string { // R - return fmt.Sprintf("%v", x.R) -} - - - -func (x *reqSomeServiceBinaryKeyedMap) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("reqSomeServiceBinaryKeyedMap"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField1(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *reqSomeServiceBinaryKeyedMap) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 1 && wireType == thrift.Type(thrift.LIST)): // r - fieldReadErr = x.readField1(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *reqSomeServiceBinaryKeyedMap) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("reqSomeServiceBinaryKeyedMap({") - sb.WriteString(fmt.Sprintf("R:%s", x.toString1())) - sb.WriteString("})") - - return sb.String() -} -func (x *reqSomeServiceBinaryKeyedMap) setDefaults() *reqSomeServiceBinaryKeyedMap { - return x. - SetRNonCompat(make([]int64, 0)) -} - -type respSomeServiceBinaryKeyedMap struct { - Success map[*TBinary]int64 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` -} -// Compile time interface enforcer -var _ thrift.Struct = (*respSomeServiceBinaryKeyedMap)(nil) -var _ thrift.WritableResult = (*respSomeServiceBinaryKeyedMap)(nil) - -// Deprecated: SomeServiceBinaryKeyedMapResultDeprecated is deprecated, since it is supposed to be internal. -type SomeServiceBinaryKeyedMapResultDeprecated = respSomeServiceBinaryKeyedMap - -func newRespSomeServiceBinaryKeyedMap() *respSomeServiceBinaryKeyedMap { - return (&respSomeServiceBinaryKeyedMap{}).setDefaults() -} - -func (x *respSomeServiceBinaryKeyedMap) GetSuccess() map[*TBinary]int64 { - if !x.IsSetSuccess() { - return make(map[*TBinary]int64) - } - return x.Success -} - -func (x *respSomeServiceBinaryKeyedMap) SetSuccessNonCompat(value map[*TBinary]int64) *respSomeServiceBinaryKeyedMap { - x.Success = value - return x -} - -func (x *respSomeServiceBinaryKeyedMap) SetSuccess(value map[*TBinary]int64) *respSomeServiceBinaryKeyedMap { - x.Success = value - return x -} - -func (x *respSomeServiceBinaryKeyedMap) IsSetSuccess() bool { - return x != nil && x.Success != nil -} - -func (x *respSomeServiceBinaryKeyedMap) writeField0(p thrift.Encoder) error { // Success - if !x.IsSetSuccess() { - return nil - } - - if err := p.WriteFieldBegin("success", thrift.MAP, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) - } - - item := x.Success - if err := p.WriteMapBegin(thrift.STRING, thrift.I64, len(item)); err != nil { - return thrift.PrependError("error writing map begin: ", err) -} -for k, v := range item { - if k == nil { - return fmt.Errorf("%T write map: nil key is not allowed.", item) - } - - { - item := *k - err := WriteTBinary(item, p) -if err != nil { - return err -} - } - - { - item := v - if err := p.WriteI64(item); err != nil { - return err -} - } -} -if err := p.WriteMapEnd(); err != nil { - return thrift.PrependError("error writing map end: ", err) -} - - if err := p.WriteFieldEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) - } - return nil -} - -func (x *respSomeServiceBinaryKeyedMap) readField0(p thrift.Decoder) error { // Success - _ /* keyType */, _ /* valueType */, size, err := p.ReadMapBegin() -if err != nil { - return thrift.PrependError("error reading map begin: ", err) -} - -mapResult := make(map[*TBinary]int64, size) -for i := 0; i < size; i++ { - var key *TBinary - { - result, err := ReadTBinary(p) -if err != nil { - return err -} - key = &result - } - - var value int64 - { - result, err := p.ReadI64() -if err != nil { - return err -} - value = result - } - - mapResult[key] = value -} - -if err := p.ReadMapEnd(); err != nil { - return thrift.PrependError("error reading map end: ", err) -} -result := mapResult - - x.Success = result - return nil -} - -func (x *respSomeServiceBinaryKeyedMap) toString0() string { // Success - return fmt.Sprintf("%v", x.Success) -} - - - -func (x *respSomeServiceBinaryKeyedMap) Exception() thrift.WritableException { - return nil -} - -func (x *respSomeServiceBinaryKeyedMap) Write(p thrift.Encoder) error { - if err := p.WriteStructBegin("respSomeServiceBinaryKeyedMap"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) - } - - if err := x.writeField0(p); err != nil { - return err - } - - if err := p.WriteFieldStop(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) - } - - if err := p.WriteStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) - } - return nil -} - -func (x *respSomeServiceBinaryKeyedMap) Read(p thrift.Decoder) error { - if _, err := p.ReadStructBegin(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) - } - - for { - _, wireType, id, err := p.ReadFieldBegin() - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) - } - - if wireType == thrift.STOP { - break; - } - - var fieldReadErr error - switch { - case (id == 0 && wireType == thrift.Type(thrift.MAP)): // success - fieldReadErr = x.readField0(p) - default: - fieldReadErr = p.Skip(wireType) - } - - if fieldReadErr != nil { - return fieldReadErr - } - - if err := p.ReadFieldEnd(); err != nil { - return err - } - } - - if err := p.ReadStructEnd(); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) - } - - return nil -} - -func (x *respSomeServiceBinaryKeyedMap) String() string { - if x == nil { - return "" - } - - var sb strings.Builder - - sb.WriteString("respSomeServiceBinaryKeyedMap({") - sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) - sb.WriteString("})") - - return sb.String() -} -func (x *respSomeServiceBinaryKeyedMap) setDefaults() *respSomeServiceBinaryKeyedMap { - return x -} - - type SomeServiceProcessor struct { processorFunctionMap map[string]thrift.ProcessorFunction diff --git a/thrift/compiler/test/fixtures/types/out/go/gen-go/module/types.go b/thrift/compiler/test/fixtures/types/out/go/gen-go/module/types.go index a44f97b222a..bb42f9b5157 100644 --- a/thrift/compiler/test/fixtures/types/out/go/gen-go/module/types.go +++ b/thrift/compiler/test/fixtures/types/out/go/gen-go/module/types.go @@ -7539,6 +7539,674 @@ func (x *StructWithDoubleUnderscores) setDefaults() *StructWithDoubleUnderscores } +// Service req/resp structs (below) +type reqSomeServiceBounceMap struct { + M included.SomeMap `thrift:"m,1" json:"m" db:"m"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqSomeServiceBounceMap)(nil) + +// Deprecated: SomeServiceBounceMapArgsDeprecated is deprecated, since it is supposed to be internal. +type SomeServiceBounceMapArgsDeprecated = reqSomeServiceBounceMap + +func newReqSomeServiceBounceMap() *reqSomeServiceBounceMap { + return (&reqSomeServiceBounceMap{}).setDefaults() +} + +func (x *reqSomeServiceBounceMap) GetM() included.SomeMap { + if !x.IsSetM() { + return included.NewSomeMap() + } + return x.M +} + +func (x *reqSomeServiceBounceMap) SetMNonCompat(value included.SomeMap) *reqSomeServiceBounceMap { + x.M = value + return x +} + +func (x *reqSomeServiceBounceMap) SetM(value included.SomeMap) *reqSomeServiceBounceMap { + x.M = value + return x +} + +func (x *reqSomeServiceBounceMap) IsSetM() bool { + return x != nil && x.M != nil +} + +func (x *reqSomeServiceBounceMap) writeField1(p thrift.Encoder) error { // M + if err := p.WriteFieldBegin("m", thrift.MAP, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.M + err := included.WriteSomeMap(item, p) +if err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqSomeServiceBounceMap) readField1(p thrift.Decoder) error { // M + result, err := included.ReadSomeMap(p) +if err != nil { + return err +} + + x.M = result + return nil +} + +func (x *reqSomeServiceBounceMap) toString1() string { // M + return fmt.Sprintf("%v", x.M) +} + + + +func (x *reqSomeServiceBounceMap) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqSomeServiceBounceMap"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqSomeServiceBounceMap) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.MAP)): // m + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqSomeServiceBounceMap) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqSomeServiceBounceMap({") + sb.WriteString(fmt.Sprintf("M:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqSomeServiceBounceMap) setDefaults() *reqSomeServiceBounceMap { + return x. + SetMNonCompat(included.NewSomeMap()) +} + +type respSomeServiceBounceMap struct { + Success included.SomeMap `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respSomeServiceBounceMap)(nil) +var _ thrift.WritableResult = (*respSomeServiceBounceMap)(nil) + +// Deprecated: SomeServiceBounceMapResultDeprecated is deprecated, since it is supposed to be internal. +type SomeServiceBounceMapResultDeprecated = respSomeServiceBounceMap + +func newRespSomeServiceBounceMap() *respSomeServiceBounceMap { + return (&respSomeServiceBounceMap{}).setDefaults() +} + +func (x *respSomeServiceBounceMap) GetSuccess() included.SomeMap { + if !x.IsSetSuccess() { + return included.NewSomeMap() + } + return x.Success +} + +func (x *respSomeServiceBounceMap) SetSuccessNonCompat(value included.SomeMap) *respSomeServiceBounceMap { + x.Success = value + return x +} + +func (x *respSomeServiceBounceMap) SetSuccess(value included.SomeMap) *respSomeServiceBounceMap { + x.Success = value + return x +} + +func (x *respSomeServiceBounceMap) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respSomeServiceBounceMap) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.MAP, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Success + err := included.WriteSomeMap(item, p) +if err != nil { + return err +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respSomeServiceBounceMap) readField0(p thrift.Decoder) error { // Success + result, err := included.ReadSomeMap(p) +if err != nil { + return err +} + + x.Success = result + return nil +} + +func (x *respSomeServiceBounceMap) toString0() string { // Success + return fmt.Sprintf("%v", x.Success) +} + + + +func (x *respSomeServiceBounceMap) Exception() thrift.WritableException { + return nil +} + +func (x *respSomeServiceBounceMap) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respSomeServiceBounceMap"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respSomeServiceBounceMap) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.MAP)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respSomeServiceBounceMap) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respSomeServiceBounceMap({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respSomeServiceBounceMap) setDefaults() *respSomeServiceBounceMap { + return x +} + +type reqSomeServiceBinaryKeyedMap struct { + R []int64 `thrift:"r,1" json:"r" db:"r"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*reqSomeServiceBinaryKeyedMap)(nil) + +// Deprecated: SomeServiceBinaryKeyedMapArgsDeprecated is deprecated, since it is supposed to be internal. +type SomeServiceBinaryKeyedMapArgsDeprecated = reqSomeServiceBinaryKeyedMap + +func newReqSomeServiceBinaryKeyedMap() *reqSomeServiceBinaryKeyedMap { + return (&reqSomeServiceBinaryKeyedMap{}).setDefaults() +} + +func (x *reqSomeServiceBinaryKeyedMap) GetR() []int64 { + if !x.IsSetR() { + return make([]int64, 0) + } + return x.R +} + +func (x *reqSomeServiceBinaryKeyedMap) SetRNonCompat(value []int64) *reqSomeServiceBinaryKeyedMap { + x.R = value + return x +} + +func (x *reqSomeServiceBinaryKeyedMap) SetR(value []int64) *reqSomeServiceBinaryKeyedMap { + x.R = value + return x +} + +func (x *reqSomeServiceBinaryKeyedMap) IsSetR() bool { + return x != nil && x.R != nil +} + +func (x *reqSomeServiceBinaryKeyedMap) writeField1(p thrift.Encoder) error { // R + if err := p.WriteFieldBegin("r", thrift.LIST, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.R + if err := p.WriteListBegin(thrift.I64, len(item)); err != nil { + return thrift.PrependError("error writing list begin: ", err) +} +for _, v := range item { + { + item := v + if err := p.WriteI64(item); err != nil { + return err +} + } +} +if err := p.WriteListEnd(); err != nil { + return thrift.PrependError("error writing list end: ", err) +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *reqSomeServiceBinaryKeyedMap) readField1(p thrift.Decoder) error { // R + _ /* elemType */, size, err := p.ReadListBegin() +if err != nil { + return thrift.PrependError("error reading list begin: ", err) +} + +listResult := make([]int64, 0, size) +for i := 0; i < size; i++ { + var elem int64 + { + result, err := p.ReadI64() +if err != nil { + return err +} + elem = result + } + listResult = append(listResult, elem) +} + +if err := p.ReadListEnd(); err != nil { + return thrift.PrependError("error reading list end: ", err) +} +result := listResult + + x.R = result + return nil +} + +func (x *reqSomeServiceBinaryKeyedMap) toString1() string { // R + return fmt.Sprintf("%v", x.R) +} + + + +func (x *reqSomeServiceBinaryKeyedMap) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("reqSomeServiceBinaryKeyedMap"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField1(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *reqSomeServiceBinaryKeyedMap) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 1 && wireType == thrift.Type(thrift.LIST)): // r + fieldReadErr = x.readField1(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *reqSomeServiceBinaryKeyedMap) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("reqSomeServiceBinaryKeyedMap({") + sb.WriteString(fmt.Sprintf("R:%s", x.toString1())) + sb.WriteString("})") + + return sb.String() +} +func (x *reqSomeServiceBinaryKeyedMap) setDefaults() *reqSomeServiceBinaryKeyedMap { + return x. + SetRNonCompat(make([]int64, 0)) +} + +type respSomeServiceBinaryKeyedMap struct { + Success map[*TBinary]int64 `thrift:"success,0,optional" json:"success,omitempty" db:"success"` +} +// Compile time interface enforcer +var _ thrift.Struct = (*respSomeServiceBinaryKeyedMap)(nil) +var _ thrift.WritableResult = (*respSomeServiceBinaryKeyedMap)(nil) + +// Deprecated: SomeServiceBinaryKeyedMapResultDeprecated is deprecated, since it is supposed to be internal. +type SomeServiceBinaryKeyedMapResultDeprecated = respSomeServiceBinaryKeyedMap + +func newRespSomeServiceBinaryKeyedMap() *respSomeServiceBinaryKeyedMap { + return (&respSomeServiceBinaryKeyedMap{}).setDefaults() +} + +func (x *respSomeServiceBinaryKeyedMap) GetSuccess() map[*TBinary]int64 { + if !x.IsSetSuccess() { + return make(map[*TBinary]int64) + } + return x.Success +} + +func (x *respSomeServiceBinaryKeyedMap) SetSuccessNonCompat(value map[*TBinary]int64) *respSomeServiceBinaryKeyedMap { + x.Success = value + return x +} + +func (x *respSomeServiceBinaryKeyedMap) SetSuccess(value map[*TBinary]int64) *respSomeServiceBinaryKeyedMap { + x.Success = value + return x +} + +func (x *respSomeServiceBinaryKeyedMap) IsSetSuccess() bool { + return x != nil && x.Success != nil +} + +func (x *respSomeServiceBinaryKeyedMap) writeField0(p thrift.Encoder) error { // Success + if !x.IsSetSuccess() { + return nil + } + + if err := p.WriteFieldBegin("success", thrift.MAP, 0); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) + } + + item := x.Success + if err := p.WriteMapBegin(thrift.STRING, thrift.I64, len(item)); err != nil { + return thrift.PrependError("error writing map begin: ", err) +} +for k, v := range item { + if k == nil { + return fmt.Errorf("%T write map: nil key is not allowed.", item) + } + + { + item := *k + err := WriteTBinary(item, p) +if err != nil { + return err +} + } + + { + item := v + if err := p.WriteI64(item); err != nil { + return err +} + } +} +if err := p.WriteMapEnd(); err != nil { + return thrift.PrependError("error writing map end: ", err) +} + + if err := p.WriteFieldEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) + } + return nil +} + +func (x *respSomeServiceBinaryKeyedMap) readField0(p thrift.Decoder) error { // Success + _ /* keyType */, _ /* valueType */, size, err := p.ReadMapBegin() +if err != nil { + return thrift.PrependError("error reading map begin: ", err) +} + +mapResult := make(map[*TBinary]int64, size) +for i := 0; i < size; i++ { + var key *TBinary + { + result, err := ReadTBinary(p) +if err != nil { + return err +} + key = &result + } + + var value int64 + { + result, err := p.ReadI64() +if err != nil { + return err +} + value = result + } + + mapResult[key] = value +} + +if err := p.ReadMapEnd(); err != nil { + return thrift.PrependError("error reading map end: ", err) +} +result := mapResult + + x.Success = result + return nil +} + +func (x *respSomeServiceBinaryKeyedMap) toString0() string { // Success + return fmt.Sprintf("%v", x.Success) +} + + + +func (x *respSomeServiceBinaryKeyedMap) Exception() thrift.WritableException { + return nil +} + +func (x *respSomeServiceBinaryKeyedMap) Write(p thrift.Encoder) error { + if err := p.WriteStructBegin("respSomeServiceBinaryKeyedMap"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err) + } + + if err := x.writeField0(p); err != nil { + return err + } + + if err := p.WriteFieldStop(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err) + } + + if err := p.WriteStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err) + } + return nil +} + +func (x *respSomeServiceBinaryKeyedMap) Read(p thrift.Decoder) error { + if _, err := p.ReadStructBegin(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err) + } + + for { + _, wireType, id, err := p.ReadFieldBegin() + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err) + } + + if wireType == thrift.STOP { + break; + } + + var fieldReadErr error + switch { + case (id == 0 && wireType == thrift.Type(thrift.MAP)): // success + fieldReadErr = x.readField0(p) + default: + fieldReadErr = p.Skip(wireType) + } + + if fieldReadErr != nil { + return fieldReadErr + } + + if err := p.ReadFieldEnd(); err != nil { + return err + } + } + + if err := p.ReadStructEnd(); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err) + } + + return nil +} + +func (x *respSomeServiceBinaryKeyedMap) String() string { + if x == nil { + return "" + } + + var sb strings.Builder + + sb.WriteString("respSomeServiceBinaryKeyedMap({") + sb.WriteString(fmt.Sprintf("Success:%s", x.toString0())) + sb.WriteString("})") + + return sb.String() +} +func (x *respSomeServiceBinaryKeyedMap) setDefaults() *respSomeServiceBinaryKeyedMap { + return x +} + + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/cpp/types.go b/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/cpp/types.go index b7608402504..fde8434e68b 100644 --- a/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/cpp/types.go +++ b/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/cpp/types.go @@ -2282,6 +2282,7 @@ func (x *GenerateDeprecatedHeaderClientMethods) setDefaults() *GenerateDeprecate } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/scope/types.go b/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/scope/types.go index c2871133501..c8a6b005a41 100644 --- a/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/scope/types.go +++ b/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/scope/types.go @@ -1380,6 +1380,7 @@ func (x *Definition) setDefaults() *Definition { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any) diff --git a/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/thrift/types.go b/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/thrift/types.go index 85cadd20f65..ba562235211 100644 --- a/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/thrift/types.go +++ b/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/thrift/types.go @@ -1804,6 +1804,7 @@ func (x *AllowReservedFilename) setDefaults() *AllowReservedFilename { } + // RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry. func RegisterTypes(registry interface { RegisterType(name string, initializer func() any)