// Code generated by thriftgo (0.2.8). DO NOT EDIT.

package cart

import (
	"context"
	"fmt"
	"github.com/apache/thrift/lib/go/thrift"
	"github.com/cqqqq777/go-kitex-mall/shared/kitex_gen/common"
)

type MallAddProductToCartRequest struct {
	UserId     int64 `thrift:"user_id,1" frugal:"1,default,i64" json:"user_id"`
	ProductId  int64 `thrift:"product_id,2" frugal:"2,default,i64" json:"product_id"`
	ProductNum int64 `thrift:"product_num,3" frugal:"3,default,i64" json:"product_num"`
}

func NewMallAddProductToCartRequest() *MallAddProductToCartRequest {
	return &MallAddProductToCartRequest{}
}

func (p *MallAddProductToCartRequest) InitDefault() {
	*p = MallAddProductToCartRequest{}
}

func (p *MallAddProductToCartRequest) GetUserId() (v int64) {
	return p.UserId
}

func (p *MallAddProductToCartRequest) GetProductId() (v int64) {
	return p.ProductId
}

func (p *MallAddProductToCartRequest) GetProductNum() (v int64) {
	return p.ProductNum
}
func (p *MallAddProductToCartRequest) SetUserId(val int64) {
	p.UserId = val
}
func (p *MallAddProductToCartRequest) SetProductId(val int64) {
	p.ProductId = val
}
func (p *MallAddProductToCartRequest) SetProductNum(val int64) {
	p.ProductNum = val
}

var fieldIDToName_MallAddProductToCartRequest = map[int16]string{
	1: "user_id",
	2: "product_id",
	3: "product_num",
}

func (p *MallAddProductToCartRequest) Read(iprot thrift.TProtocol) (err error) {

	var fieldTypeId thrift.TType
	var fieldId int16

	if _, err = iprot.ReadStructBegin(); err != nil {
		goto ReadStructBeginError
	}

	for {
		_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
		if err != nil {
			goto ReadFieldBeginError
		}
		if fieldTypeId == thrift.STOP {
			break
		}

		switch fieldId {
		case 1:
			if fieldTypeId == thrift.I64 {
				if err = p.ReadField1(iprot); err != nil {
					goto ReadFieldError
				}
			} else {
				if err = iprot.Skip(fieldTypeId); err != nil {
					goto SkipFieldError
				}
			}
		case 2:
			if fieldTypeId == thrift.I64 {
				if err = p.ReadField2(iprot); err != nil {
					goto ReadFieldError
				}
			} else {
				if err = iprot.Skip(fieldTypeId); err != nil {
					goto SkipFieldError
				}
			}
		case 3:
			if fieldTypeId == thrift.I64 {
				if err = p.ReadField3(iprot); err != nil {
					goto ReadFieldError
				}
			} else {
				if err = iprot.Skip(fieldTypeId); err != nil {
					goto SkipFieldError
				}
			}
		default:
			if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		}

		if err = iprot.ReadFieldEnd(); err != nil {
			goto ReadFieldEndError
		}
	}
	if err = iprot.ReadStructEnd(); err != nil {
		goto ReadStructEndError
	}

	return nil
ReadStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
ReadFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
ReadFieldError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_MallAddProductToCartRequest[fieldId]), err)
SkipFieldError:
	return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)

ReadFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
ReadStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}

func (p *MallAddProductToCartRequest) ReadField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI64(); err != nil {
		return err
	} else {
		p.UserId = v
	}
	return nil
}

func (p *MallAddProductToCartRequest) ReadField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI64(); err != nil {
		return err
	} else {
		p.ProductId = v
	}
	return nil
}

func (p *MallAddProductToCartRequest) ReadField3(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI64(); err != nil {
		return err
	} else {
		p.ProductNum = v
	}
	return nil
}

func (p *MallAddProductToCartRequest) Write(oprot thrift.TProtocol) (err error) {
	var fieldId int16
	if err = oprot.WriteStructBegin("mall_add_product_to_cart_request"); err != nil {
		goto WriteStructBeginError
	}
	if p != nil {
		if err = p.writeField1(oprot); err != nil {
			fieldId = 1
			goto WriteFieldError
		}
		if err = p.writeField2(oprot); err != nil {
			fieldId = 2
			goto WriteFieldError
		}
		if err = p.writeField3(oprot); err != nil {
			fieldId = 3
			goto WriteFieldError
		}

	}
	if err = oprot.WriteFieldStop(); err != nil {
		goto WriteFieldStopError
	}
	if err = oprot.WriteStructEnd(); err != nil {
		goto WriteStructEndError
	}
	return nil
WriteStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
WriteFieldError:
	return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
WriteFieldStopError:
	return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
WriteStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
}

func (p *MallAddProductToCartRequest) writeField1(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("user_id", thrift.I64, 1); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteI64(p.UserId); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
}

func (p *MallAddProductToCartRequest) writeField2(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("product_id", thrift.I64, 2); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteI64(p.ProductId); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err)
}

func (p *MallAddProductToCartRequest) writeField3(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("product_num", thrift.I64, 3); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteI64(p.ProductNum); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err)
}

func (p *MallAddProductToCartRequest) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("MallAddProductToCartRequest(%+v)", *p)
}

func (p *MallAddProductToCartRequest) DeepEqual(ano *MallAddProductToCartRequest) bool {
	if p == ano {
		return true
	} else if p == nil || ano == nil {
		return false
	}
	if !p.Field1DeepEqual(ano.UserId) {
		return false
	}
	if !p.Field2DeepEqual(ano.ProductId) {
		return false
	}
	if !p.Field3DeepEqual(ano.ProductNum) {
		return false
	}
	return true
}

func (p *MallAddProductToCartRequest) Field1DeepEqual(src int64) bool {

	if p.UserId != src {
		return false
	}
	return true
}
func (p *MallAddProductToCartRequest) Field2DeepEqual(src int64) bool {

	if p.ProductId != src {
		return false
	}
	return true
}
func (p *MallAddProductToCartRequest) Field3DeepEqual(src int64) bool {

	if p.ProductNum != src {
		return false
	}
	return true
}

type MallAddProductToCartResponse struct {
	CommonResp *common.CommonResponse `thrift:"common_resp,1" frugal:"1,default,common.CommonResponse" json:"common_resp"`
}

func NewMallAddProductToCartResponse() *MallAddProductToCartResponse {
	return &MallAddProductToCartResponse{}
}

func (p *MallAddProductToCartResponse) InitDefault() {
	*p = MallAddProductToCartResponse{}
}

var MallAddProductToCartResponse_CommonResp_DEFAULT *common.CommonResponse

func (p *MallAddProductToCartResponse) GetCommonResp() (v *common.CommonResponse) {
	if !p.IsSetCommonResp() {
		return MallAddProductToCartResponse_CommonResp_DEFAULT
	}
	return p.CommonResp
}
func (p *MallAddProductToCartResponse) SetCommonResp(val *common.CommonResponse) {
	p.CommonResp = val
}

var fieldIDToName_MallAddProductToCartResponse = map[int16]string{
	1: "common_resp",
}

func (p *MallAddProductToCartResponse) IsSetCommonResp() bool {
	return p.CommonResp != nil
}

