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


Golang TProtocol.WriteFieldBegin方法代码示例

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


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

示例1: WriteField6

func (p *HiveClusterStatus) WriteField6(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	err = oprot.WriteFieldBegin("state", thrift.I32, 6)
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(6, "state", p.ThriftName(), err)
	}
	err = oprot.WriteI32(int32(p.State))
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(6, "state", p.ThriftName(), err)
	}
	err = oprot.WriteFieldEnd()
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(6, "state", p.ThriftName(), err)
	}
	return err
}
开发者ID:sundy-li,项目名称:hive,代码行数:15,代码来源:ttypes.go

示例2: WriteField3

func (p *HiveServerException) WriteField3(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	if len(p.SQLState) < 1 {
		return nil
	}
	err = oprot.WriteFieldBegin("SQLState", thrift.STRING, 3)
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(3, "SQLState", p.ThriftName(), err)
	}
	err = oprot.WriteString(string(p.SQLState))
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(3, "SQLState", p.ThriftName(), err)
	}
	err = oprot.WriteFieldEnd()
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(3, "SQLState", p.ThriftName(), err)
	}
	return err
}
开发者ID:sundy-li,项目名称:hive,代码行数:18,代码来源:ttypes.go

示例3: WriteField2

func (p *HiveServerException) WriteField2(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	if int64(p.ErrorCode) == 0 {
		return nil
	}
	err = oprot.WriteFieldBegin("errorCode", thrift.I32, 2)
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(2, "errorCode", p.ThriftName(), err)
	}
	err = oprot.WriteI32(int32(p.ErrorCode))
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(2, "errorCode", p.ThriftName(), err)
	}
	err = oprot.WriteFieldEnd()
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(2, "errorCode", p.ThriftName(), err)
	}
	return err
}
开发者ID:sundy-li,项目名称:hive,代码行数:18,代码来源:ttypes.go

示例4: WriteField1

func (p *HiveServerException) WriteField1(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	if len(p.Message) < 1 {
		return nil
	}
	err = oprot.WriteFieldBegin("message", thrift.STRING, 1)
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(1, "message", p.ThriftName(), err)
	}
	err = oprot.WriteString(string(p.Message))
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(1, "message", p.ThriftName(), err)
	}
	err = oprot.WriteFieldEnd()
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(1, "message", p.ThriftName(), err)
	}
	return err
}
开发者ID:sundy-li,项目名称:hive,代码行数:18,代码来源:ttypes.go

示例5: WriteField5

func (p *HiveClusterStatus) WriteField5(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	if int64(p.MaxReduceTasks) == 0 {
		return nil
	}
	err = oprot.WriteFieldBegin("maxReduceTasks", thrift.I32, 5)
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(5, "maxReduceTasks", p.ThriftName(), err)
	}
	err = oprot.WriteI32(int32(p.MaxReduceTasks))
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(5, "maxReduceTasks", p.ThriftName(), err)
	}
	err = oprot.WriteFieldEnd()
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(5, "maxReduceTasks", p.ThriftName(), err)
	}
	return err
}
开发者ID:sundy-li,项目名称:hive,代码行数:18,代码来源:ttypes.go


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