当前位置: 首页>>代码示例>>Golang>>正文


Golang TProtocol.WriteFieldEnd方法代码示例

本文整理汇总了Golang中github.com/chentao/thrift/lib/go/thrift.TProtocol.WriteFieldEnd方法的典型用法代码示例。如果您正苦于以下问题:Golang TProtocol.WriteFieldEnd方法的具体用法?Golang TProtocol.WriteFieldEnd怎么用?Golang TProtocol.WriteFieldEnd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/chentao/thrift/lib/go/thrift.TProtocol的用法示例。


在下文中一共展示了TProtocol.WriteFieldEnd方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: writeField2

func (p *ThriftFlumeEvent) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("body", thrift.STRING, 2); err != nil {
		return fmt.Errorf("%T write field begin error 2:body: %s", p, err)
	}
	if err := oprot.WriteBinary(p.Body); err != nil {
		return fmt.Errorf("%T.body (2) field write error: %s", p, err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return fmt.Errorf("%T write field end error 2:body: %s", p, err)
	}
	return err
}
开发者ID:chentao,项目名称:heka-flume,代码行数:12,代码来源:ttypes.go

示例2: writeField1

func (p *AppendArgs) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("event", thrift.STRUCT, 1); err != nil {
		return fmt.Errorf("%T write field begin error 1:event: %s", p, err)
	}
	if err := p.Event.Write(oprot); err != nil {
		return fmt.Errorf("%T error writing struct: %s", p.Event, err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return fmt.Errorf("%T write field end error 1:event: %s", p, err)
	}
	return err
}
开发者ID:chentao,项目名称:heka-flume,代码行数:12,代码来源:thriftsourceprotocol.go

示例3: writeField0

func (p *AppendBatchResult) writeField0(oprot thrift.TProtocol) (err error) {
	if p.IsSetSuccess() {
		if err := oprot.WriteFieldBegin("success", thrift.I32, 0); err != nil {
			return fmt.Errorf("%T write field begin error 0:success: %s", p, err)
		}
		if err := oprot.WriteI32(int32(*p.Success)); err != nil {
			return fmt.Errorf("%T.success (0) field write error: %s", p, err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return fmt.Errorf("%T write field end error 0:success: %s", p, err)
		}
	}
	return err
}
开发者ID:chentao,项目名称:heka-flume,代码行数:14,代码来源:thriftsourceprotocol.go

示例4: writeField1

func (p *ThriftFlumeEvent) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("headers", thrift.MAP, 1); err != nil {
		return fmt.Errorf("%T write field begin error 1:headers: %s", p, err)
	}
	if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRING, len(p.Headers)); err != nil {
		return fmt.Errorf("error writing map begin: %s", err)
	}
	for k, v := range p.Headers {
		if err := oprot.WriteString(string(k)); err != nil {
			return fmt.Errorf("%T. (0) field write error: %s", p, err)
		}
		if err := oprot.WriteString(string(v)); err != nil {
			return fmt.Errorf("%T. (0) field write error: %s", p, err)
		}
	}
	if err := oprot.WriteMapEnd(); err != nil {
		return fmt.Errorf("error writing map end: %s", err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return fmt.Errorf("%T write field end error 1:headers: %s", p, err)
	}
	return err
}
开发者ID:chentao,项目名称:heka-flume,代码行数:23,代码来源:ttypes.go


注:本文中的github.com/chentao/thrift/lib/go/thrift.TProtocol.WriteFieldEnd方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。