func (p *MallAddProductToCartResponse) Read(iprot thrift.TProtocol) (err error) {

	var fieldTypeId thrift.TType
	var fieldId int16

	if _, err = iprot.ReadStructBegin(); err != nil {
		goto ReadStructBeginError
	}

	for {
		_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
		if err != nil {
			goto ReadFieldBeginError
		}
		if fieldTypeId == thrift.STOP {
			break
		}

		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRUCT {
				if err = p.ReadField1(iprot); err != nil {
					goto ReadFieldError
				}
			} else {
				if err = iprot.Skip(fieldTypeId); err != nil {
					goto SkipFieldError
				}
			}
		default:
			if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		}

		if err = iprot.ReadFieldEnd(); err != nil {
			goto ReadFieldEndError
		}
	}
	if err = iprot.ReadStructEnd(); err != nil {
		goto ReadStructEndError
	}

	return nil
ReadStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
ReadFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
ReadFieldError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_MallAddProductToCartResponse[fieldId]), err)
SkipFieldError:
	return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)

ReadFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
ReadStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}

func (p *MallAddProductToCartResponse) ReadField1(iprot thrift.TProtocol) error {
	p.CommonResp = common.NewCommonResponse()
	if err := p.CommonResp.Read(iprot); err != nil {
		return err
	}
	return nil
}

func (p *MallAddProductToCartResponse) Write(oprot thrift.TProtocol) (err error) {
	var fieldId int16
	if err = oprot.WriteStructBegin("mall_add_product_to_cart_response"); err != nil {
		goto WriteStructBeginError
	}
	if p != nil {
		if err = p.writeField1(oprot); err != nil {
			fieldId = 1
			goto WriteFieldError
		}

	}
	if err = oprot.WriteFieldStop(); err != nil {
		goto WriteFieldStopError
	}
	if err = oprot.WriteStructEnd(); err != nil {
		goto WriteStructEndError
	}
	return nil
WriteStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
WriteFieldError:
	return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
WriteFieldStopError:
	return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
WriteStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
}

func (p *MallAddProductToCartResponse) writeField1(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("common_resp", thrift.STRUCT, 1); err != nil {
		goto WriteFieldBeginError
	}
	if err := p.CommonResp.Write(oprot); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
}

func (p *MallAddProductToCartResponse) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("MallAddProductToCartResponse(%+v)", *p)
}

func (p *MallAddProductToCartResponse) DeepEqual(ano *MallAddProductToCartResponse) bool {
	if p == ano {
		return true
	} else if p == nil || ano == nil {
		return false
	}
	if !p.Field1DeepEqual(ano.CommonResp) {
		return false
	}
	return true
}

func (p *MallAddProductToCartResponse) Field1DeepEqual(src *common.CommonResponse) bool {

	if !p.CommonResp.DeepEqual(src) {
		return false
	}
	return true
}

type MallGetCartRequest struct {
	UserId int64 `thrift:"user_id,1" frugal:"1,default,i64" json:"user_id"`
}

func NewMallGetCartRequest() *MallGetCartRequest {
	return &MallGetCartRequest{}
}

func (p *MallGetCartRequest) InitDefault() {
	*p = MallGetCartRequest{}
}

func (p *MallGetCartRequest) GetUserId() (v int64) {
	return p.UserId
}
func (p *MallGetCartRequest) SetUserId(val int64) {
	p.UserId = val
}

var fieldIDToName_MallGetCartRequest = map[int16]string{
	1: "user_id",
}

func (p *MallGetCartRequest) Read(iprot thrift.TProtocol) (err error) {

	var fieldTypeId thrift.TType
	var fieldId int16

	if _, err = iprot.ReadStructBegin(); err != nil {
		goto ReadStructBeginError
	}

	for {
		_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
		if err != nil {
			goto ReadFieldBeginError
		}
		if fieldTypeId == thrift.STOP {
			break
		}

		switch fieldId {
		case 1:
			if fieldTypeId == thrift.I64 {
				if err = p.ReadField1(iprot); err != nil {
					goto ReadFieldError
				}
			} else {
				if err = iprot.Skip(fieldTypeId); err != nil {
					goto SkipFieldError
				}
			}
		default:
			if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		}

		if err = iprot.ReadFieldEnd(); err != nil {
			goto ReadFieldEndError
		}
	}
	if err = iprot.ReadStructEnd(); err != nil {
		goto ReadStructEndError
	}

	return nil
ReadStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
ReadFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
ReadFieldError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_MallGetCartRequest[fieldId]), err)
SkipFieldError:
	return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)

ReadFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
ReadStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}

func (p *MallGetCartRequest) ReadField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI64(); err != nil {
		return err
	} else {
		p.UserId = v
	}
	return nil
}

func (p *MallGetCartRequest) Write(oprot thrift.TProtocol) (err error) {
	var fieldId int16
	if err = oprot.WriteStructBegin("mall_get_cart_request"); err != nil {
		goto WriteStructBeginError
	}
	if p != nil {
		if err = p.writeField1(oprot); err != nil {
			fieldId = 1
			goto WriteFieldError
		}

	}
	if err = oprot.WriteFieldStop(); err != nil {
		goto WriteFieldStopError
	}
	if err = oprot.WriteStructEnd(); err != nil {
		goto WriteStructEndError
	}
	return nil
WriteStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
WriteFieldError:
	return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
WriteFieldStopError:
	return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
WriteStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
}

func (p *MallGetCartRequest) writeField1(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("user_id", thrift.I64, 1); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteI64(p.UserId); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
}

func (p *MallGetCartRequest) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("MallGetCartRequest(%+v)", *p)
}

func (p *MallGetCartRequest) DeepEqual(ano *MallGetCartRequest) bool {
	if p == ano {
		return true
	} else if p == nil || ano == nil {
		return false
	}
	if !p.Field1DeepEqual(ano.UserId) {
		return false
	}
	return true
}

func (p *MallGetCartRequest) Field1DeepEqual(src int64) bool {

	if p.UserId != src {
		return false
	}
	return true
}

type MallGetCartResponse struct {
	CommonResp *common.CommonResponse `thrift:"common_resp,1" frugal:"1,default,common.CommonResponse" json:"common_resp"`
	Cart       *common.Cart           `thrift:"cart,2" frugal:"2,default,common.Cart" json:"cart"`
}

func NewMallGetCartResponse() *MallGetCartResponse {
	return &MallGetCartResponse{}
}

func (p *MallGetCartResponse) InitDefault() {
	*p = MallGetCartResponse{}
}

var MallGetCartResponse_CommonResp_DEFAULT *common.CommonResponse

func (p *MallGetCartResponse) GetCommonResp() (v *common.CommonResponse) {
	if !p.IsSetCommonResp() {
		return MallGetCartResponse_CommonResp_DEFAULT
	}
	return p.CommonResp
}

var MallGetCartResponse_Cart_DEFAULT *common.Cart

func (p *MallGetCartResponse) GetCart() (v *common.Cart) {
	if !p.IsSetCart() {
		return MallGetCartResponse_Cart_DEFAULT
	}
	return p.Cart
}
func (p *MallGetCartResponse) SetCommonResp(val *common.CommonResponse) {
	p.CommonResp = val
}
func (p *MallGetCartResponse) SetCart(val *common.Cart) {
	p.Cart = val
}

