當前位置: 首頁>>代碼示例>>Golang>>正文


Golang TProtocol.WriteStructBegin方法代碼示例

本文整理匯總了Golang中github.com/apesternikov/thrift4go/lib/go/src/thrift.TProtocol.WriteStructBegin方法的典型用法代碼示例。如果您正苦於以下問題:Golang TProtocol.WriteStructBegin方法的具體用法?Golang TProtocol.WriteStructBegin怎麽用?Golang TProtocol.WriteStructBegin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/apesternikov/thrift4go/lib/go/src/thrift.TProtocol的用法示例。


在下文中一共展示了TProtocol.WriteStructBegin方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Write

func (p *Work) Write(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	err = oprot.WriteStructBegin("Work")
	if err != nil {
		return thrift.NewTProtocolExceptionWriteStruct(p.ThriftName(), err)
	}
	err = p.writeField1(oprot)
	if err != nil {
		return err
	}
	err = p.writeField2(oprot)
	if err != nil {
		return err
	}
	err = p.writeField3(oprot)
	if err != nil {
		return err
	}
	err = p.writeField4(oprot)
	if err != nil {
		return err
	}
	err = oprot.WriteFieldStop()
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(-1, "STOP", p.ThriftName(), err)
	}
	err = oprot.WriteStructEnd()
	if err != nil {
		return thrift.NewTProtocolExceptionWriteStruct(p.ThriftName(), err)
	}
	return err
}
開發者ID:mohanarpit,項目名稱:goh,代碼行數:31,代碼來源:ttypes.go

示例2: Write

func (p *CalculateResult) Write(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	err = oprot.WriteStructBegin("calculate_result")
	if err != nil {
		return thrift.NewTProtocolExceptionWriteStruct(p.ThriftName(), err)
	}
	switch {
	case p.Ouch != nil:
		if err = p.writeField1(oprot); err != nil {
			return err
		}
	default:
		if err = p.writeField0(oprot); err != nil {
			return err
		}
	}
	err = oprot.WriteFieldStop()
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(-1, "STOP", p.ThriftName(), err)
	}
	err = oprot.WriteStructEnd()
	if err != nil {
		return thrift.NewTProtocolExceptionWriteStruct(p.ThriftName(), err)
	}
	return err
}
開發者ID:mohanarpit,項目名稱:goh,代碼行數:25,代碼來源:Calculator.go

示例3: Write

func (p *MyMethodResult) Write(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	err = oprot.WriteStructBegin("myMethod_result")
	if err != nil {
		return thrift.NewTProtocolExceptionWriteStruct(p.ThriftName(), err)
	}
	err = oprot.WriteFieldStop()
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(-1, "STOP", p.ThriftName(), err)
	}
	err = oprot.WriteStructEnd()
	if err != nil {
		return thrift.NewTProtocolExceptionWriteStruct(p.ThriftName(), err)
	}
	return err
}
開發者ID:mohanarpit,項目名稱:goh,代碼行數:15,代碼來源:ReverseOrderService.go

示例4: Write

func (p *MethodThatThrowsAnExceptionResult) Write(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	err = oprot.WriteStructBegin("methodThatThrowsAnException_result")
	if err != nil {
		return thrift.NewTProtocolExceptionWriteStruct(p.ThriftName(), err)
	}
	switch {
	case p.Xwamap != nil:
		if err = p.writeField1(oprot); err != nil {
			return err
		}
	}
	err = oprot.WriteFieldStop()
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(-1, "STOP", p.ThriftName(), err)
	}
	err = oprot.WriteStructEnd()
	if err != nil {
		return thrift.NewTProtocolExceptionWriteStruct(p.ThriftName(), err)
	}
	return err
}
開發者ID:mohanarpit,項目名稱:goh,代碼行數:21,代碼來源:ServiceForExceptionWithAMap.go


注:本文中的github.com/apesternikov/thrift4go/lib/go/src/thrift.TProtocol.WriteStructBegin方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。