當前位置: 首頁>>代碼示例>>Golang>>正文


Golang TProtocol.WriteString方法代碼示例

本文整理匯總了Golang中github.com/apesternikov/thrift4go/lib/go/src/thrift.TProtocol.WriteString方法的典型用法代碼示例。如果您正苦於以下問題:Golang TProtocol.WriteString方法的具體用法?Golang TProtocol.WriteString怎麽用?Golang TProtocol.WriteString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/apesternikov/thrift4go/lib/go/src/thrift.TProtocol的用法示例。


在下文中一共展示了TProtocol.WriteString方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: writeField6

func (p *Manymaps) writeField6(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	if p.Binarstructymap != nil {
		err = oprot.WriteFieldBegin("binarstructymap", thrift.MAP, 6)
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(6, "binarstructymap", p.ThriftName(), err)
		}
		err = oprot.WriteMapBegin(thrift.STRING, thrift.STRUCT, len(p.Binarstructymap))
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(-1, "", "map", err)
		}
		for Kiter91, Viter92 := range p.Binarstructymap {
			err = oprot.WriteString(Kiter91)
			if err != nil {
				return thrift.NewTProtocolExceptionWriteField(0, "Kiter91", "", err)
			}
			err = Viter92.Write(oprot)
			if err != nil {
				return thrift.NewTProtocolExceptionWriteStruct("intstruct", err)
			}
		}
		err = oprot.WriteMapEnd()
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(-1, "", "map", err)
		}
		err = oprot.WriteFieldEnd()
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(6, "binarstructymap", p.ThriftName(), err)
		}
	}
	return err
}
開發者ID:mohanarpit,項目名稱:goh,代碼行數:31,代碼來源:ttypes.go

示例2: writeField4

func (p *Manylists) writeField4(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	if p.Stringlist != nil {
		err = oprot.WriteFieldBegin("stringlist", thrift.LIST, 4)
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(4, "stringlist", p.ThriftName(), err)
		}
		err = oprot.WriteListBegin(thrift.STRING, len(p.Stringlist))
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(-1, "", "list", err)
		}
		for _, Iter80 := range p.Stringlist {
			err = oprot.WriteString(Iter80)
			if err != nil {
				return thrift.NewTProtocolExceptionWriteField(0, "Iter80", "", err)
			}
		}
		err = oprot.WriteListEnd()
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(-1, "", "list", err)
		}
		err = oprot.WriteFieldEnd()
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(4, "stringlist", p.ThriftName(), err)
		}
	}
	return err
}
開發者ID:mohanarpit,項目名稱:goh,代碼行數:27,代碼來源:ttypes.go

示例3: writeField5

func (p *Manymaps) writeField5(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	if p.Binarymap != nil {
		err = oprot.WriteFieldBegin("binarymap", thrift.MAP, 5)
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(5, "binarymap", p.ThriftName(), err)
		}
		err = oprot.WriteMapBegin(thrift.STRING, thrift.STRING, len(p.Binarymap))
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(-1, "", "map", err)
		}
		for Kiter89, Viter90 := range p.Binarymap {
			err = oprot.WriteString(Kiter89)
			if err != nil {
				return thrift.NewTProtocolExceptionWriteField(0, "Kiter89", "", err)
			}
			err = oprot.WriteString(Viter90)
			if err != nil {
				return thrift.NewTProtocolExceptionWriteField(0, "Viter90", "", err)
			}
		}
		err = oprot.WriteMapEnd()
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(-1, "", "map", err)
		}
		err = oprot.WriteFieldEnd()
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(5, "binarymap", p.ThriftName(), err)
		}
	}
	return err
}
開發者ID:mohanarpit,項目名稱:goh,代碼行數:31,代碼來源:ttypes.go

示例4: writeField3

func (p *Manymaps) writeField3(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	if p.I32map != nil {
		err = oprot.WriteFieldBegin("i32map", thrift.MAP, 3)
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(3, "i32map", p.ThriftName(), err)
		}
		err = oprot.WriteMapBegin(thrift.I32, thrift.STRING, len(p.I32map))
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(-1, "", "map", err)
		}
		for Kiter85, Viter86 := range p.I32map {
			err = oprot.WriteI32(int32(Kiter85))
			if err != nil {
				return thrift.NewTProtocolExceptionWriteField(0, "Kiter85", "", err)
			}
			err = oprot.WriteString(Viter86)
			if err != nil {
				return thrift.NewTProtocolExceptionWriteField(0, "Viter86", "", err)
			}
		}
		err = oprot.WriteMapEnd()
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(-1, "", "map", err)
		}
		err = oprot.WriteFieldEnd()
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(3, "i32map", p.ThriftName(), err)
		}
	}
	return err
}
開發者ID:mohanarpit,項目名稱:goh,代碼行數:31,代碼來源:ttypes.go

示例5: writeField2

func (p *Manymaps) writeField2(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	if p.I16map != nil {
		if p.IsSetI16map() {
			err = oprot.WriteFieldBegin("i16map", thrift.MAP, 2)
			if err != nil {
				return thrift.NewTProtocolExceptionWriteField(2, "i16map", p.ThriftName(), err)
			}
			err = oprot.WriteMapBegin(thrift.I16, thrift.STRING, len(p.I16map))
			if err != nil {
				return thrift.NewTProtocolExceptionWriteField(-1, "", "map", err)
			}
			for Kiter83, Viter84 := range p.I16map {
				err = oprot.WriteI16(int16(Kiter83))
				if err != nil {
					return thrift.NewTProtocolExceptionWriteField(0, "Kiter83", "", err)
				}
				err = oprot.WriteString(Viter84)
				if err != nil {
					return thrift.NewTProtocolExceptionWriteField(0, "Viter84", "", err)
				}
			}
			err = oprot.WriteMapEnd()
			if err != nil {
				return thrift.NewTProtocolExceptionWriteField(-1, "", "map", err)
			}
			err = oprot.WriteFieldEnd()
			if err != nil {
				return thrift.NewTProtocolExceptionWriteField(2, "i16map", p.ThriftName(), err)
			}
		}
	}
	return err
}
開發者ID:mohanarpit,項目名稱:goh,代碼行數:33,代碼來源:ttypes.go

示例6: writeField1

func (p *Manymaps) writeField1(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	if p.Bytemap != nil {
		err = oprot.WriteFieldBegin("bytemap", thrift.MAP, 1)
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(1, "bytemap", p.ThriftName(), err)
		}
		err = oprot.WriteMapBegin(thrift.BYTE, thrift.STRING, len(p.Bytemap))
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(-1, "", "map", err)
		}
		for Kiter81, Viter82 := range p.Bytemap {
			err = oprot.WriteByte(int8(Kiter81))
			if err != nil {
				return thrift.NewTProtocolExceptionWriteField(0, "Kiter81", "", err)
			}
			err = oprot.WriteString(Viter82)
			if err != nil {
				return thrift.NewTProtocolExceptionWriteField(0, "Viter82", "", err)
			}
		}
		err = oprot.WriteMapEnd()
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(-1, "", "map", err)
		}
		err = oprot.WriteFieldEnd()
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(1, "bytemap", p.ThriftName(), err)
		}
	}
	return err
}
開發者ID:mohanarpit,項目名稱:goh,代碼行數:31,代碼來源:ttypes.go

示例7: writeField4

func (p *MyMethodArgs) writeField4(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	err = oprot.WriteFieldBegin("first", thrift.STRING, 4)
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(4, "first", p.ThriftName(), err)
	}
	err = oprot.WriteString(p.First)
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(4, "first", p.ThriftName(), err)
	}
	err = oprot.WriteFieldEnd()
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(4, "first", p.ThriftName(), err)
	}
	return err
}
開發者ID:mohanarpit,項目名稱:goh,代碼行數:15,代碼來源:ReverseOrderService.go


注:本文中的github.com/apesternikov/thrift4go/lib/go/src/thrift.TProtocol.WriteString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。