本文整理汇总了Golang中github.com/upfluence/goutils/Godeps/_workspace/src/github.com/upfluence/thrift/lib/go/thrift.TProtocol类的典型用法代码示例。如果您正苦于以下问题:Golang TProtocol类的具体用法?Golang TProtocol怎么用?Golang TProtocol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TProtocol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: writeField0
func (p *BaseServiceGetInterfaceVersionsResult) writeField0(oprot thrift.TProtocol) (err error) {
if p.IsSetSuccess() {
if err := oprot.WriteFieldBegin("success", thrift.MAP, 0); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err)
}
if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRUCT, len(p.Success)); err != nil {
return thrift.PrependError("error writing map begin: ", err)
}
for k, v := range p.Success {
if err := oprot.WriteString(string(k)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err)
}
if err := v.Write(oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
}
}
if err := oprot.WriteMapEnd(); err != nil {
return thrift.PrependError("error writing map end: ", err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err)
}
}
return err
}
开发者ID:upfluence,项目名称:goutils,代码行数:25,代码来源:baseservice.go
示例2: Read
func (p *BaseServiceGetNameResult) 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
}
开发者ID:upfluence,项目名称:goutils,代码行数:32,代码来源:baseservice.go
示例3: ReadField1
func (p *ServiceNotAvailable) ReadField1(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 1: ", err)
} else {
p.Reason = v
}
return nil
}
开发者ID:upfluence,项目名称:goutils,代码行数:8,代码来源:ttypes.go
示例4: ReadField3
func (p *SemanticVersion) ReadField3(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI16(); err != nil {
return thrift.PrependError("error reading field 3: ", err)
} else {
p.Patch = v
}
return nil
}
开发者ID:upfluence,项目名称:goutils,代码行数:8,代码来源:ttypes.go
示例5: ReadField0
func (p *BaseServiceGetNameResult) ReadField0(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 0: ", err)
} else {
p.Success = &v
}
return nil
}
开发者ID:upfluence,项目名称:goutils,代码行数:8,代码来源:baseservice.go
示例6: Read
func (p *SemanticVersion) Read(iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
var issetMajor bool = false
var issetMinor bool = false
var issetPatch 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
}
issetMajor = true
case 2:
if err := p.ReadField2(iprot); err != nil {
return err
}
issetMinor = true
case 3:
if err := p.ReadField3(iprot); err != nil {
return err
}
issetPatch = 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 !issetMajor {
return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Major is not set"))
}
if !issetMinor {
return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Minor is not set"))
}
if !issetPatch {
return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Patch is not set"))
}
return nil
}
开发者ID:upfluence,项目名称:goutils,代码行数:56,代码来源:ttypes.go
示例7: writeField2
func (p *MonitoringCollectResult) writeField2(oprot thrift.TProtocol) (err error) {
if p.IsSetUnknownMetric() {
if err := oprot.WriteFieldBegin("unknownMetric", thrift.STRUCT, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:unknownMetric: ", p), err)
}
if err := p.UnknownMetric.Write(oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.UnknownMetric), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:unknownMetric: ", p), err)
}
}
return err
}
开发者ID:upfluence,项目名称:goutils,代码行数:14,代码来源:monitoring.go
示例8: writeField1
func (p *MonitoringCollectResult) writeField1(oprot thrift.TProtocol) (err error) {
if p.IsSetServiceUnavailable() {
if err := oprot.WriteFieldBegin("serviceUnavailable", thrift.STRUCT, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:serviceUnavailable: ", p), err)
}
if err := p.ServiceUnavailable.Write(oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ServiceUnavailable), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:serviceUnavailable: ", p), err)
}
}
return err
}
开发者ID:upfluence,项目名称:goutils,代码行数:14,代码来源:monitoring.go
示例9: ReadField0
func (p *MonitoringCollectResult) ReadField0(iprot thrift.TProtocol) error {
_, _, size, err := iprot.ReadMapBegin()
if err != nil {
return thrift.PrependError("error reading map begin: ", err)
}
tMap := make(Metrics, size)
p.Success = tMap
for i := 0; i < size; i++ {
var _key5 MetricID
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 0: ", err)
} else {
temp := MetricID(v)
_key5 = temp
}
var _val6 float64
if v, err := iprot.ReadDouble(); err != nil {
return thrift.PrependError("error reading field 0: ", err)
} else {
_val6 = v
}
p.Success[_key5] = _val6
}
if err := iprot.ReadMapEnd(); err != nil {
return thrift.PrependError("error reading map end: ", err)
}
return nil
}
开发者ID:upfluence,项目名称:goutils,代码行数:28,代码来源:monitoring.go
示例10: writeField2
func (p *Version) writeField2(oprot thrift.TProtocol) (err error) {
if p.IsSetGitVersion() {
if err := oprot.WriteFieldBegin("git_version", thrift.STRUCT, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:git_version: ", p), err)
}
if err := p.GitVersion.Write(oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.GitVersion), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:git_version: ", p), err)
}
}
return err
}
开发者ID:upfluence,项目名称:goutils,代码行数:14,代码来源:ttypes.go
示例11: writeField1
func (p *GitVersion) writeField1(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("commit", thrift.STRING, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:commit: ", p), err)
}
if err := oprot.WriteString(string(p.Commit)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.commit (1) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:commit: ", p), err)
}
return err
}
开发者ID:upfluence,项目名称:goutils,代码行数:12,代码来源:ttypes.go
示例12: writeField3
func (p *SemanticVersion) writeField3(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("patch", thrift.I16, 3); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:patch: ", p), err)
}
if err := oprot.WriteI16(int16(p.Patch)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.patch (3) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 3:patch: ", p), err)
}
return err
}
开发者ID:upfluence,项目名称:goutils,代码行数:12,代码来源:ttypes.go
示例13: Write
func (p *BaseServiceGetVersionArgs) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("getVersion_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
}
开发者ID:upfluence,项目名称:goutils,代码行数:12,代码来源:baseservice.go
示例14: Write
func (p *MonitoringCollectArgs) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("collect_args"); 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 := 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
}
开发者ID:upfluence,项目名称:goutils,代码行数:15,代码来源:monitoring.go
示例15: Write
func (p *UnknownMetric) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("UnknownMetric"); 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 := 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
}
开发者ID:upfluence,项目名称:goutils,代码行数:15,代码来源:ttypes.go
注:本文中的github.com/upfluence/goutils/Godeps/_workspace/src/github.com/upfluence/thrift/lib/go/thrift.TProtocol类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论