本文整理汇总了Golang中tumblr/encoding/thrift.TProtocol.WriteFieldBegin方法的典型用法代码示例。如果您正苦于以下问题:Golang TProtocol.WriteFieldBegin方法的具体用法?Golang TProtocol.WriteFieldBegin怎么用?Golang TProtocol.WriteFieldBegin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tumblr/encoding/thrift.TProtocol
的用法示例。
在下文中一共展示了TProtocol.WriteFieldBegin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: WriteField1
func (p *LogArgs) WriteField1(oprot thrift.TProtocol) (err thrift.TProtocolException) {
if p.Messages != nil {
err = oprot.WriteFieldBegin("messages", thrift.LIST, 1)
if err != nil {
return thrift.NewTProtocolExceptionWriteField(1, "messages", p.ThriftName(), err)
}
err = oprot.WriteListBegin(thrift.STRUCT, p.Messages.Len())
if err != nil {
return thrift.NewTProtocolExceptionWriteField(-1, "", "list", err)
}
for Iter22 := range p.Messages.Iter() {
Iter23 := Iter22.(*LogEntry)
err = Iter23.Write(oprot)
if err != nil {
return thrift.NewTProtocolExceptionWriteStruct("LogEntry", err)
}
}
err = oprot.WriteListEnd()
if err != nil {
return thrift.NewTProtocolExceptionWriteField(-1, "", "list", err)
}
err = oprot.WriteFieldEnd()
if err != nil {
return thrift.NewTProtocolExceptionWriteField(1, "messages", p.ThriftName(), err)
}
}
return err
}
示例2: WriteField2
func (p *LogEntry) WriteField2(oprot thrift.TProtocol) (err thrift.TProtocolException) {
err = oprot.WriteFieldBegin("message", thrift.STRING, 2)
if err != nil {
return thrift.NewTProtocolExceptionWriteField(2, "message", p.ThriftName(), err)
}
err = oprot.WriteString(string(p.Message))
if err != nil {
return thrift.NewTProtocolExceptionWriteField(2, "message", p.ThriftName(), err)
}
err = oprot.WriteFieldEnd()
if err != nil {
return thrift.NewTProtocolExceptionWriteField(2, "message", p.ThriftName(), err)
}
return err
}
示例3: WriteField1
func (p *LogEntry) WriteField1(oprot thrift.TProtocol) (err thrift.TProtocolException) {
err = oprot.WriteFieldBegin("category", thrift.STRING, 1)
if err != nil {
return thrift.NewTProtocolExceptionWriteField(1, "category", p.ThriftName(), err)
}
err = oprot.WriteString(string(p.Category))
if err != nil {
return thrift.NewTProtocolExceptionWriteField(1, "category", p.ThriftName(), err)
}
err = oprot.WriteFieldEnd()
if err != nil {
return thrift.NewTProtocolExceptionWriteField(1, "category", p.ThriftName(), err)
}
return err
}
示例4: WriteField0
func (p *LogResult) WriteField0(oprot thrift.TProtocol) (err thrift.TProtocolException) {
err = oprot.WriteFieldBegin("success", thrift.I32, 0)
if err != nil {
return thrift.NewTProtocolExceptionWriteField(0, "success", p.ThriftName(), err)
}
err = oprot.WriteI32(int32(p.Success))
if err != nil {
return thrift.NewTProtocolExceptionWriteField(0, "success", p.ThriftName(), err)
}
err = oprot.WriteFieldEnd()
if err != nil {
return thrift.NewTProtocolExceptionWriteField(0, "success", p.ThriftName(), err)
}
return err
}