本文整理匯總了Golang中github.com/apache/thrift/lib/go/thrift.PrependError函數的典型用法代碼示例。如果您正苦於以下問題:Golang PrependError函數的具體用法?Golang PrependError怎麽用?Golang PrependError使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了PrependError函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Write
func (p *BinaryAnnotation) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("BinaryAnnotation"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", 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 := p.writeField6(oprot); err != nil {
return err
}
if err := p.writeField7(oprot); err != nil {
return err
}
if err := oprot.WriteFieldStop(); err != nil {
return thrift.PrependError("write field stop error: ", err)
}
if err := oprot.WriteStructEnd(); err != nil {
return thrift.PrependError("write struct stop error: ", err)
}
return nil
}
示例2: Read
func (p *AccountDoActionArgs) Read(iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
if err != nil {
return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
}
if fieldTypeId == thrift.STOP {
break
}
switch fieldId {
case 1:
if err := p.readField1(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 thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}
return nil
}
示例3: Read
func (p *NotAuthorized) Read(iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
if err != nil {
return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
}
if fieldTypeId == thrift.STOP {
break
}
if err := iprot.Skip(fieldTypeId); err != nil {
return err
}
if err := iprot.ReadFieldEnd(); err != nil {
return err
}
}
if err := iprot.ReadStructEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}
return nil
}
示例4: readField1
func (p *ThriftIDLs) readField1(iprot thrift.TProtocol) error {
_, _, size, err := iprot.ReadMapBegin()
if err != nil {
return thrift.PrependError("error reading map begin: ", err)
}
tMap := make(map[Filename]string, size)
p.Idls = tMap
for i := 0; i < size; i++ {
var _key0 Filename
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 0: ", err)
} else {
temp := Filename(v)
_key0 = temp
}
var _val1 string
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 0: ", err)
} else {
_val1 = v
}
p.Idls[_key0] = _val1
}
if err := iprot.ReadMapEnd(); err != nil {
return thrift.PrependError("error reading map end: ", err)
}
return nil
}
示例5: Read
func (p *Span) Read(iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
if err != nil {
return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", 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
}
case 6:
if err := p.readField6(iprot); err != nil {
return err
}
case 7:
if err := p.readField7(iprot); err != nil {
return err
}
case 8:
if err := p.readField8(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 thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}
return nil
}
示例6: Read
func (p *FirstHealthcheckResult) Read(iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
if err != nil {
return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", 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 thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}
return nil
}
示例7: ReadField3
func (p *Spec) ReadField3(iprot thrift.TProtocol) error {
_, _, size, err := iprot.ReadMapBegin()
if err != nil {
return thrift.PrependError("error reading map begin: ", err)
}
tMap := make(map[string]ID, size)
p.Blobs = tMap
for i := 0; i < size; i++ {
var _key2 string
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 0: ", err)
} else {
_key2 = v
}
var _val3 ID
if v, err := iprot.ReadBinary(); err != nil {
return thrift.PrependError("error reading field 0: ", err)
} else {
temp := ID(v)
_val3 = temp
}
p.Blobs[_key2] = _val3
}
if err := iprot.ReadMapEnd(); err != nil {
return thrift.PrependError("error reading map end: ", err)
}
return nil
}
示例8: Read
func (p *VersionInfo) Read(iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
var issetLanguage bool = false
var issetLanguageVersion bool = false
var issetVersion bool = false
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
if err != nil {
return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
}
if fieldTypeId == thrift.STOP {
break
}
switch fieldId {
case 1:
if err := p.readField1(iprot); err != nil {
return err
}
issetLanguage = true
case 2:
if err := p.readField2(iprot); err != nil {
return err
}
issetLanguageVersion = true
case 3:
if err := p.readField3(iprot); err != nil {
return err
}
issetVersion = true
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 thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}
if !issetLanguage {
return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Language is not set"))
}
if !issetLanguageVersion {
return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field LanguageVersion is not set"))
}
if !issetVersion {
return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Version is not set"))
}
return nil
}
示例9: writeField1
func (p *SimpleErr) writeField1(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("message", thrift.STRING, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:message: ", p), err)
}
if err := oprot.WriteString(string(p.Message)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.message (1) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:message: ", p), err)
}
return err
}
示例10: writeField1
func (p *KeyNotFound) writeField1(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("key", thrift.STRING, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err)
}
if err := oprot.WriteString(string(p.Key)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.key (1) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err)
}
return err
}
示例11: writeField1
func (p *HealthStatus) writeField1(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("ok", thrift.BOOL, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ok: ", p), err)
}
if err := oprot.WriteBool(bool(p.Ok)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.ok (1) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ok: ", p), err)
}
return err
}
示例12: Write
func (p *SecondServiceBlahBlahArgs) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("blahBlah_args"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
}
if err := oprot.WriteFieldStop(); err != nil {
return thrift.PrependError("write field stop error: ", err)
}
if err := oprot.WriteStructEnd(); err != nil {
return thrift.PrependError("write struct stop error: ", err)
}
return nil
}
示例13: Write
func (p *NotAuthorized) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("NotAuthorized"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
}
if err := oprot.WriteFieldStop(); err != nil {
return thrift.PrependError("write field stop error: ", err)
}
if err := oprot.WriteStructEnd(); err != nil {
return thrift.PrependError("write struct stop error: ", err)
}
return nil
}
示例14: Write
func (p *FirstAppErrorResult) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("AppError_result"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
}
if err := oprot.WriteFieldStop(); err != nil {
return thrift.PrependError("write field stop error: ", err)
}
if err := oprot.WriteStructEnd(); err != nil {
return thrift.PrependError("write struct stop error: ", err)
}
return nil
}
示例15: Write
func (p *MetaVersionInfoArgs) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("versionInfo_args"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
}
if err := oprot.WriteFieldStop(); err != nil {
return thrift.PrependError("write field stop error: ", err)
}
if err := oprot.WriteStructEnd(); err != nil {
return thrift.PrependError("write struct stop error: ", err)
}
return nil
}