sunage001 发表于 2018-9-20 07:18:42

[原]在 go/golang语言中使用 google Protocol Buffer

// Code generated by protoc-gen-go.// source: helloworld.proto// DO NOT EDIT!  package lm
  import proto "code.google.com/p/goprotobuf/proto"
  import json "encoding/json"
  import math "math"
  // Reference proto, json, and math imports to suppress error if they are not otherwise used.
  var _ = proto.Marshal
  var _ = &json.SyntaxError{}
  var _ = math.Inf
  type Helloworld struct {
  Id               *int32`protobuf:"varint,1,req,name=id" json:"id,omitempty"`
  Str            *string `protobuf:"bytes,2,req,name=str" json:"str,omitempty"`
  Opt            *int32`protobuf:"varint,3,opt,name=opt" json:"opt,omitempty"`
  XXX_unrecognized []byte`json:"-"`
  }
  func (this *Helloworld) Reset()         { *this = Helloworld{} }
  func (this *Helloworld) String() string { return proto.CompactTextString(this) }
  func (*Helloworld) ProtoMessage()       {}
  func (this *Helloworld) GetId() int32 {
  if this != nil && this.Id != nil {
  return *this.Id
  }
  return 0
  }
  func (this *Helloworld) GetStr() string {
  if this != nil && this.Str != nil {
  return *this.Str
  }
  return ""
  }
  func (this *Helloworld) GetOpt() int32 {
  if this != nil && this.Opt != nil {
  return *this.Opt
  }
  return 0
  }
  func init() {

页: [1]
查看完整版本: [原]在 go/golang语言中使用 google Protocol Buffer