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


Golang thrift.TProtocol類代碼示例

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


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

示例1: Read

func (p *ReadResult) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return fmt.Errorf("%T read error", p)
	}
	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 0:
			if err := p.readField0(iprot); err != nil {
				return err
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return fmt.Errorf("%T read struct end error: %s", p, err)
	}
	return nil
}
開發者ID:charonuguid,項目名稱:phonebook,代碼行數:31,代碼來源:contact_svc.go

示例2: readField5

func (p *Contact) readField5(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return fmt.Errorf("error reading field 5: %s")
	} else {
		p.Created = v
	}
	return nil
}
開發者ID:charonuguid,項目名稱:phonebook,代碼行數:8,代碼來源:ttypes.go

示例3: ReadField1

func (p *Echo2timesArgs) ReadField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return fmt.Errorf("error reading field 1: %s", err)
	} else {
		p.String1 = v
	}
	return nil
}
開發者ID:WitzHsiao,項目名稱:ThriftSample,代碼行數:8,代碼來源:echosrv.go

示例4: ReadField0

func (p *Echo2timesResult) ReadField0(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return fmt.Errorf("error reading field 0: %s", err)
	} else {
		p.Success = &v
	}
	return nil
}
開發者ID:WitzHsiao,項目名稱:ThriftSample,代碼行數:8,代碼來源:echosrv.go

示例5: readField1

func (p *ReadArgs) readField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return fmt.Errorf("error reading field 1: %s")
	} else {
		p.ContactId = v
	}
	return nil
}
開發者ID:charonuguid,項目名稱:phonebook,代碼行數:8,代碼來源:contact_svc.go

示例6: ReadField1

func (p *LogEntry) ReadField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return fmt.Errorf("error reading field 1: %s", err)
	} else {
		p.Hostname = v
	}
	return nil
}
開發者ID:houcy,項目名稱:thriftAndGob,代碼行數:8,代碼來源:ttypes.go

示例7: ReadField3

func (p *RestResponse) ReadField3(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadBinary(); err != nil {
		return fmt.Errorf("error reading field 3: %s", err)
	} else {
		p.Body = v
	}
	return nil
}
開發者ID:fayizk1,項目名稱:gen-go,代碼行數:8,代碼來源:ttypes.go

示例8: ReadField2

func (p *RestRequest) ReadField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return fmt.Errorf("error reading field 2: %s", err)
	} else {
		p.Uri = v
	}
	return nil
}
開發者ID:fayizk1,項目名稱:gen-go,代碼行數:8,代碼來源:ttypes.go

示例9: ReadField1

func (p *RestResponse) ReadField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return fmt.Errorf("error reading field 1: %s", err)
	} else {
		temp := Status(v)
		p.Status = temp
	}
	return nil
}
開發者ID:fayizk1,項目名稱:gen-go,代碼行數:9,代碼來源:ttypes.go

示例10: ReadField0

func (p *LogResult) ReadField0(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return fmt.Errorf("error reading field 0: %s", err)
	} else {
		temp := ResultCode(v)
		p.Success = &temp
	}
	return nil
}
開發者ID:houcy,項目名稱:thriftAndGob,代碼行數:9,代碼來源:proxytrans.go

示例11: writeField1

func (p *ExecuteArgs) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("request", thrift.STRUCT, 1); err != nil {
		return fmt.Errorf("%T write field begin error 1:request: %s", p, err)
	}
	if err := p.Request.Write(oprot); err != nil {
		return fmt.Errorf("%T error writing struct: %s", p.Request, err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return fmt.Errorf("%T write field end error 1:request: %s", p, err)
	}
	return err
}
開發者ID:fayizk1,項目名稱:gen-go,代碼行數:12,代碼來源:rest.go

示例12: writeField1

func (p *CreateArgs) writeField1(oprot thrift.TProtocol) (err error) {
	if p.Contact != nil {
		if err := oprot.WriteFieldBegin("contact", thrift.STRUCT, 1); err != nil {
			return fmt.Errorf("%T write field begin error 1:contact: %s", p, err)
		}
		if err := p.Contact.Write(oprot); err != nil {
			return fmt.Errorf("%T error writing struct: %s", p.Contact)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return fmt.Errorf("%T write field end error 1:contact: %s", p, err)
		}
	}
	return err
}
開發者ID:charonuguid,項目名稱:phonebook,代碼行數:14,代碼來源:contact_svc.go

示例13: writeField0

func (p *CreateResult) writeField0(oprot thrift.TProtocol) (err error) {
	if p.Success != nil {
		if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
			return fmt.Errorf("%T write field begin error 0:success: %s", p, err)
		}
		if err := p.Success.Write(oprot); err != nil {
			return fmt.Errorf("%T error writing struct: %s", p.Success)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return fmt.Errorf("%T write field end error 0:success: %s", p, err)
		}
	}
	return err
}
開發者ID:charonuguid,項目名稱:phonebook,代碼行數:14,代碼來源:contact_svc.go

示例14: Read

func (p *RestRequest) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return fmt.Errorf("%T read error: %s", p, err)
	}
	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if err := p.ReadField1(iprot); err != nil {
				return err
			}
		case 2:
			if err := p.ReadField2(iprot); err != nil {
				return err
			}
		case 3:
			if err := p.ReadField3(iprot); err != nil {
				return err
			}
		case 4:
			if err := p.ReadField4(iprot); err != nil {
				return err
			}
		case 5:
			if err := p.ReadField5(iprot); err != nil {
				return err
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return fmt.Errorf("%T read struct end error: %s", p, err)
	}
	return nil
}
開發者ID:fayizk1,項目名稱:gen-go,代碼行數:47,代碼來源:ttypes.go

示例15: readField0

func (p *FetchResult) readField0(iprot thrift.TProtocol) error {
	_, size, err := iprot.ReadListBegin()
	if err != nil {
		return fmt.Errorf("error reading list being: %s")
	}
	p.Success = make([]*Contact, 0, size)
	for i := 0; i < size; i++ {
		_elem26 := NewContact()
		if err := _elem26.Read(iprot); err != nil {
			return fmt.Errorf("%T error reading struct: %s", _elem26)
		}
		p.Success = append(p.Success, _elem26)
	}
	if err := iprot.ReadListEnd(); err != nil {
		return fmt.Errorf("error reading list end: %s")
	}
	return nil
}
開發者ID:charonuguid,項目名稱:phonebook,代碼行數:18,代碼來源:contact_svc.go


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