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


Golang TProtocol.WriteFieldBegin方法代碼示例

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


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

示例1: writeField3

func (p *FindAllArgs) writeField3(oprot thrift.TProtocol) (err error) {
	if p.Param != nil {
		if err := oprot.WriteFieldBegin("param", thrift.MAP, 3); err != nil {
			return fmt.Errorf("%T write field begin error 3:param: %s", p, err)
		}
		if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRING, len(p.Param)); err != nil {
			return fmt.Errorf("error writing map begin: %s")
		}
		for k, v := range p.Param {
			if err := oprot.WriteString(string(k)); err != nil {
				return fmt.Errorf("%T. (0) field write error: %s", p)
			}
			if err := oprot.WriteString(string(v)); err != nil {
				return fmt.Errorf("%T. (0) field write error: %s", p)
			}
		}
		if err := oprot.WriteMapEnd(); err != nil {
			return fmt.Errorf("error writing map end: %s")
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return fmt.Errorf("%T write field end error 3:param: %s", p, err)
		}
	}
	return err
}
開發者ID:viney,項目名稱:gothrift,代碼行數:25,代碼來源:rpc_service.go

示例2: writeField2

func (p *FindAllArgs) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("password", thrift.STRING, 2); err != nil {
		return fmt.Errorf("%T write field begin error 2:password: %s", p, err)
	}
	if err := oprot.WriteString(string(p.Password)); err != nil {
		return fmt.Errorf("%T.password (2) field write error: %s", p)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return fmt.Errorf("%T write field end error 2:password: %s", p, err)
	}
	return err
}
開發者ID:viney,項目名稱:gothrift,代碼行數:12,代碼來源:rpc_service.go

示例3: writeField1

func (p *SecondServiceSecondtestStringArgs) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("thing", thrift.STRING, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:thing: ", p), err)
	}
	if err := oprot.WriteString(string(p.Thing)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.thing (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:thing: ", p), err)
	}
	return err
}
開發者ID:sktzwhj,項目名稱:thrift-0.9.3,代碼行數:12,代碼來源:secondservice.go

示例4: writeField1

func (p *FindAllArgs) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("userid", thrift.I64, 1); err != nil {
		return fmt.Errorf("%T write field begin error 1:userid: %s", p, err)
	}
	if err := oprot.WriteI64(int64(p.Userid)); err != nil {
		return fmt.Errorf("%T.userid (1) field write error: %s", p)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return fmt.Errorf("%T write field end error 1:userid: %s", p, err)
	}
	return err
}
開發者ID:viney,項目名稱:gothrift,代碼行數:12,代碼來源:rpc_service.go

示例5: writeField0

func (p *SecondServiceSecondtestStringResult) writeField0(oprot thrift.TProtocol) (err error) {
	if p.IsSetSuccess() {
		if err := oprot.WriteFieldBegin("success", thrift.STRING, 0); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err)
		}
		if err := oprot.WriteString(string(*p.Success)); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T.success (0) field write error: ", p), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err)
		}
	}
	return err
}
開發者ID:sktzwhj,項目名稱:thrift-0.9.3,代碼行數:14,代碼來源:secondservice.go

示例6: WriteField2

func (p *Reservation) WriteField2(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	err = oprot.WriteFieldBegin("secret", thrift.STRING, 2)
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(2, "secret", p.ThriftName(), err)
	}
	err = oprot.WriteString(string(p.Secret))
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(2, "secret", p.ThriftName(), err)
	}
	err = oprot.WriteFieldEnd()
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(2, "secret", p.ThriftName(), err)
	}
	return err
}
開發者ID:paulcnichols,項目名稱:BigSelect,代碼行數:15,代碼來源:ttypes.go

示例7: WriteField1

func (p *Reservation) WriteField1(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	err = oprot.WriteFieldBegin("queue", thrift.STRING, 1)
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(1, "queue", p.ThriftName(), err)
	}
	err = oprot.WriteString(string(p.Queue))
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(1, "queue", p.ThriftName(), err)
	}
	err = oprot.WriteFieldEnd()
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(1, "queue", p.ThriftName(), err)
	}
	return err
}
開發者ID:paulcnichols,項目名稱:BigSelect,代碼行數:15,代碼來源:ttypes.go

示例8: WriteField9

func (p *ContainerOfEnums) WriteField9(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	if p.IsSetDefaultNineth() {
		err = oprot.WriteFieldBegin("default_nineth", thrift.I32, 9)
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(9, "default_nineth", p.ThriftName(), err)
		}
		err = oprot.WriteI32(int32(p.DefaultNineth))
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(9, "default_nineth", p.ThriftName(), err)
		}
		err = oprot.WriteFieldEnd()
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(9, "default_nineth", p.ThriftName(), err)
		}
	}
	return err
}
開發者ID:benpence,項目名稱:thrift4go,代碼行數:17,代碼來源:ttypes.go

