• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang thrift.TProtocol类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ReadField2

func (p *HiveServerException) ReadField2(iprot thrift.TProtocol) (err thrift.TProtocolException) {
	v14, err15 := iprot.ReadI32()
	if err15 != nil {
		return thrift.NewTProtocolExceptionReadField(2, "errorCode", p.ThriftName(), err15)
	}
	p.ErrorCode = v14
	return err
}
开发者ID:sundy-li,项目名称:hive,代码行数:8,代码来源:ttypes.go


示例2: ReadField3

func (p *HiveServerException) ReadField3(iprot thrift.TProtocol) (err thrift.TProtocolException) {
	v16, err17 := iprot.ReadString()
	if err17 != nil {
		return thrift.NewTProtocolExceptionReadField(3, "SQLState", p.ThriftName(), err17)
	}
	p.SQLState = v16
	return err
}
开发者ID:sundy-li,项目名称:hive,代码行数:8,代码来源:ttypes.go


示例3: ReadField1

func (p *HiveServerException) ReadField1(iprot thrift.TProtocol) (err thrift.TProtocolException) {
	v12, err13 := iprot.ReadString()
	if err13 != nil {
		return thrift.NewTProtocolExceptionReadField(1, "message", p.ThriftName(), err13)
	}
	p.Message = v12
	return err
}
开发者ID:sundy-li,项目名称:hive,代码行数:8,代码来源:ttypes.go


示例4: ReadField6

func (p *HiveClusterStatus) ReadField6(iprot thrift.TProtocol) (err thrift.TProtocolException) {
	v10, err11 := iprot.ReadI32()
	if err11 != nil {
		return thrift.NewTProtocolExceptionReadField(6, "state", p.ThriftName(), err11)
	}
	p.State = JobTrackerState(v10)
	return err
}
开发者ID:sundy-li,项目名称:hive,代码行数:8,代码来源:ttypes.go


示例5: ReadField5

func (p *HiveClusterStatus) ReadField5(iprot thrift.TProtocol) (err thrift.TProtocolException) {
	v8, err9 := iprot.ReadI32()
	if err9 != nil {
		return thrift.NewTProtocolExceptionReadField(5, "maxReduceTasks", p.ThriftName(), err9)
	}
	p.MaxReduceTasks = v8
	return err
}
开发者ID:sundy-li,项目名称:hive,代码行数:8,代码来源:ttypes.go


示例6: ReadField4

func (p *HiveClusterStatus) ReadField4(iprot thrift.TProtocol) (err thrift.TProtocolException) {
	v6, err7 := iprot.ReadI32()
	if err7 != nil {
		return thrift.NewTProtocolExceptionReadField(4, "maxMapTasks", p.ThriftName(), err7)
	}
	p.MaxMapTasks = v6
	return err
}
开发者ID:sundy-li,项目名称:hive,代码行数:8,代码来源:ttypes.go


示例7: Write

func (p *HiveServerException) Write(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	err = oprot.WriteStructBegin("HiveServerException")
	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 = 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:sundy-li,项目名称:hive,代码行数:27,代码来源:ttypes.go


示例8: 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


示例9: 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


示例10: 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


示例11: 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


示例12: 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


示例13: Read

func (p *HiveClusterStatus) Read(iprot thrift.TProtocol) (err thrift.TProtocolException) {
	_, err = iprot.ReadStructBegin()
	if err != nil {
		return thrift.NewTProtocolExceptionReadStruct(p.ThriftName(), err)
	}
	for {
		fieldName, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if fieldId < 0 {
			fieldId = int16(p.FieldIdFromFieldName(fieldName))
		} else if fieldName == "" {
			fieldName = p.FieldNameFromFieldId(int(fieldId))
		}
		if fieldTypeId == thrift.GENERIC {
			fieldTypeId = p.FieldFromFieldId(int(fieldId)).TypeId()
		}
		if err != nil {
			return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		if fieldId == 1 || fieldName == "taskTrackers" {
			if fieldTypeId == thrift.I32 {
				err = p.ReadField1(iprot)
				if err != nil {
					return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
				}
			} else if fieldTypeId == thrift.VOID {
				err = iprot.Skip(fieldTypeId)
				if err != nil {
					return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
				}
			} else {
				err = p.ReadField1(iprot)
				if err != nil {
					return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
				}
			}
		} else if fieldId == 2 || fieldName == "mapTasks" {
			if fieldTypeId == thrift.I32 {
				err = p.ReadField2(iprot)
				if err != nil {
					return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
				}
			} else if fieldTypeId == thrift.VOID {
				err = iprot.Skip(fieldTypeId)
				if err != nil {
					return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
				}
			} else {
				err = p.ReadField2(iprot)
				if err != nil {
					return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
				}
			}
		} else if fieldId == 3 || fieldName == "reduceTasks" {
			if fieldTypeId == thrift.I32 {
				err = p.ReadField3(iprot)
				if err != nil {
					return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
				}
			} else if fieldTypeId == thrift.VOID {
				err = iprot.Skip(fieldTypeId)
				if err != nil {
					return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
				}
			} else {
				err = p.ReadField3(iprot)
				if err != nil {
					return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
				}
			}
		} else if fieldId == 4 || fieldName == "maxMapTasks" {
			if fieldTypeId == thrift.I32 {
				err = p.ReadField4(iprot)
				if err != nil {
					return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
				}
			} else if fieldTypeId == thrift.VOID {
				err = iprot.Skip(fieldTypeId)
				if err != nil {
					return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
				}
			} else {
				err = p.ReadField4(iprot)
				if err != nil {
					return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
				}
			}
		} else if fieldId == 5 || fieldName == "maxReduceTasks" {
			if fieldTypeId == thrift.I32 {
				err = p.ReadField5(iprot)
				if err != nil {
					return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
				}
			} else if fieldTypeId == thrift.VOID {
				err = iprot.Skip(fieldTypeId)
				if err != nil {
					return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
				}
//.........这里部分代码省略.........
开发者ID:sundy-li,项目名称:hive,代码行数:101,代码来源:ttypes.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang context.Context类代码示例发布时间:2022-05-24
下一篇:
Golang value.Value类代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap