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


Golang TProtocol.WriteString方法代碼示例

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


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

示例1: writeField2

func (p *RestResponse) writeField2(oprot thrift.TProtocol) (err error) {
	if p.IsSetHeaders() {
		if err := oprot.WriteFieldBegin("headers", thrift.MAP, 2); err != nil {
			return fmt.Errorf("%T write field begin error 2:headers: %s", p, err)
		}
		if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRING, len(p.Headers)); err != nil {
			return fmt.Errorf("error writing map begin: %s", err)
		}
		for k, v := range p.Headers {
			if err := oprot.WriteString(string(k)); err != nil {
				return fmt.Errorf("%T. (0) field write error: %s", p, err)
			}
			if err := oprot.WriteString(string(v)); err != nil {
				return fmt.Errorf("%T. (0) field write error: %s", p, err)
			}
		}
		if err := oprot.WriteMapEnd(); err != nil {
			return fmt.Errorf("error writing map end: %s", err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return fmt.Errorf("%T write field end error 2:headers: %s", p, err)
		}
	}
	return err
}
開發者ID:fayizk1,項目名稱:gen-go,代碼行數:25,代碼來源:ttypes.go

示例2: writeField1

func (p *ReadArgs) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("contactId", thrift.STRING, 1); err != nil {
		return fmt.Errorf("%T write field begin error 1:contactId: %s", p, err)
	}
	if err := oprot.WriteString(string(p.ContactId)); err != nil {
		return fmt.Errorf("%T.contactId (1) field write error: %s", p)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return fmt.Errorf("%T write field end error 1:contactId: %s", p, err)
	}
	return err
}
開發者ID:charonuguid,項目名稱:phonebook,代碼行數:12,代碼來源:contact_svc.go

示例3: writeField2

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

示例4: writeField5

func (p *Contact) writeField5(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("created", thrift.STRING, 5); err != nil {
		return fmt.Errorf("%T write field begin error 5:created: %s", p, err)
	}
	if err := oprot.WriteString(string(p.Created)); err != nil {
		return fmt.Errorf("%T.created (5) field write error: %s", p)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return fmt.Errorf("%T write field end error 5:created: %s", p, err)
	}
	return err
}
開發者ID:charonuguid,項目名稱:phonebook,代碼行數:12,代碼來源:ttypes.go

示例5: writeField1

func (p *LogEntry) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("hostname", thrift.STRING, 1); err != nil {
		return fmt.Errorf("%T write field begin error 1:hostname: %s", p, err)
	}
	if err := oprot.WriteString(string(p.Hostname)); err != nil {
		return fmt.Errorf("%T.hostname (1) field write error: %s", p, err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return fmt.Errorf("%T write field end error 1:hostname: %s", p, err)
	}
	return err
}
開發者ID:houcy,項目名稱:thriftAndGob,代碼行數:12,代碼來源:ttypes.go

示例6: writeField3

func (p *Contact) writeField3(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("phone", thrift.STRING, 3); err != nil {
		return fmt.Errorf("%T write field begin error 3:phone: %s", p, err)
	}
	if err := oprot.WriteString(string(p.Phone)); err != nil {
		return fmt.Errorf("%T.phone (3) field write error: %s", p)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return fmt.Errorf("%T write field end error 3:phone: %s", p, err)
	}
	return err
}
開發者ID:charonuguid,項目名稱:phonebook,代碼行數:12,代碼來源:ttypes.go

示例7: writeField2

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

示例8: writeField1

func (p *Echo2timesArgs) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("string1", thrift.STRING, 1); err != nil {
		return fmt.Errorf("%T write field begin error 1:string1: %s", p, err)
	}
	if err := oprot.WriteString(string(p.String1)); err != nil {
		return fmt.Errorf("%T.string1 (1) field write error: %s", p, err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return fmt.Errorf("%T write field end error 1:string1: %s", p, err)
	}
	return err
}
開發者ID:WitzHsiao,項目名稱:ThriftSample,代碼行數:12,代碼來源:echosrv.go

示例9: writeField4

func (p *Contact) writeField4(oprot thrift.TProtocol) (err error) {
	if p.IsSetEmail() {
		if err := oprot.WriteFieldBegin("email", thrift.STRING, 4); err != nil {
			return fmt.Errorf("%T write field begin error 4:email: %s", p, err)
		}
		if err := oprot.WriteString(string(p.Email)); err != nil {
			return fmt.Errorf("%T.email (4) field write error: %s", p)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return fmt.Errorf("%T write field end error 4:email: %s", p, err)
		}
	}
	return err
}
開發者ID:charonuguid,項目名稱:phonebook,代碼行數:14,代碼來源:ttypes.go

示例10: writeField0

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


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