示例9: WriteField6

func (p *ContainerOfEnums) WriteField6(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	if p.IsSetOptionalSixth() {
		err = oprot.WriteFieldBegin("optional_sixth", thrift.I32, 6)
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(6, "optional_sixth", p.ThriftName(), err)
		}
		err = oprot.WriteI32(int32(p.OptionalSixth))
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(6, "optional_sixth", p.ThriftName(), err)
		}
		err = oprot.WriteFieldEnd()
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(6, "optional_sixth", p.ThriftName(), err)
		}
	}
	return err
}
開發者ID:benpence,項目名稱:thrift4go,代碼行數:17,代碼來源:ttypes.go

示例10: WriteField3

func (p *ContainerOfEnums) WriteField3(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	if p.IsSetThird() {
		err = oprot.WriteFieldBegin("third", thrift.I32, 3)
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(3, "third", p.ThriftName(), err)
		}
		err = oprot.WriteI32(int32(p.Third))
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(3, "third", p.ThriftName(), err)
		}
		err = oprot.WriteFieldEnd()
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(3, "third", p.ThriftName(), err)
		}
	}
	return err
}
開發者ID:benpence,項目名稱:thrift4go,代碼行數:17,代碼來源:ttypes.go

示例11: WriteField2

func (p *ContainerOfEnums) WriteField2(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	if p.IsSetSecond() {
		err = oprot.WriteFieldBegin("second", thrift.I32, 2)
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(2, "second", p.ThriftName(), err)
		}
		err = oprot.WriteI32(int32(p.Second))
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(2, "second", p.ThriftName(), err)
		}
		err = oprot.WriteFieldEnd()
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(2, "second", p.ThriftName(), err)
		}
	}
	return err
}
開發者ID:benpence,項目名稱:thrift4go,代碼行數:17,代碼來源:ttypes.go

示例12: WriteField1

func (p *ContainerOfEnums) WriteField1(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	if p.IsSetFirst() {
		err = oprot.WriteFieldBegin("first", thrift.I32, 1)
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(1, "first", p.ThriftName(), err)
		}
		err = oprot.WriteI32(int32(p.First))
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(1, "first", p.ThriftName(), err)
		}
		err = oprot.WriteFieldEnd()
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(1, "first", p.ThriftName(), err)
		}
	}
	return err
}
開發者ID:benpence,項目名稱:thrift4go,代碼行數:17,代碼來源:ttypes.go

示例13: WriteField0

func (p *EchoResult) WriteField0(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	if p.Success != nil {
		err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0)
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(0, "success", p.ThriftName(), err)
		}
		err = p.Success.Write(oprot)
		if err != nil {
			return thrift.NewTProtocolExceptionWriteStruct("ContainerOfEnums", err)
		}
		err = oprot.WriteFieldEnd()
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(0, "success", p.ThriftName(), err)
		}
	}
	return err
}
開發者ID:pablo-meier,項目名稱:thrift4go,代碼行數:17,代碼來源:ContainerOfEnumsTestService.go

示例14: WriteField1

func (p *EchoArgs) WriteField1(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	if p.Message != nil {
		err = oprot.WriteFieldBegin("message", thrift.STRUCT, 1)
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(1, "message", p.ThriftName(), err)
		}
		err = p.Message.Write(oprot)
		if err != nil {
			return thrift.NewTProtocolExceptionWriteStruct("ContainerOfEnums", err)
		}
		err = oprot.WriteFieldEnd()
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(1, "message", p.ThriftName(), err)
		}
	}
	return err
}
開發者ID:pablo-meier,項目名稱:thrift4go,代碼行數:17,代碼來源:ContainerOfEnumsTestService.go

示例15: writeField0

func (p *FindAllResult) writeField0(oprot thrift.TProtocol) (err error) {
	if p.Success != nil {
		if err := oprot.WriteFieldBegin("success", thrift.LIST, 0); err != nil {
			return fmt.Errorf("%T write field begin error 0:success: %s", p, err)
		}
		if err := oprot.WriteListBegin(thrift.STRING, len(p.Success)); err != nil {
			return fmt.Errorf("error writing list begin: %s")
		}
		for _, v := range p.Success {
			if err := oprot.WriteString(string(v)); err != nil {
				return fmt.Errorf("%T. (0) field write error: %s", p)
			}
		}
		if err := oprot.WriteListEnd(); err != nil {
			return fmt.Errorf("error writing list end: %s")
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return fmt.Errorf("%T write field end error 0:success: %s", p, err)
		}
	}
	return err
}
開發者ID:viney,項目名稱:gothrift,代碼行數:22,代碼來源:rpc_service.go


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