var fieldIDToName_MallGetCartResponse = map[int16]string{
	1: "common_resp",
	2: "cart",
}

func (p *MallGetCartResponse) IsSetCommonResp() bool {
	return p.CommonResp != nil
}

func (p *MallGetCartResponse) IsSetCart() bool {
	return p.Cart != nil
}

func (p *MallGetCartResponse) Read(iprot thrift.TProtocol) (err error) {

	var fieldTypeId thrift.TType
	var fieldId int16

	if _, err = iprot.ReadStructBegin(); err != nil {
		goto ReadStructBeginError
	}

	for {
		_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
		if err != nil {
			goto ReadFieldBeginError
		}
		if fieldTypeId == thrift.STOP {
			break
		}

		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRUCT {
				if err = p.ReadField1(iprot); err != nil {
					goto ReadFieldError
				}
			} else {
				if err = iprot.Skip(fieldTypeId); err != nil {
					goto SkipFieldError
				}
			}
		case 2:
			if fieldTypeId == thrift.STRUCT {
				if err = p.ReadField2(iprot); err != nil {
					goto ReadFieldError
				}
			} else {
				if err = iprot.Skip(fieldTypeId); err != nil {
					goto SkipFieldError
				}
			}
		default:
			if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		}

		if err = iprot.ReadFieldEnd(); err != nil {
			goto ReadFieldEndError
		}
	}
	if err = iprot.ReadStructEnd(); err != nil {
		goto ReadStructEndError
	}

	return nil
ReadStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
ReadFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
ReadFieldError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_MallGetCartResponse[fieldId]), err)
SkipFieldError:
	return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)

ReadFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
ReadStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}

func (p *MallGetCartResponse) ReadField1(iprot thrift.TProtocol) error {
	p.CommonResp = common.NewCommonResponse()
	if err := p.CommonResp.Read(iprot); err != nil {
		return err
	}
	return nil
}

func (p *MallGetCartResponse) ReadField2(iprot thrift.TProtocol) error {
	p.Cart = common.NewCart()
	if err := p.Cart.Read(iprot); err != nil {
		return err
	}
	return nil
}

func (p *MallGetCartResponse) Write(oprot thrift.TProtocol) (err error) {
	var fieldId int16
	if err = oprot.WriteStructBegin("mall_get_cart_response"); err != nil {
		goto WriteStructBeginError
	}
	if p != nil {
		if err = p.writeField1(oprot); err != nil {
			fieldId = 1
			goto WriteFieldError
		}
		if err = p.writeField2(oprot); err != nil {
			fieldId = 2
			goto WriteFieldError
		}

	}
	if err = oprot.WriteFieldStop(); err != nil {
		goto WriteFieldStopError
	}
	if err = oprot.WriteStructEnd(); err != nil {
		goto WriteStructEndError
	}
	return nil
WriteStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
WriteFieldError:
	return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
WriteFieldStopError:
	return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
WriteStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
}

func (p *MallGetCartResponse) writeField1(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("common_resp", thrift.STRUCT, 1); err != nil {
		goto WriteFieldBeginError
	}
	if err := p.CommonResp.Write(oprot); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
}

func (p *MallGetCartResponse) writeField2(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("cart", thrift.STRUCT, 2); err != nil {
		goto WriteFieldBeginError
	}
	if err := p.Cart.Write(oprot); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err)
}

func (p *MallGetCartResponse) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("MallGetCartResponse(%+v)", *p)
}

func (p *MallGetCartResponse) DeepEqual(ano *MallGetCartResponse) bool {
	if p == ano {
		return true
	} else if p == nil || ano == nil {
		return false
	}
	if !p.Field1DeepEqual(ano.CommonResp) {
		return false
	}
	if !p.Field2DeepEqual(ano.Cart) {
		return false
	}
	return true
}

func (p *MallGetCartResponse) Field1DeepEqual(src *common.CommonResponse) bool {

	if !p.CommonResp.DeepEqual(src) {
		return false
	}
	return true
}
func (p *MallGetCartResponse) Field2DeepEqual(src *common.Cart) bool {

	if !p.Cart.DeepEqual(src) {
		return false
	}
	return true
}

type MallDelCartProductRequest struct {
	UserId    int64 `thrift:"user_id,1" frugal:"1,default,i64" json:"user_id"`
	ProductId int64 `thrift:"product_id,2" frugal:"2,default,i64" json:"product_id"`
}

func NewMallDelCartProductRequest() *MallDelCartProductRequest {
	return &MallDelCartProductRequest{}
}

func (p *MallDelCartProductRequest) InitDefault() {
	*p = MallDelCartProductRequest{}
}

func (p *MallDelCartProductRequest) GetUserId() (v int64) {
	return p.UserId
}

func (p *MallDelCartProductRequest) GetProductId() (v int64) {
	return p.ProductId
}
func (p *MallDelCartProductRequest) SetUserId(val int64) {
	p.UserId = val
}
func (p *MallDelCartProductRequest) SetProductId(val int64) {
	p.ProductId = val
}

var fieldIDToName_MallDelCartProductRequest = map[int16]string{
	1: "user_id",
	2: "product_id",
}

func (p *MallDelCartProductRequest) Read(iprot thrift.TProtocol) (err error) {

	var fieldTypeId thrift.TType
	var fieldId int16

	if _, err = iprot.ReadStructBegin(); err != nil {
		goto ReadStructBeginError
	}

	for {
		_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
		if err != nil {
			goto ReadFieldBeginError
		}
		if fieldTypeId == thrift.STOP {
			break
		}

		switch fieldId {
		case 1:
			if fieldTypeId == thrift.I64 {
				if err = p.ReadField1(iprot); err != nil {
					goto ReadFieldError
				}
			} else {
				if err = iprot.Skip(fieldTypeId); err != nil {
					goto SkipFieldError
				}
			}
		case 2:
			if fieldTypeId == thrift.I64 {
				if err = p.ReadField2(iprot); err != nil {
					goto ReadFieldError
				}
			} else {
				if err = iprot.Skip(fieldTypeId); err != nil {
					goto SkipFieldError
				}
			}
		default:
			if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		}

		if err = iprot.ReadFieldEnd(); err != nil {
			goto ReadFieldEndError
		}
	}
	if err = iprot.ReadStructEnd(); err != nil {
		goto ReadStructEndError
	}

	return nil
ReadStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
ReadFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
ReadFieldError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_MallDelCartProductRequest[fieldId]), err)
SkipFieldError:
	return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)

ReadFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
ReadStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}

func (p *MallDelCartProductRequest) ReadField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI64(); err != nil {
		return err
	} else {
		p.UserId = v
	}
	return nil
}

func (p *MallDelCartProductRequest) ReadField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI64(); err != nil {
		return err
	} else {
		p.ProductId = v
	}
	return nil
}

func (p *MallDelCartProductRequest) Write(oprot thrift.TProtocol) (err error) {
	var fieldId int16
	if err = oprot.WriteStructBegin("mall_del_cart_product_request"); err != nil {
		goto WriteStructBeginError
	}
	if p != nil {
		if err = p.writeField1(oprot); err != nil {
			fieldId = 1
			goto WriteFieldError
		}
		if err = p.writeField2(oprot); err != nil {
			fieldId = 2
			goto WriteFieldError
		}

	}
	if err = oprot.WriteFieldStop(); err != nil {
		goto WriteFieldStopError
	}
	if err = oprot.WriteStructEnd(); err != nil {
		goto WriteStructEndError
	}
	return nil
WriteStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
WriteFieldError:
	return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
WriteFieldStopError:
	return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
WriteStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
}

