本文整理汇总了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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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)
}
//.........这里部分代码省略.........