From cafbb0f0885a2c14e7b2b5ac66de1f2e6cc0fa11 Mon Sep 17 00:00:00 2001 From: Aravind Gopalan Date: Mon, 2 Sep 2019 22:11:27 -0700 Subject: [PATCH] Update generated code as well --- .../build/gen-code/clients/bar/bar/bar.go | 425 ------------------ .../gen-code/clients/bar/bar/bar_easyjson.go | 171 +------ .../build/gen-code/endpoints/bar/bar/bar.go | 425 ------------------ .../endpoints/bar/bar/bar_easyjson.go | 171 +------ 4 files changed, 2 insertions(+), 1190 deletions(-) diff --git a/examples/example-gateway/build/gen-code/clients/bar/bar/bar.go b/examples/example-gateway/build/gen-code/clients/bar/bar/bar.go index f9974bb8a..ce4796ca8 100644 --- a/examples/example-gateway/build/gen-code/clients/bar/bar/bar.go +++ b/examples/example-gateway/build/gen-code/clients/bar/bar/bar.go @@ -8266,431 +8266,6 @@ func (v *Bar_DeleteFoo_Result) EnvelopeType() wire.EnvelopeType { return wire.Reply } -// Bar_DeleteWithQueryParams_Args represents the arguments for the Bar.deleteWithQueryParams function. -// -// The arguments for deleteWithQueryParams are sent and received over the wire as this struct. -type Bar_DeleteWithQueryParams_Args struct { - Request *BarRequest `json:"request,required"` - Filter string `json:"filter,required"` - Count *int32 `json:"count,omitempty"` -} - -// ToWire translates a Bar_DeleteWithQueryParams_Args struct into a Thrift-level intermediate -// representation. This intermediate representation may be serialized -// into bytes using a ThriftRW protocol implementation. -// -// An error is returned if the struct or any of its fields failed to -// validate. -// -// x, err := v.ToWire() -// if err != nil { -// return err -// } -// -// if err := binaryProtocol.Encode(x, writer); err != nil { -// return err -// } -func (v *Bar_DeleteWithQueryParams_Args) ToWire() (wire.Value, error) { - var ( - fields [3]wire.Field - i int = 0 - w wire.Value - err error - ) - - if v.Request == nil { - return w, errors.New("field Request of Bar_DeleteWithQueryParams_Args is required") - } - w, err = v.Request.ToWire() - if err != nil { - return w, err - } - fields[i] = wire.Field{ID: 1, Value: w} - i++ - - w, err = wire.NewValueString(v.Filter), error(nil) - if err != nil { - return w, err - } - fields[i] = wire.Field{ID: 2, Value: w} - i++ - if v.Count != nil { - w, err = wire.NewValueI32(*(v.Count)), error(nil) - if err != nil { - return w, err - } - fields[i] = wire.Field{ID: 3, Value: w} - i++ - } - - return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil -} - -// FromWire deserializes a Bar_DeleteWithQueryParams_Args struct from its Thrift-level -// representation. The Thrift-level representation may be obtained -// from a ThriftRW protocol implementation. -// -// An error is returned if we were unable to build a Bar_DeleteWithQueryParams_Args struct -// from the provided intermediate representation. -// -// x, err := binaryProtocol.Decode(reader, wire.TStruct) -// if err != nil { -// return nil, err -// } -// -// var v Bar_DeleteWithQueryParams_Args -// if err := v.FromWire(x); err != nil { -// return nil, err -// } -// return &v, nil -func (v *Bar_DeleteWithQueryParams_Args) FromWire(w wire.Value) error { - var err error - - requestIsSet := false - filterIsSet := false - - for _, field := range w.GetStruct().Fields { - switch field.ID { - case 1: - if field.Value.Type() == wire.TStruct { - v.Request, err = _BarRequest_Read(field.Value) - if err != nil { - return err - } - requestIsSet = true - } - case 2: - if field.Value.Type() == wire.TBinary { - v.Filter, err = field.Value.GetString(), error(nil) - if err != nil { - return err - } - filterIsSet = true - } - case 3: - if field.Value.Type() == wire.TI32 { - var x int32 - x, err = field.Value.GetI32(), error(nil) - v.Count = &x - if err != nil { - return err - } - - } - } - } - - if !requestIsSet { - return errors.New("field Request of Bar_DeleteWithQueryParams_Args is required") - } - - if !filterIsSet { - return errors.New("field Filter of Bar_DeleteWithQueryParams_Args is required") - } - - return nil -} - -// String returns a readable string representation of a Bar_DeleteWithQueryParams_Args -// struct. -func (v *Bar_DeleteWithQueryParams_Args) String() string { - if v == nil { - return "" - } - - var fields [3]string - i := 0 - fields[i] = fmt.Sprintf("Request: %v", v.Request) - i++ - fields[i] = fmt.Sprintf("Filter: %v", v.Filter) - i++ - if v.Count != nil { - fields[i] = fmt.Sprintf("Count: %v", *(v.Count)) - i++ - } - - return fmt.Sprintf("Bar_DeleteWithQueryParams_Args{%v}", strings.Join(fields[:i], ", ")) -} - -// Equals returns true if all the fields of this Bar_DeleteWithQueryParams_Args match the -// provided Bar_DeleteWithQueryParams_Args. -// -// This function performs a deep comparison. -func (v *Bar_DeleteWithQueryParams_Args) Equals(rhs *Bar_DeleteWithQueryParams_Args) bool { - if v == nil { - return rhs == nil - } else if rhs == nil { - return false - } - if !v.Request.Equals(rhs.Request) { - return false - } - if !(v.Filter == rhs.Filter) { - return false - } - if !_I32_EqualsPtr(v.Count, rhs.Count) { - return false - } - - return true -} - -// MarshalLogObject implements zapcore.ObjectMarshaler, enabling -// fast logging of Bar_DeleteWithQueryParams_Args. -func (v *Bar_DeleteWithQueryParams_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { - if v == nil { - return nil - } - err = multierr.Append(err, enc.AddObject("request", v.Request)) - enc.AddString("filter", v.Filter) - if v.Count != nil { - enc.AddInt32("count", *v.Count) - } - return err -} - -// GetRequest returns the value of Request if it is set or its -// zero value if it is unset. -func (v *Bar_DeleteWithQueryParams_Args) GetRequest() (o *BarRequest) { - if v != nil { - o = v.Request - } - return -} - -// IsSetRequest returns true if Request is not nil. -func (v *Bar_DeleteWithQueryParams_Args) IsSetRequest() bool { - return v != nil && v.Request != nil -} - -// GetFilter returns the value of Filter if it is set or its -// zero value if it is unset. -func (v *Bar_DeleteWithQueryParams_Args) GetFilter() (o string) { - if v != nil { - o = v.Filter - } - return -} - -// GetCount returns the value of Count if it is set or its -// zero value if it is unset. -func (v *Bar_DeleteWithQueryParams_Args) GetCount() (o int32) { - if v != nil && v.Count != nil { - return *v.Count - } - - return -} - -// IsSetCount returns true if Count is not nil. -func (v *Bar_DeleteWithQueryParams_Args) IsSetCount() bool { - return v != nil && v.Count != nil -} - -// MethodName returns the name of the Thrift function as specified in -// the IDL, for which this struct represent the arguments. -// -// This will always be "deleteWithQueryParams" for this struct. -func (v *Bar_DeleteWithQueryParams_Args) MethodName() string { - return "deleteWithQueryParams" -} - -// EnvelopeType returns the kind of value inside this struct. -// -// This will always be Call for this struct. -func (v *Bar_DeleteWithQueryParams_Args) EnvelopeType() wire.EnvelopeType { - return wire.Call -} - -// Bar_DeleteWithQueryParams_Helper provides functions that aid in handling the -// parameters and return values of the Bar.deleteWithQueryParams -// function. -var Bar_DeleteWithQueryParams_Helper = struct { - // Args accepts the parameters of deleteWithQueryParams in-order and returns - // the arguments struct for the function. - Args func( - request *BarRequest, - filter string, - count *int32, - ) *Bar_DeleteWithQueryParams_Args - - // IsException returns true if the given error can be thrown - // by deleteWithQueryParams. - // - // An error can be thrown by deleteWithQueryParams only if the - // corresponding exception type was mentioned in the 'throws' - // section for it in the Thrift file. - IsException func(error) bool - - // WrapResponse returns the result struct for deleteWithQueryParams - // given the error returned by it. The provided error may - // be nil if deleteWithQueryParams did not fail. - // - // This allows mapping errors returned by deleteWithQueryParams into a - // serializable result struct. WrapResponse returns a - // non-nil error if the provided error cannot be thrown by - // deleteWithQueryParams - // - // err := deleteWithQueryParams(args) - // result, err := Bar_DeleteWithQueryParams_Helper.WrapResponse(err) - // if err != nil { - // return fmt.Errorf("unexpected error from deleteWithQueryParams: %v", err) - // } - // serialize(result) - WrapResponse func(error) (*Bar_DeleteWithQueryParams_Result, error) - - // UnwrapResponse takes the result struct for deleteWithQueryParams - // and returns the erorr returned by it (if any). - // - // The error is non-nil only if deleteWithQueryParams threw an - // exception. - // - // result := deserialize(bytes) - // err := Bar_DeleteWithQueryParams_Helper.UnwrapResponse(result) - UnwrapResponse func(*Bar_DeleteWithQueryParams_Result) error -}{} - -func init() { - Bar_DeleteWithQueryParams_Helper.Args = func( - request *BarRequest, - filter string, - count *int32, - ) *Bar_DeleteWithQueryParams_Args { - return &Bar_DeleteWithQueryParams_Args{ - Request: request, - Filter: filter, - Count: count, - } - } - - Bar_DeleteWithQueryParams_Helper.IsException = func(err error) bool { - switch err.(type) { - default: - return false - } - } - - Bar_DeleteWithQueryParams_Helper.WrapResponse = func(err error) (*Bar_DeleteWithQueryParams_Result, error) { - if err == nil { - return &Bar_DeleteWithQueryParams_Result{}, nil - } - - return nil, err - } - Bar_DeleteWithQueryParams_Helper.UnwrapResponse = func(result *Bar_DeleteWithQueryParams_Result) (err error) { - return - } - -} - -// Bar_DeleteWithQueryParams_Result represents the result of a Bar.deleteWithQueryParams function call. -// -// The result of a deleteWithQueryParams execution is sent and received over the wire as this struct. -type Bar_DeleteWithQueryParams_Result struct { -} - -// ToWire translates a Bar_DeleteWithQueryParams_Result struct into a Thrift-level intermediate -// representation. This intermediate representation may be serialized -// into bytes using a ThriftRW protocol implementation. -// -// An error is returned if the struct or any of its fields failed to -// validate. -// -// x, err := v.ToWire() -// if err != nil { -// return err -// } -// -// if err := binaryProtocol.Encode(x, writer); err != nil { -// return err -// } -func (v *Bar_DeleteWithQueryParams_Result) ToWire() (wire.Value, error) { - var ( - fields [0]wire.Field - i int = 0 - ) - - return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil -} - -// FromWire deserializes a Bar_DeleteWithQueryParams_Result struct from its Thrift-level -// representation. The Thrift-level representation may be obtained -// from a ThriftRW protocol implementation. -// -// An error is returned if we were unable to build a Bar_DeleteWithQueryParams_Result struct -// from the provided intermediate representation. -// -// x, err := binaryProtocol.Decode(reader, wire.TStruct) -// if err != nil { -// return nil, err -// } -// -// var v Bar_DeleteWithQueryParams_Result -// if err := v.FromWire(x); err != nil { -// return nil, err -// } -// return &v, nil -func (v *Bar_DeleteWithQueryParams_Result) FromWire(w wire.Value) error { - - for _, field := range w.GetStruct().Fields { - switch field.ID { - } - } - - return nil -} - -// String returns a readable string representation of a Bar_DeleteWithQueryParams_Result -// struct. -func (v *Bar_DeleteWithQueryParams_Result) String() string { - if v == nil { - return "" - } - - var fields [0]string - i := 0 - - return fmt.Sprintf("Bar_DeleteWithQueryParams_Result{%v}", strings.Join(fields[:i], ", ")) -} - -// Equals returns true if all the fields of this Bar_DeleteWithQueryParams_Result match the -// provided Bar_DeleteWithQueryParams_Result. -// -// This function performs a deep comparison. -func (v *Bar_DeleteWithQueryParams_Result) Equals(rhs *Bar_DeleteWithQueryParams_Result) bool { - if v == nil { - return rhs == nil - } else if rhs == nil { - return false - } - - return true -} - -// MarshalLogObject implements zapcore.ObjectMarshaler, enabling -// fast logging of Bar_DeleteWithQueryParams_Result. -func (v *Bar_DeleteWithQueryParams_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { - if v == nil { - return nil - } - return err -} - -// MethodName returns the name of the Thrift function as specified in -// the IDL, for which this struct represent the result. -// -// This will always be "deleteWithQueryParams" for this struct. -func (v *Bar_DeleteWithQueryParams_Result) MethodName() string { - return "deleteWithQueryParams" -} - -// EnvelopeType returns the kind of value inside this struct. -// -// This will always be Reply for this struct. -func (v *Bar_DeleteWithQueryParams_Result) EnvelopeType() wire.EnvelopeType { - return wire.Reply -} - // Bar_HelloWorld_Args represents the arguments for the Bar.helloWorld function. // // The arguments for helloWorld are sent and received over the wire as this struct. diff --git a/examples/example-gateway/build/gen-code/clients/bar/bar/bar_easyjson.go b/examples/example-gateway/build/gen-code/clients/bar/bar/bar_easyjson.go index d2b51729b..590399dc0 100644 --- a/examples/example-gateway/build/gen-code/clients/bar/bar/bar_easyjson.go +++ b/examples/example-gateway/build/gen-code/clients/bar/bar/bar_easyjson.go @@ -1,6 +1,6 @@ // Code generated by zanzibar // @generated -// Checksum : itPRm99+hoUiow0HdTqSQg== +// Checksum : 4TEHPwCeEPs67fIBkaUMUg== // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT. package bar @@ -5234,175 +5234,6 @@ func (v *Bar_HelloWorld_Args) UnmarshalJSON(data []byte) error { func (v *Bar_HelloWorld_Args) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjson4347b5c1DecodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeClientsBarBarBarHelloWorld1(l, v) } -func easyjson4347b5c1DecodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeClientsBarBarBarDeleteWithQueryParams(in *jlexer.Lexer, out *Bar_DeleteWithQueryParams_Result) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson4347b5c1EncodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeClientsBarBarBarDeleteWithQueryParams(out *jwriter.Writer, in Bar_DeleteWithQueryParams_Result) { - out.RawByte('{') - first := true - _ = first - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Bar_DeleteWithQueryParams_Result) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson4347b5c1EncodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeClientsBarBarBarDeleteWithQueryParams(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Bar_DeleteWithQueryParams_Result) MarshalEasyJSON(w *jwriter.Writer) { - easyjson4347b5c1EncodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeClientsBarBarBarDeleteWithQueryParams(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Bar_DeleteWithQueryParams_Result) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson4347b5c1DecodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeClientsBarBarBarDeleteWithQueryParams(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Bar_DeleteWithQueryParams_Result) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson4347b5c1DecodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeClientsBarBarBarDeleteWithQueryParams(l, v) -} -func easyjson4347b5c1DecodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeClientsBarBarBarDeleteWithQueryParams1(in *jlexer.Lexer, out *Bar_DeleteWithQueryParams_Args) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - var RequestSet bool - var FilterSet bool - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "request": - if in.IsNull() { - in.Skip() - out.Request = nil - } else { - if out.Request == nil { - out.Request = new(BarRequest) - } - (*out.Request).UnmarshalEasyJSON(in) - } - RequestSet = true - case "filter": - out.Filter = string(in.String()) - FilterSet = true - case "count": - if in.IsNull() { - in.Skip() - out.Count = nil - } else { - if out.Count == nil { - out.Count = new(int32) - } - *out.Count = int32(in.Int32()) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } - if !RequestSet { - in.AddError(fmt.Errorf("key 'request' is required")) - } - if !FilterSet { - in.AddError(fmt.Errorf("key 'filter' is required")) - } -} -func easyjson4347b5c1EncodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeClientsBarBarBarDeleteWithQueryParams1(out *jwriter.Writer, in Bar_DeleteWithQueryParams_Args) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"request\":" - out.RawString(prefix[1:]) - if in.Request == nil { - out.RawString("null") - } else { - (*in.Request).MarshalEasyJSON(out) - } - } - { - const prefix string = ",\"filter\":" - out.RawString(prefix) - out.String(string(in.Filter)) - } - if in.Count != nil { - const prefix string = ",\"count\":" - out.RawString(prefix) - out.Int32(int32(*in.Count)) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Bar_DeleteWithQueryParams_Args) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson4347b5c1EncodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeClientsBarBarBarDeleteWithQueryParams1(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Bar_DeleteWithQueryParams_Args) MarshalEasyJSON(w *jwriter.Writer) { - easyjson4347b5c1EncodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeClientsBarBarBarDeleteWithQueryParams1(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Bar_DeleteWithQueryParams_Args) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson4347b5c1DecodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeClientsBarBarBarDeleteWithQueryParams1(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Bar_DeleteWithQueryParams_Args) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson4347b5c1DecodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeClientsBarBarBarDeleteWithQueryParams1(l, v) -} func easyjson4347b5c1DecodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeClientsBarBarBarDeleteFoo(in *jlexer.Lexer, out *Bar_DeleteFoo_Result) { isTopLevel := in.IsStart() if in.IsNull() { diff --git a/examples/example-gateway/build/gen-code/endpoints/bar/bar/bar.go b/examples/example-gateway/build/gen-code/endpoints/bar/bar/bar.go index d43c56e6b..3498a6a5a 100644 --- a/examples/example-gateway/build/gen-code/endpoints/bar/bar/bar.go +++ b/examples/example-gateway/build/gen-code/endpoints/bar/bar/bar.go @@ -7575,431 +7575,6 @@ func (v *Bar_ArgWithQueryParams_Result) EnvelopeType() wire.EnvelopeType { return wire.Reply } -// Bar_DeleteWithQueryParams_Args represents the arguments for the Bar.deleteWithQueryParams function. -// -// The arguments for deleteWithQueryParams are sent and received over the wire as this struct. -type Bar_DeleteWithQueryParams_Args struct { - Request *BarRequest `json:"request,required"` - Filter string `json:"filter,required"` - Count *int32 `json:"count,omitempty"` -} - -// ToWire translates a Bar_DeleteWithQueryParams_Args struct into a Thrift-level intermediate -// representation. This intermediate representation may be serialized -// into bytes using a ThriftRW protocol implementation. -// -// An error is returned if the struct or any of its fields failed to -// validate. -// -// x, err := v.ToWire() -// if err != nil { -// return err -// } -// -// if err := binaryProtocol.Encode(x, writer); err != nil { -// return err -// } -func (v *Bar_DeleteWithQueryParams_Args) ToWire() (wire.Value, error) { - var ( - fields [3]wire.Field - i int = 0 - w wire.Value - err error - ) - - if v.Request == nil { - return w, errors.New("field Request of Bar_DeleteWithQueryParams_Args is required") - } - w, err = v.Request.ToWire() - if err != nil { - return w, err - } - fields[i] = wire.Field{ID: 1, Value: w} - i++ - - w, err = wire.NewValueString(v.Filter), error(nil) - if err != nil { - return w, err - } - fields[i] = wire.Field{ID: 2, Value: w} - i++ - if v.Count != nil { - w, err = wire.NewValueI32(*(v.Count)), error(nil) - if err != nil { - return w, err - } - fields[i] = wire.Field{ID: 3, Value: w} - i++ - } - - return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil -} - -// FromWire deserializes a Bar_DeleteWithQueryParams_Args struct from its Thrift-level -// representation. The Thrift-level representation may be obtained -// from a ThriftRW protocol implementation. -// -// An error is returned if we were unable to build a Bar_DeleteWithQueryParams_Args struct -// from the provided intermediate representation. -// -// x, err := binaryProtocol.Decode(reader, wire.TStruct) -// if err != nil { -// return nil, err -// } -// -// var v Bar_DeleteWithQueryParams_Args -// if err := v.FromWire(x); err != nil { -// return nil, err -// } -// return &v, nil -func (v *Bar_DeleteWithQueryParams_Args) FromWire(w wire.Value) error { - var err error - - requestIsSet := false - filterIsSet := false - - for _, field := range w.GetStruct().Fields { - switch field.ID { - case 1: - if field.Value.Type() == wire.TStruct { - v.Request, err = _BarRequest_Read(field.Value) - if err != nil { - return err - } - requestIsSet = true - } - case 2: - if field.Value.Type() == wire.TBinary { - v.Filter, err = field.Value.GetString(), error(nil) - if err != nil { - return err - } - filterIsSet = true - } - case 3: - if field.Value.Type() == wire.TI32 { - var x int32 - x, err = field.Value.GetI32(), error(nil) - v.Count = &x - if err != nil { - return err - } - - } - } - } - - if !requestIsSet { - return errors.New("field Request of Bar_DeleteWithQueryParams_Args is required") - } - - if !filterIsSet { - return errors.New("field Filter of Bar_DeleteWithQueryParams_Args is required") - } - - return nil -} - -// String returns a readable string representation of a Bar_DeleteWithQueryParams_Args -// struct. -func (v *Bar_DeleteWithQueryParams_Args) String() string { - if v == nil { - return "" - } - - var fields [3]string - i := 0 - fields[i] = fmt.Sprintf("Request: %v", v.Request) - i++ - fields[i] = fmt.Sprintf("Filter: %v", v.Filter) - i++ - if v.Count != nil { - fields[i] = fmt.Sprintf("Count: %v", *(v.Count)) - i++ - } - - return fmt.Sprintf("Bar_DeleteWithQueryParams_Args{%v}", strings.Join(fields[:i], ", ")) -} - -// Equals returns true if all the fields of this Bar_DeleteWithQueryParams_Args match the -// provided Bar_DeleteWithQueryParams_Args. -// -// This function performs a deep comparison. -func (v *Bar_DeleteWithQueryParams_Args) Equals(rhs *Bar_DeleteWithQueryParams_Args) bool { - if v == nil { - return rhs == nil - } else if rhs == nil { - return false - } - if !v.Request.Equals(rhs.Request) { - return false - } - if !(v.Filter == rhs.Filter) { - return false - } - if !_I32_EqualsPtr(v.Count, rhs.Count) { - return false - } - - return true -} - -// MarshalLogObject implements zapcore.ObjectMarshaler, enabling -// fast logging of Bar_DeleteWithQueryParams_Args. -func (v *Bar_DeleteWithQueryParams_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { - if v == nil { - return nil - } - err = multierr.Append(err, enc.AddObject("request", v.Request)) - enc.AddString("filter", v.Filter) - if v.Count != nil { - enc.AddInt32("count", *v.Count) - } - return err -} - -// GetRequest returns the value of Request if it is set or its -// zero value if it is unset. -func (v *Bar_DeleteWithQueryParams_Args) GetRequest() (o *BarRequest) { - if v != nil { - o = v.Request - } - return -} - -// IsSetRequest returns true if Request is not nil. -func (v *Bar_DeleteWithQueryParams_Args) IsSetRequest() bool { - return v != nil && v.Request != nil -} - -// GetFilter returns the value of Filter if it is set or its -// zero value if it is unset. -func (v *Bar_DeleteWithQueryParams_Args) GetFilter() (o string) { - if v != nil { - o = v.Filter - } - return -} - -// GetCount returns the value of Count if it is set or its -// zero value if it is unset. -func (v *Bar_DeleteWithQueryParams_Args) GetCount() (o int32) { - if v != nil && v.Count != nil { - return *v.Count - } - - return -} - -// IsSetCount returns true if Count is not nil. -func (v *Bar_DeleteWithQueryParams_Args) IsSetCount() bool { - return v != nil && v.Count != nil -} - -// MethodName returns the name of the Thrift function as specified in -// the IDL, for which this struct represent the arguments. -// -// This will always be "deleteWithQueryParams" for this struct. -func (v *Bar_DeleteWithQueryParams_Args) MethodName() string { - return "deleteWithQueryParams" -} - -// EnvelopeType returns the kind of value inside this struct. -// -// This will always be Call for this struct. -func (v *Bar_DeleteWithQueryParams_Args) EnvelopeType() wire.EnvelopeType { - return wire.Call -} - -// Bar_DeleteWithQueryParams_Helper provides functions that aid in handling the -// parameters and return values of the Bar.deleteWithQueryParams -// function. -var Bar_DeleteWithQueryParams_Helper = struct { - // Args accepts the parameters of deleteWithQueryParams in-order and returns - // the arguments struct for the function. - Args func( - request *BarRequest, - filter string, - count *int32, - ) *Bar_DeleteWithQueryParams_Args - - // IsException returns true if the given error can be thrown - // by deleteWithQueryParams. - // - // An error can be thrown by deleteWithQueryParams only if the - // corresponding exception type was mentioned in the 'throws' - // section for it in the Thrift file. - IsException func(error) bool - - // WrapResponse returns the result struct for deleteWithQueryParams - // given the error returned by it. The provided error may - // be nil if deleteWithQueryParams did not fail. - // - // This allows mapping errors returned by deleteWithQueryParams into a - // serializable result struct. WrapResponse returns a - // non-nil error if the provided error cannot be thrown by - // deleteWithQueryParams - // - // err := deleteWithQueryParams(args) - // result, err := Bar_DeleteWithQueryParams_Helper.WrapResponse(err) - // if err != nil { - // return fmt.Errorf("unexpected error from deleteWithQueryParams: %v", err) - // } - // serialize(result) - WrapResponse func(error) (*Bar_DeleteWithQueryParams_Result, error) - - // UnwrapResponse takes the result struct for deleteWithQueryParams - // and returns the erorr returned by it (if any). - // - // The error is non-nil only if deleteWithQueryParams threw an - // exception. - // - // result := deserialize(bytes) - // err := Bar_DeleteWithQueryParams_Helper.UnwrapResponse(result) - UnwrapResponse func(*Bar_DeleteWithQueryParams_Result) error -}{} - -func init() { - Bar_DeleteWithQueryParams_Helper.Args = func( - request *BarRequest, - filter string, - count *int32, - ) *Bar_DeleteWithQueryParams_Args { - return &Bar_DeleteWithQueryParams_Args{ - Request: request, - Filter: filter, - Count: count, - } - } - - Bar_DeleteWithQueryParams_Helper.IsException = func(err error) bool { - switch err.(type) { - default: - return false - } - } - - Bar_DeleteWithQueryParams_Helper.WrapResponse = func(err error) (*Bar_DeleteWithQueryParams_Result, error) { - if err == nil { - return &Bar_DeleteWithQueryParams_Result{}, nil - } - - return nil, err - } - Bar_DeleteWithQueryParams_Helper.UnwrapResponse = func(result *Bar_DeleteWithQueryParams_Result) (err error) { - return - } - -} - -// Bar_DeleteWithQueryParams_Result represents the result of a Bar.deleteWithQueryParams function call. -// -// The result of a deleteWithQueryParams execution is sent and received over the wire as this struct. -type Bar_DeleteWithQueryParams_Result struct { -} - -// ToWire translates a Bar_DeleteWithQueryParams_Result struct into a Thrift-level intermediate -// representation. This intermediate representation may be serialized -// into bytes using a ThriftRW protocol implementation. -// -// An error is returned if the struct or any of its fields failed to -// validate. -// -// x, err := v.ToWire() -// if err != nil { -// return err -// } -// -// if err := binaryProtocol.Encode(x, writer); err != nil { -// return err -// } -func (v *Bar_DeleteWithQueryParams_Result) ToWire() (wire.Value, error) { - var ( - fields [0]wire.Field - i int = 0 - ) - - return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil -} - -// FromWire deserializes a Bar_DeleteWithQueryParams_Result struct from its Thrift-level -// representation. The Thrift-level representation may be obtained -// from a ThriftRW protocol implementation. -// -// An error is returned if we were unable to build a Bar_DeleteWithQueryParams_Result struct -// from the provided intermediate representation. -// -// x, err := binaryProtocol.Decode(reader, wire.TStruct) -// if err != nil { -// return nil, err -// } -// -// var v Bar_DeleteWithQueryParams_Result -// if err := v.FromWire(x); err != nil { -// return nil, err -// } -// return &v, nil -func (v *Bar_DeleteWithQueryParams_Result) FromWire(w wire.Value) error { - - for _, field := range w.GetStruct().Fields { - switch field.ID { - } - } - - return nil -} - -// String returns a readable string representation of a Bar_DeleteWithQueryParams_Result -// struct. -func (v *Bar_DeleteWithQueryParams_Result) String() string { - if v == nil { - return "" - } - - var fields [0]string - i := 0 - - return fmt.Sprintf("Bar_DeleteWithQueryParams_Result{%v}", strings.Join(fields[:i], ", ")) -} - -// Equals returns true if all the fields of this Bar_DeleteWithQueryParams_Result match the -// provided Bar_DeleteWithQueryParams_Result. -// -// This function performs a deep comparison. -func (v *Bar_DeleteWithQueryParams_Result) Equals(rhs *Bar_DeleteWithQueryParams_Result) bool { - if v == nil { - return rhs == nil - } else if rhs == nil { - return false - } - - return true -} - -// MarshalLogObject implements zapcore.ObjectMarshaler, enabling -// fast logging of Bar_DeleteWithQueryParams_Result. -func (v *Bar_DeleteWithQueryParams_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) { - if v == nil { - return nil - } - return err -} - -// MethodName returns the name of the Thrift function as specified in -// the IDL, for which this struct represent the result. -// -// This will always be "deleteWithQueryParams" for this struct. -func (v *Bar_DeleteWithQueryParams_Result) MethodName() string { - return "deleteWithQueryParams" -} - -// EnvelopeType returns the kind of value inside this struct. -// -// This will always be Reply for this struct. -func (v *Bar_DeleteWithQueryParams_Result) EnvelopeType() wire.EnvelopeType { - return wire.Reply -} - // Bar_HelloWorld_Args represents the arguments for the Bar.helloWorld function. // // The arguments for helloWorld are sent and received over the wire as this struct. diff --git a/examples/example-gateway/build/gen-code/endpoints/bar/bar/bar_easyjson.go b/examples/example-gateway/build/gen-code/endpoints/bar/bar/bar_easyjson.go index ccd18252e..0317bc7c4 100644 --- a/examples/example-gateway/build/gen-code/endpoints/bar/bar/bar_easyjson.go +++ b/examples/example-gateway/build/gen-code/endpoints/bar/bar/bar_easyjson.go @@ -1,6 +1,6 @@ // Code generated by zanzibar // @generated -// Checksum : ToI7ej3sNVnfABz+0aw6Eg== +// Checksum : pSXULWXG4n0fUmKNYqH0LQ== // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT. package bar @@ -1776,175 +1776,6 @@ func (v *Bar_HelloWorld_Args) UnmarshalJSON(data []byte) error { func (v *Bar_HelloWorld_Args) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjson4347b5c1DecodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeEndpointsBarBarBarHelloWorld1(l, v) } -func easyjson4347b5c1DecodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeEndpointsBarBarBarDeleteWithQueryParams(in *jlexer.Lexer, out *Bar_DeleteWithQueryParams_Result) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson4347b5c1EncodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeEndpointsBarBarBarDeleteWithQueryParams(out *jwriter.Writer, in Bar_DeleteWithQueryParams_Result) { - out.RawByte('{') - first := true - _ = first - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Bar_DeleteWithQueryParams_Result) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson4347b5c1EncodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeEndpointsBarBarBarDeleteWithQueryParams(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Bar_DeleteWithQueryParams_Result) MarshalEasyJSON(w *jwriter.Writer) { - easyjson4347b5c1EncodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeEndpointsBarBarBarDeleteWithQueryParams(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Bar_DeleteWithQueryParams_Result) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson4347b5c1DecodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeEndpointsBarBarBarDeleteWithQueryParams(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Bar_DeleteWithQueryParams_Result) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson4347b5c1DecodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeEndpointsBarBarBarDeleteWithQueryParams(l, v) -} -func easyjson4347b5c1DecodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeEndpointsBarBarBarDeleteWithQueryParams1(in *jlexer.Lexer, out *Bar_DeleteWithQueryParams_Args) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - var RequestSet bool - var FilterSet bool - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "request": - if in.IsNull() { - in.Skip() - out.Request = nil - } else { - if out.Request == nil { - out.Request = new(BarRequest) - } - (*out.Request).UnmarshalEasyJSON(in) - } - RequestSet = true - case "filter": - out.Filter = string(in.String()) - FilterSet = true - case "count": - if in.IsNull() { - in.Skip() - out.Count = nil - } else { - if out.Count == nil { - out.Count = new(int32) - } - *out.Count = int32(in.Int32()) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } - if !RequestSet { - in.AddError(fmt.Errorf("key 'request' is required")) - } - if !FilterSet { - in.AddError(fmt.Errorf("key 'filter' is required")) - } -} -func easyjson4347b5c1EncodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeEndpointsBarBarBarDeleteWithQueryParams1(out *jwriter.Writer, in Bar_DeleteWithQueryParams_Args) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"request\":" - out.RawString(prefix[1:]) - if in.Request == nil { - out.RawString("null") - } else { - (*in.Request).MarshalEasyJSON(out) - } - } - { - const prefix string = ",\"filter\":" - out.RawString(prefix) - out.String(string(in.Filter)) - } - if in.Count != nil { - const prefix string = ",\"count\":" - out.RawString(prefix) - out.Int32(int32(*in.Count)) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Bar_DeleteWithQueryParams_Args) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson4347b5c1EncodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeEndpointsBarBarBarDeleteWithQueryParams1(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Bar_DeleteWithQueryParams_Args) MarshalEasyJSON(w *jwriter.Writer) { - easyjson4347b5c1EncodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeEndpointsBarBarBarDeleteWithQueryParams1(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Bar_DeleteWithQueryParams_Args) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson4347b5c1DecodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeEndpointsBarBarBarDeleteWithQueryParams1(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Bar_DeleteWithQueryParams_Args) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson4347b5c1DecodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeEndpointsBarBarBarDeleteWithQueryParams1(l, v) -} func easyjson4347b5c1DecodeGithubComUberZanzibarExamplesExampleGatewayBuildGenCodeEndpointsBarBarBarArgWithQueryParams(in *jlexer.Lexer, out *Bar_ArgWithQueryParams_Result) { isTopLevel := in.IsStart() if in.IsNull() {