func (p *MallDelCartProductRequest) writeField1(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("user_id", thrift.I64, 1); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteI64(p.UserId); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
}

func (p *MallDelCartProductRequest) writeField2(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("product_id", thrift.I64, 2); err != nil {
		goto WriteFieldBeginError
	}
	if err := oprot.WriteI64(p.ProductId); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err)
}

func (p *MallDelCartProductRequest) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("MallDelCartProductRequest(%+v)", *p)
}

func (p *MallDelCartProductRequest) DeepEqual(ano *MallDelCartProductRequest) bool {
	if p == ano {
		return true
	} else if p == nil || ano == nil {
		return false
	}
	if !p.Field1DeepEqual(ano.UserId) {
		return false
	}
	if !p.Field2DeepEqual(ano.ProductId) {
		return false
	}
	return true
}

func (p *MallDelCartProductRequest) Field1DeepEqual(src int64) bool {

	if p.UserId != src {
		return false
	}
	return true
}
func (p *MallDelCartProductRequest) Field2DeepEqual(src int64) bool {

	if p.ProductId != src {
		return false
	}
	return true
}

type MallDelCartProductResponse struct {
	CommonResp *common.CommonResponse `thrift:"common_resp,1" frugal:"1,default,common.CommonResponse" json:"common_resp"`
}

func NewMallDelCartProductResponse() *MallDelCartProductResponse {
	return &MallDelCartProductResponse{}
}

func (p *MallDelCartProductResponse) InitDefault() {
	*p = MallDelCartProductResponse{}
}

var MallDelCartProductResponse_CommonResp_DEFAULT *common.CommonResponse

func (p *MallDelCartProductResponse) GetCommonResp() (v *common.CommonResponse) {
	if !p.IsSetCommonResp() {
		return MallDelCartProductResponse_CommonResp_DEFAULT
	}
	return p.CommonResp
}
func (p *MallDelCartProductResponse) SetCommonResp(val *common.CommonResponse) {
	p.CommonResp = val
}

var fieldIDToName_MallDelCartProductResponse = map[int16]string{
	1: "common_resp",
}

func (p *MallDelCartProductResponse) IsSetCommonResp() bool {
	return p.CommonResp != nil
}

func (p *MallDelCartProductResponse) Read(iprot thrift.TProtocol) (err error) {

	var fieldTypeId thrift.TType
	var fieldId int16

	if _, err = iprot.ReadStructBegin(); err != nil {
		goto ReadStructBeginError
	}

	for {
		_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
		if err != nil {
			goto ReadFieldBeginError
		}
		if fieldTypeId == thrift.STOP {
			break
		}

		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRUCT {
				if err = p.ReadField1(iprot); err != nil {
					goto ReadFieldError
				}
			} else {
				if err = iprot.Skip(fieldTypeId); err != nil {
					goto SkipFieldError
				}
			}
		default:
			if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		}

		if err = iprot.ReadFieldEnd(); err != nil {
			goto ReadFieldEndError
		}
	}
	if err = iprot.ReadStructEnd(); err != nil {
		goto ReadStructEndError
	}

	return nil
ReadStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
ReadFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
ReadFieldError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_MallDelCartProductResponse[fieldId]), err)
SkipFieldError:
	return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)

ReadFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
ReadStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}

func (p *MallDelCartProductResponse) ReadField1(iprot thrift.TProtocol) error {
	p.CommonResp = common.NewCommonResponse()
	if err := p.CommonResp.Read(iprot); err != nil {
		return err
	}
	return nil
}

func (p *MallDelCartProductResponse) Write(oprot thrift.TProtocol) (err error) {
	var fieldId int16
	if err = oprot.WriteStructBegin("mall_del_cart_product_response"); err != nil {
		goto WriteStructBeginError
	}
	if p != nil {
		if err = p.writeField1(oprot); err != nil {
			fieldId = 1
			goto WriteFieldError
		}

	}
	if err = oprot.WriteFieldStop(); err != nil {
		goto WriteFieldStopError
	}
	if err = oprot.WriteStructEnd(); err != nil {
		goto WriteStructEndError
	}
	return nil
WriteStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
WriteFieldError:
	return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
WriteFieldStopError:
	return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
WriteStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
}

func (p *MallDelCartProductResponse) writeField1(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("common_resp", thrift.STRUCT, 1); err != nil {
		goto WriteFieldBeginError
	}
	if err := p.CommonResp.Write(oprot); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
}

func (p *MallDelCartProductResponse) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("MallDelCartProductResponse(%+v)", *p)
}

func (p *MallDelCartProductResponse) DeepEqual(ano *MallDelCartProductResponse) bool {
	if p == ano {
		return true
	} else if p == nil || ano == nil {
		return false
	}
	if !p.Field1DeepEqual(ano.CommonResp) {
		return false
	}
	return true
}

func (p *MallDelCartProductResponse) Field1DeepEqual(src *common.CommonResponse) bool {

	if !p.CommonResp.DeepEqual(src) {
		return false
	}
	return true
}

type CartService interface {
	AddProductToCart(ctx context.Context, req *MallAddProductToCartRequest) (r *MallAddProductToCartResponse, err error)

	GetCart(ctx context.Context, req *MallGetCartRequest) (r *MallGetCartResponse, err error)

	DelCartProduct(ctx context.Context, req *MallDelCartProductRequest) (r *MallDelCartProductResponse, err error)
}

type CartServiceClient struct {
	c thrift.TClient
}

func NewCartServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *CartServiceClient {
	return &CartServiceClient{
		c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)),
	}
}

func NewCartServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *CartServiceClient {
	return &CartServiceClient{
		c: thrift.NewTStandardClient(iprot, oprot),
	}
}

func NewCartServiceClient(c thrift.TClient) *CartServiceClient {
	return &CartServiceClient{
		c: c,
	}
}

func (p *CartServiceClient) Client_() thrift.TClient {
	return p.c
}

func (p *CartServiceClient) AddProductToCart(ctx context.Context, req *MallAddProductToCartRequest) (r *MallAddProductToCartResponse, err error) {
	var _args CartServiceAddProductToCartArgs
	_args.Req = req
	var _result CartServiceAddProductToCartResult
	if err = p.Client_().Call(ctx, "AddProductToCart", &_args, &_result); err != nil {
		return
	}
	return _result.GetSuccess(), nil
}
func (p *CartServiceClient) GetCart(ctx context.Context, req *MallGetCartRequest) (r *MallGetCartResponse, err error) {
	var _args CartServiceGetCartArgs
	_args.Req = req
	var _result CartServiceGetCartResult
	if err = p.Client_().Call(ctx, "GetCart", &_args, &_result); err != nil {
		return
	}
	return _result.GetSuccess(), nil
}
func (p *CartServiceClient) DelCartProduct(ctx context.Context, req *MallDelCartProductRequest) (r *MallDelCartProductResponse, err error) {
	var _args CartServiceDelCartProductArgs
	_args.Req = req
	var _result CartServiceDelCartProductResult
	if err = p.Client_().Call(ctx, "DelCartProduct", &_args, &_result); err != nil {
		return
	}
	return _result.GetSuccess(), nil
}

