本文整理汇总了Golang中git-wip-us/apache/org/repos/asf/thrift/git/lib/go/thrift.TProtocol类的典型用法代码示例。如果您正苦于以下问题:Golang TProtocol类的具体用法?Golang TProtocol怎么用?Golang TProtocol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TProtocol类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: ReadField1
func (p *LogArgs) ReadField1(iprot thrift.TProtocol) error {
_, size, err := iprot.ReadListBegin()
if err != nil {
return fmt.Errorf("error reading list begin: %s", err)
}
tSlice := make([]*LogEntry, 0, size)
p.Messages = tSlice
for i := 0; i < size; i++ {
_elem4 := &LogEntry{}
if err := _elem4.Read(iprot); err != nil {
return fmt.Errorf("%T error reading struct: %s", _elem4, err)
}
p.Messages = append(p.Messages, _elem4)
}
if err := iprot.ReadListEnd(); err != nil {
return fmt.Errorf("error reading list end: %s", err)
}
return nil
}
开发者ID:houcy,项目名称:thriftAndGob,代码行数:19,代码来源:proxytrans.go
示例17: Write
func (p *RestRequest) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("RestRequest"); err != nil {
return fmt.Errorf("%T write struct begin error: %s", p, err)
}
if err := p.writeField1(oprot); err != nil {
return err
}
if err := p.writeField2(oprot); err != nil {
return err
}
if err := p.writeField3(oprot); err != nil {
return err
}
if err := p.writeField4(oprot); err != nil {
return err
}
if err := p.writeField5(oprot); err != nil {
return err
}
if err := oprot.WriteFieldStop(); err != nil {
return fmt.Errorf("write field stop error: %s", err)
}
if err := oprot.WriteStructEnd(); err != nil {
return fmt.Errorf("write struct stop error: %s", err)
}
return nil
}
开发者ID:fayizk1,项目名称:gen-go,代码行数:27,代码来源:ttypes.go
示例18: 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
示例19: 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
示例20: 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
注:本文中的git-wip-us/apache/org/repos/asf/thrift/git/lib/go/thrift.TProtocol类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论