type CartServiceProcessor struct {
	processorMap map[string]thrift.TProcessorFunction
	handler      CartService
}

func (p *CartServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
	p.processorMap[key] = processor
}

func (p *CartServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
	processor, ok = p.processorMap[key]
	return processor, ok
}

func (p *CartServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
	return p.processorMap
}

func NewCartServiceProcessor(handler CartService) *CartServiceProcessor {
	self := &CartServiceProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)}
	self.AddToProcessorMap("AddProductToCart", &cartServiceProcessorAddProductToCart{handler: handler})
	self.AddToProcessorMap("GetCart", &cartServiceProcessorGetCart{handler: handler})
	self.AddToProcessorMap("DelCartProduct", &cartServiceProcessorDelCartProduct{handler: handler})
	return self
}
func (p *CartServiceProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
	name, _, seqId, err := iprot.ReadMessageBegin()
	if err != nil {
		return false, err
	}
	if processor, ok := p.GetProcessorFunction(name); ok {
		return processor.Process(ctx, seqId, iprot, oprot)
	}
	iprot.Skip(thrift.STRUCT)
	iprot.ReadMessageEnd()
	x := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name)
	oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId)
	x.Write(oprot)
	oprot.WriteMessageEnd()
	oprot.Flush(ctx)
	return false, x
}

type cartServiceProcessorAddProductToCart struct {
	handler CartService
}

func (p *cartServiceProcessorAddProductToCart) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
	args := CartServiceAddProductToCartArgs{}
	if err = args.Read(iprot); err != nil {
		iprot.ReadMessageEnd()
		x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
		oprot.WriteMessageBegin("AddProductToCart", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return false, err
	}

	iprot.ReadMessageEnd()
	var err2 error
	result := CartServiceAddProductToCartResult{}
	var retval *MallAddProductToCartResponse
	if retval, err2 = p.handler.AddProductToCart(ctx, args.Req); err2 != nil {
		x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing AddProductToCart: "+err2.Error())
		oprot.WriteMessageBegin("AddProductToCart", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return true, err2
	} else {
		result.Success = retval
	}
	if err2 = oprot.WriteMessageBegin("AddProductToCart", thrift.REPLY, 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(ctx); err == nil && err2 != nil {
		err = err2
	}
	if err != nil {
		return
	}
	return true, err
}

type cartServiceProcessorGetCart struct {
	handler CartService
}

func (p *cartServiceProcessorGetCart) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
	args := CartServiceGetCartArgs{}
	if err = args.Read(iprot); err != nil {
		iprot.ReadMessageEnd()
		x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
		oprot.WriteMessageBegin("GetCart", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return false, err
	}

	iprot.ReadMessageEnd()
	var err2 error
	result := CartServiceGetCartResult{}
	var retval *MallGetCartResponse
	if retval, err2 = p.handler.GetCart(ctx, args.Req); err2 != nil {
		x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetCart: "+err2.Error())
		oprot.WriteMessageBegin("GetCart", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return true, err2
	} else {
		result.Success = retval
	}
	if err2 = oprot.WriteMessageBegin("GetCart", thrift.REPLY, 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(ctx); err == nil && err2 != nil {
		err = err2
	}
	if err != nil {
		return
	}
	return true, err
}

type cartServiceProcessorDelCartProduct struct {
	handler CartService
}

func (p *cartServiceProcessorDelCartProduct) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
	args := CartServiceDelCartProductArgs{}
	if err = args.Read(iprot); err != nil {
		iprot.ReadMessageEnd()
		x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
		oprot.WriteMessageBegin("DelCartProduct", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return false, err
	}

	iprot.ReadMessageEnd()
	var err2 error
	result := CartServiceDelCartProductResult{}
	var retval *MallDelCartProductResponse
	if retval, err2 = p.handler.DelCartProduct(ctx, args.Req); err2 != nil {
		x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing DelCartProduct: "+err2.Error())
		oprot.WriteMessageBegin("DelCartProduct", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return true, err2
	} else {
		result.Success = retval
	}
	if err2 = oprot.WriteMessageBegin("DelCartProduct", thrift.REPLY, 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(ctx); err == nil && err2 != nil {
		err = err2
	}
	if err != nil {
		return
	}
	return true, err
}

type CartServiceAddProductToCartArgs struct {
	Req *MallAddProductToCartRequest `thrift:"req,1" frugal:"1,default,MallAddProductToCartRequest" json:"req"`
}

func NewCartServiceAddProductToCartArgs() *CartServiceAddProductToCartArgs {
	return &CartServiceAddProductToCartArgs{}
}

func (p *CartServiceAddProductToCartArgs) InitDefault() {
	*p = CartServiceAddProductToCartArgs{}
}

var CartServiceAddProductToCartArgs_Req_DEFAULT *MallAddProductToCartRequest

func (p *CartServiceAddProductToCartArgs) GetReq() (v *MallAddProductToCartRequest) {
	if !p.IsSetReq() {
		return CartServiceAddProductToCartArgs_Req_DEFAULT
	}
	return p.Req
}
func (p *CartServiceAddProductToCartArgs) SetReq(val *MallAddProductToCartRequest) {
	p.Req = val
}

var fieldIDToName_CartServiceAddProductToCartArgs = map[int16]string{
	1: "req",
}

func (p *CartServiceAddProductToCartArgs) IsSetReq() bool {
	return p.Req != nil
}

func (p *CartServiceAddProductToCartArgs) Read(iprot thrift.TProtocol) (err error) {

	var fieldTypeId thrift.TType
	var fieldId int16

	if _, err = iprot.ReadStructBegin(); err != nil {
		goto ReadStructBeginError
	}

	for {
		_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
		if err != nil {
			goto ReadFieldBeginError
		}
		if fieldTypeId == thrift.STOP {
			break
		}

		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRUCT {
				if err = p.ReadField1(iprot); err != nil {
					goto ReadFieldError
				}
			} else {
				if err = iprot.Skip(fieldTypeId); err != nil {
					goto SkipFieldError
				}
			}
		default:
			if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		}

		if err = iprot.ReadFieldEnd(); err != nil {
			goto ReadFieldEndError
		}
	}
	if err = iprot.ReadStructEnd(); err != nil {
		goto ReadStructEndError
	}

	return nil
ReadStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
ReadFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
ReadFieldError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CartServiceAddProductToCartArgs[fieldId]), err)
SkipFieldError:
	return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)

ReadFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
ReadStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}

func (p *CartServiceAddProductToCartArgs) ReadField1(iprot thrift.TProtocol) error {
	p.Req = NewMallAddProductToCartRequest()
	if err := p.Req.Read(iprot); err != nil {
		return err
	}
	return nil
}

func (p *CartServiceAddProductToCartArgs) Write(oprot thrift.TProtocol) (err error) {
	var fieldId int16
	if err = oprot.WriteStructBegin("AddProductToCart_args"); err != nil {
		goto WriteStructBeginError
	}
	if p != nil {
		if err = p.writeField1(oprot); err != nil {
			fieldId = 1
			goto WriteFieldError
		}

	}
	if err = oprot.WriteFieldStop(); err != nil {
		goto WriteFieldStopError
	}
	if err = oprot.WriteStructEnd(); err != nil {
		goto WriteStructEndError
	}
	return nil
WriteStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
WriteFieldError:
	return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
WriteFieldStopError:
	return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
WriteStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
}

func (p *CartServiceAddProductToCartArgs) writeField1(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil {
		goto WriteFieldBeginError
	}
	if err := p.Req.Write(oprot); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
}

func (p *CartServiceAddProductToCartArgs) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("CartServiceAddProductToCartArgs(%+v)", *p)
}

func (p *CartServiceAddProductToCartArgs) DeepEqual(ano *CartServiceAddProductToCartArgs) bool {
	if p == ano {
		return true
	} else if p == nil || ano == nil {
		return false
	}
	if !p.Field1DeepEqual(ano.Req) {
		return false
	}
	return true
}

func (p *CartServiceAddProductToCartArgs) Field1DeepEqual(src *MallAddProductToCartRequest) bool {

	if !p.Req.DeepEqual(src) {
		return false
	}
	return true
}

type CartServiceAddProductToCartResult struct {
	Success *MallAddProductToCartResponse `thrift:"success,0,optional" frugal:"0,optional,MallAddProductToCartResponse" json:"success,omitempty"`
}

func NewCartServiceAddProductToCartResult() *CartServiceAddProductToCartResult {
	return &CartServiceAddProductToCartResult{}
}

func (p *CartServiceAddProductToCartResult) InitDefault() {
	*p = CartServiceAddProductToCartResult{}
}

var CartServiceAddProductToCartResult_Success_DEFAULT *MallAddProductToCartResponse

func (p *CartServiceAddProductToCartResult) GetSuccess() (v *MallAddProductToCartResponse) {
	if !p.IsSetSuccess() {
		return CartServiceAddProductToCartResult_Success_DEFAULT
	}
	return p.Success
}
func (p *CartServiceAddProductToCartResult) SetSuccess(x interface{}) {
	p.Success = x.(*MallAddProductToCartResponse)
}

var fieldIDToName_CartServiceAddProductToCartResult = map[int16]string{
	0: "success",
}

func (p *CartServiceAddProductToCartResult) IsSetSuccess() bool {
	return p.Success != nil
}

func (p *CartServiceAddProductToCartResult) Read(iprot thrift.TProtocol) (err error) {

	var fieldTypeId thrift.TType
	var fieldId int16

	if _, err = iprot.ReadStructBegin(); err != nil {
		goto ReadStructBeginError
	}

	for {
		_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
		if err != nil {
			goto ReadFieldBeginError
		}
		if fieldTypeId == thrift.STOP {
			break
		}

		switch fieldId {
		case 0:
			if fieldTypeId == thrift.STRUCT {
				if err = p.ReadField0(iprot); err != nil {
					goto ReadFieldError
				}
			} else {
				if err = iprot.Skip(fieldTypeId); err != nil {
					goto SkipFieldError
				}
			}
		default:
			if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		}

		if err = iprot.ReadFieldEnd(); err != nil {
			goto ReadFieldEndError
		}
	}
	if err = iprot.ReadStructEnd(); err != nil {
		goto ReadStructEndError
	}

	return nil
ReadStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
ReadFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
ReadFieldError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CartServiceAddProductToCartResult[fieldId]), err)
SkipFieldError:
	return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)

ReadFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
ReadStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}

func (p *CartServiceAddProductToCartResult) ReadField0(iprot thrift.TProtocol) error {
	p.Success = NewMallAddProductToCartResponse()
	if err := p.Success.Read(iprot); err != nil {
		return err
	}
	return nil
}

func (p *CartServiceAddProductToCartResult) Write(oprot thrift.TProtocol) (err error) {
	var fieldId int16
	if err = oprot.WriteStructBegin("AddProductToCart_result"); err != nil {
		goto WriteStructBeginError
	}
	if p != nil {
		if err = p.writeField0(oprot); err != nil {
			fieldId = 0
			goto WriteFieldError
		}

	}
	if err = oprot.WriteFieldStop(); err != nil {
		goto WriteFieldStopError
	}
	if err = oprot.WriteStructEnd(); err != nil {
		goto WriteStructEndError
	}
	return nil
WriteStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
WriteFieldError:
	return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
WriteFieldStopError:
	return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
WriteStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
}

func (p *CartServiceAddProductToCartResult) writeField0(oprot thrift.TProtocol) (err error) {
	if p.IsSetSuccess() {
		if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
			goto WriteFieldBeginError
		}
		if err := p.Success.Write(oprot); err != nil {
			return err
		}
		if err = oprot.WriteFieldEnd(); err != nil {
			goto WriteFieldEndError
		}
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err)
}

func (p *CartServiceAddProductToCartResult) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("CartServiceAddProductToCartResult(%+v)", *p)
}

func (p *CartServiceAddProductToCartResult) DeepEqual(ano *CartServiceAddProductToCartResult) bool {
	if p == ano {
		return true
	} else if p == nil || ano == nil {
		return false
	}
	if !p.Field0DeepEqual(ano.Success) {
		return false
	}
	return true
}

func (p *CartServiceAddProductToCartResult) Field0DeepEqual(src *MallAddProductToCartResponse) bool {

	if !p.Success.DeepEqual(src) {
		return false
	}
	return true
}

type CartServiceGetCartArgs struct {
	Req *MallGetCartRequest `thrift:"req,1" frugal:"1,default,MallGetCartRequest" json:"req"`
}

func NewCartServiceGetCartArgs() *CartServiceGetCartArgs {
	return &CartServiceGetCartArgs{}
}

func (p *CartServiceGetCartArgs) InitDefault() {
	*p = CartServiceGetCartArgs{}
}

var CartServiceGetCartArgs_Req_DEFAULT *MallGetCartRequest

func (p *CartServiceGetCartArgs) GetReq() (v *MallGetCartRequest) {
	if !p.IsSetReq() {
		return CartServiceGetCartArgs_Req_DEFAULT
	}
	return p.Req
}
func (p *CartServiceGetCartArgs) SetReq(val *MallGetCartRequest) {
	p.Req = val
}

var fieldIDToName_CartServiceGetCartArgs = map[int16]string{
	1: "req",
}

func (p *CartServiceGetCartArgs) IsSetReq() bool {
	return p.Req != nil
}

func (p *CartServiceGetCartArgs) Read(iprot thrift.TProtocol) (err error) {

	var fieldTypeId thrift.TType
	var fieldId int16

	if _, err = iprot.ReadStructBegin(); err != nil {
		goto ReadStructBeginError
	}

	for {
		_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
		if err != nil {
			goto ReadFieldBeginError
		}
		if fieldTypeId == thrift.STOP {
			break
		}

		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRUCT {
				if err = p.ReadField1(iprot); err != nil {
					goto ReadFieldError
				}
			} else {
				if err = iprot.Skip(fieldTypeId); err != nil {
					goto SkipFieldError
				}
			}
		default:
			if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		}

		if err = iprot.ReadFieldEnd(); err != nil {
			goto ReadFieldEndError
		}
	}
	if err = iprot.ReadStructEnd(); err != nil {
		goto ReadStructEndError
	}

	return nil
ReadStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
ReadFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
ReadFieldError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CartServiceGetCartArgs[fieldId]), err)
SkipFieldError:
	return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)

ReadFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
ReadStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}

func (p *CartServiceGetCartArgs) ReadField1(iprot thrift.TProtocol) error {
	p.Req = NewMallGetCartRequest()
	if err := p.Req.Read(iprot); err != nil {
		return err
	}
	return nil
}

func (p *CartServiceGetCartArgs) Write(oprot thrift.TProtocol) (err error) {
	var fieldId int16
	if err = oprot.WriteStructBegin("GetCart_args"); err != nil {
		goto WriteStructBeginError
	}
	if p != nil {
		if err = p.writeField1(oprot); err != nil {
			fieldId = 1
			goto WriteFieldError
		}

	}
	if err = oprot.WriteFieldStop(); err != nil {
		goto WriteFieldStopError
	}
	if err = oprot.WriteStructEnd(); err != nil {
		goto WriteStructEndError
	}
	return nil
WriteStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
WriteFieldError:
	return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
WriteFieldStopError:
	return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
WriteStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
}

func (p *CartServiceGetCartArgs) writeField1(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil {
		goto WriteFieldBeginError
	}
	if err := p.Req.Write(oprot); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
}

func (p *CartServiceGetCartArgs) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("CartServiceGetCartArgs(%+v)", *p)
}

func (p *CartServiceGetCartArgs) DeepEqual(ano *CartServiceGetCartArgs) bool {
	if p == ano {
		return true
	} else if p == nil || ano == nil {
		return false
	}
	if !p.Field1DeepEqual(ano.Req) {
		return false
	}
	return true
}

func (p *CartServiceGetCartArgs) Field1DeepEqual(src *MallGetCartRequest) bool {

	if !p.Req.DeepEqual(src) {
		return false
	}
	return true
}

type CartServiceGetCartResult struct {
	Success *MallGetCartResponse `thrift:"success,0,optional" frugal:"0,optional,MallGetCartResponse" json:"success,omitempty"`
}

func NewCartServiceGetCartResult() *CartServiceGetCartResult {
	return &CartServiceGetCartResult{}
}

func (p *CartServiceGetCartResult) InitDefault() {
	*p = CartServiceGetCartResult{}
}

var CartServiceGetCartResult_Success_DEFAULT *MallGetCartResponse

func (p *CartServiceGetCartResult) GetSuccess() (v *MallGetCartResponse) {
	if !p.IsSetSuccess() {
		return CartServiceGetCartResult_Success_DEFAULT
	}
	return p.Success
}
func (p *CartServiceGetCartResult) SetSuccess(x interface{}) {
	p.Success = x.(*MallGetCartResponse)
}

var fieldIDToName_CartServiceGetCartResult = map[int16]string{
	0: "success",
}

func (p *CartServiceGetCartResult) IsSetSuccess() bool {
	return p.Success != nil
}

func (p *CartServiceGetCartResult) Read(iprot thrift.TProtocol) (err error) {

	var fieldTypeId thrift.TType
	var fieldId int16

	if _, err = iprot.ReadStructBegin(); err != nil {
		goto ReadStructBeginError
	}

	for {
		_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
		if err != nil {
			goto ReadFieldBeginError
		}
		if fieldTypeId == thrift.STOP {
			break
		}

		switch fieldId {
		case 0:
			if fieldTypeId == thrift.STRUCT {
				if err = p.ReadField0(iprot); err != nil {
					goto ReadFieldError
				}
			} else {
				if err = iprot.Skip(fieldTypeId); err != nil {
					goto SkipFieldError
				}
			}
		default:
			if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		}

		if err = iprot.ReadFieldEnd(); err != nil {
			goto ReadFieldEndError
		}
	}
	if err = iprot.ReadStructEnd(); err != nil {
		goto ReadStructEndError
	}

	return nil
ReadStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
ReadFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
ReadFieldError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CartServiceGetCartResult[fieldId]), err)
SkipFieldError:
	return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)

ReadFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
ReadStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}

func (p *CartServiceGetCartResult) ReadField0(iprot thrift.TProtocol) error {
	p.Success = NewMallGetCartResponse()
	if err := p.Success.Read(iprot); err != nil {
		return err
	}
	return nil
}

func (p *CartServiceGetCartResult) Write(oprot thrift.TProtocol) (err error) {
	var fieldId int16
	if err = oprot.WriteStructBegin("GetCart_result"); err != nil {
		goto WriteStructBeginError
	}
	if p != nil {
		if err = p.writeField0(oprot); err != nil {
			fieldId = 0
			goto WriteFieldError
		}

	}
	if err = oprot.WriteFieldStop(); err != nil {
		goto WriteFieldStopError
	}
	if err = oprot.WriteStructEnd(); err != nil {
		goto WriteStructEndError
	}
	return nil
WriteStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
WriteFieldError:
	return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
WriteFieldStopError:
	return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
WriteStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
}

func (p *CartServiceGetCartResult) writeField0(oprot thrift.TProtocol) (err error) {
	if p.IsSetSuccess() {
		if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
			goto WriteFieldBeginError
		}
		if err := p.Success.Write(oprot); err != nil {
			return err
		}
		if err = oprot.WriteFieldEnd(); err != nil {
			goto WriteFieldEndError
		}
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err)
}

func (p *CartServiceGetCartResult) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("CartServiceGetCartResult(%+v)", *p)
}

func (p *CartServiceGetCartResult) DeepEqual(ano *CartServiceGetCartResult) bool {
	if p == ano {
		return true
	} else if p == nil || ano == nil {
		return false
	}
	if !p.Field0DeepEqual(ano.Success) {
		return false
	}
	return true
}

func (p *CartServiceGetCartResult) Field0DeepEqual(src *MallGetCartResponse) bool {

	if !p.Success.DeepEqual(src) {
		return false
	}
	return true
}

type CartServiceDelCartProductArgs struct {
	Req *MallDelCartProductRequest `thrift:"req,1" frugal:"1,default,MallDelCartProductRequest" json:"req"`
}

func NewCartServiceDelCartProductArgs() *CartServiceDelCartProductArgs {
	return &CartServiceDelCartProductArgs{}
}

func (p *CartServiceDelCartProductArgs) InitDefault() {
	*p = CartServiceDelCartProductArgs{}
}

var CartServiceDelCartProductArgs_Req_DEFAULT *MallDelCartProductRequest

func (p *CartServiceDelCartProductArgs) GetReq() (v *MallDelCartProductRequest) {
	if !p.IsSetReq() {
		return CartServiceDelCartProductArgs_Req_DEFAULT
	}
	return p.Req
}
func (p *CartServiceDelCartProductArgs) SetReq(val *MallDelCartProductRequest) {
	p.Req = val
}

var fieldIDToName_CartServiceDelCartProductArgs = map[int16]string{
	1: "req",
}

func (p *CartServiceDelCartProductArgs) IsSetReq() bool {
	return p.Req != nil
}

func (p *CartServiceDelCartProductArgs) Read(iprot thrift.TProtocol) (err error) {

	var fieldTypeId thrift.TType
	var fieldId int16

	if _, err = iprot.ReadStructBegin(); err != nil {
		goto ReadStructBeginError
	}

	for {
		_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
		if err != nil {
			goto ReadFieldBeginError
		}
		if fieldTypeId == thrift.STOP {
			break
		}

		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRUCT {
				if err = p.ReadField1(iprot); err != nil {
					goto ReadFieldError
				}
			} else {
				if err = iprot.Skip(fieldTypeId); err != nil {
					goto SkipFieldError
				}
			}
		default:
			if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		}

		if err = iprot.ReadFieldEnd(); err != nil {
			goto ReadFieldEndError
		}
	}
	if err = iprot.ReadStructEnd(); err != nil {
		goto ReadStructEndError
	}

	return nil
ReadStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
ReadFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
ReadFieldError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CartServiceDelCartProductArgs[fieldId]), err)
SkipFieldError:
	return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)

ReadFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
ReadStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}

func (p *CartServiceDelCartProductArgs) ReadField1(iprot thrift.TProtocol) error {
	p.Req = NewMallDelCartProductRequest()
	if err := p.Req.Read(iprot); err != nil {
		return err
	}
	return nil
}

func (p *CartServiceDelCartProductArgs) Write(oprot thrift.TProtocol) (err error) {
	var fieldId int16
	if err = oprot.WriteStructBegin("DelCartProduct_args"); err != nil {
		goto WriteStructBeginError
	}
	if p != nil {
		if err = p.writeField1(oprot); err != nil {
			fieldId = 1
			goto WriteFieldError
		}

	}
	if err = oprot.WriteFieldStop(); err != nil {
		goto WriteFieldStopError
	}
	if err = oprot.WriteStructEnd(); err != nil {
		goto WriteStructEndError
	}
	return nil
WriteStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
WriteFieldError:
	return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
WriteFieldStopError:
	return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
WriteStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
}

func (p *CartServiceDelCartProductArgs) writeField1(oprot thrift.TProtocol) (err error) {
	if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil {
		goto WriteFieldBeginError
	}
	if err := p.Req.Write(oprot); err != nil {
		return err
	}
	if err = oprot.WriteFieldEnd(); err != nil {
		goto WriteFieldEndError
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
}

func (p *CartServiceDelCartProductArgs) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("CartServiceDelCartProductArgs(%+v)", *p)
}

func (p *CartServiceDelCartProductArgs) DeepEqual(ano *CartServiceDelCartProductArgs) bool {
	if p == ano {
		return true
	} else if p == nil || ano == nil {
		return false
	}
	if !p.Field1DeepEqual(ano.Req) {
		return false
	}
	return true
}

func (p *CartServiceDelCartProductArgs) Field1DeepEqual(src *MallDelCartProductRequest) bool {

	if !p.Req.DeepEqual(src) {
		return false
	}
	return true
}

type CartServiceDelCartProductResult struct {
	Success *MallDelCartProductResponse `thrift:"success,0,optional" frugal:"0,optional,MallDelCartProductResponse" json:"success,omitempty"`
}

func NewCartServiceDelCartProductResult() *CartServiceDelCartProductResult {
	return &CartServiceDelCartProductResult{}
}

func (p *CartServiceDelCartProductResult) InitDefault() {
	*p = CartServiceDelCartProductResult{}
}

var CartServiceDelCartProductResult_Success_DEFAULT *MallDelCartProductResponse

func (p *CartServiceDelCartProductResult) GetSuccess() (v *MallDelCartProductResponse) {
	if !p.IsSetSuccess() {
		return CartServiceDelCartProductResult_Success_DEFAULT
	}
	return p.Success
}
func (p *CartServiceDelCartProductResult) SetSuccess(x interface{}) {
	p.Success = x.(*MallDelCartProductResponse)
}

var fieldIDToName_CartServiceDelCartProductResult = map[int16]string{
	0: "success",
}

func (p *CartServiceDelCartProductResult) IsSetSuccess() bool {
	return p.Success != nil
}

func (p *CartServiceDelCartProductResult) Read(iprot thrift.TProtocol) (err error) {

	var fieldTypeId thrift.TType
	var fieldId int16

	if _, err = iprot.ReadStructBegin(); err != nil {
		goto ReadStructBeginError
	}

	for {
		_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
		if err != nil {
			goto ReadFieldBeginError
		}
		if fieldTypeId == thrift.STOP {
			break
		}

		switch fieldId {
		case 0:
			if fieldTypeId == thrift.STRUCT {
				if err = p.ReadField0(iprot); err != nil {
					goto ReadFieldError
				}
			} else {
				if err = iprot.Skip(fieldTypeId); err != nil {
					goto SkipFieldError
				}
			}
		default:
			if err = iprot.Skip(fieldTypeId); err != nil {
				goto SkipFieldError
			}
		}

		if err = iprot.ReadFieldEnd(); err != nil {
			goto ReadFieldEndError
		}
	}
	if err = iprot.ReadStructEnd(); err != nil {
		goto ReadStructEndError
	}

	return nil
ReadStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
ReadFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
ReadFieldError:
	return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CartServiceDelCartProductResult[fieldId]), err)
SkipFieldError:
	return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)

ReadFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
ReadStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}

func (p *CartServiceDelCartProductResult) ReadField0(iprot thrift.TProtocol) error {
	p.Success = NewMallDelCartProductResponse()
	if err := p.Success.Read(iprot); err != nil {
		return err
	}
	return nil
}

func (p *CartServiceDelCartProductResult) Write(oprot thrift.TProtocol) (err error) {
	var fieldId int16
	if err = oprot.WriteStructBegin("DelCartProduct_result"); err != nil {
		goto WriteStructBeginError
	}
	if p != nil {
		if err = p.writeField0(oprot); err != nil {
			fieldId = 0
			goto WriteFieldError
		}

	}
	if err = oprot.WriteFieldStop(); err != nil {
		goto WriteFieldStopError
	}
	if err = oprot.WriteStructEnd(); err != nil {
		goto WriteStructEndError
	}
	return nil
WriteStructBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
WriteFieldError:
	return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
WriteFieldStopError:
	return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
WriteStructEndError:
	return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
}

func (p *CartServiceDelCartProductResult) writeField0(oprot thrift.TProtocol) (err error) {
	if p.IsSetSuccess() {
		if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
			goto WriteFieldBeginError
		}
		if err := p.Success.Write(oprot); err != nil {
			return err
		}
		if err = oprot.WriteFieldEnd(); err != nil {
			goto WriteFieldEndError
		}
	}
	return nil
WriteFieldBeginError:
	return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err)
WriteFieldEndError:
	return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err)
}

func (p *CartServiceDelCartProductResult) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("CartServiceDelCartProductResult(%+v)", *p)
}

func (p *CartServiceDelCartProductResult) DeepEqual(ano *CartServiceDelCartProductResult) bool {
	if p == ano {
		return true
	} else if p == nil || ano == nil {
		return false
	}
	if !p.Field0DeepEqual(ano.Success) {
		return false
	}
	return true
}

func (p *CartServiceDelCartProductResult) Field0DeepEqual(src *MallDelCartProductResponse) bool {

	if !p.Success.DeepEqual(src) {
		return false
	}
	return true
}
