test.pb.go 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. // Code generated by protoc-gen-gogo. DO NOT EDIT.
  2. // source: test.proto
  3. /*
  4. Package proto is a generated protocol buffer package.
  5. It is generated from these files:
  6. test.proto
  7. It has these top-level messages:
  8. TestItem
  9. */
  10. package proto
  11. import proto1 "github.com/golang/protobuf/proto"
  12. import fmt "fmt"
  13. import math "math"
  14. import io "io"
  15. // Reference imports to suppress errors if they are not otherwise used.
  16. var _ = proto1.Marshal
  17. var _ = fmt.Errorf
  18. var _ = math.Inf
  19. // This is a compile-time assertion to ensure that this generated file
  20. // is compatible with the proto package it is being compiled against.
  21. // A compilation error at this line likely means your copy of the
  22. // proto package needs to be updated.
  23. const _ = proto1.ProtoPackageIsVersion2 // please upgrade the proto package
  24. type FOO int32
  25. const (
  26. FOO_X FOO = 0
  27. )
  28. var FOO_name = map[int32]string{
  29. 0: "X",
  30. }
  31. var FOO_value = map[string]int32{
  32. "X": 0,
  33. }
  34. func (x FOO) String() string {
  35. return proto1.EnumName(FOO_name, int32(x))
  36. }
  37. func (FOO) EnumDescriptor() ([]byte, []int) { return fileDescriptorTest, []int{0} }
  38. type TestItem struct {
  39. Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"`
  40. Age int32 `protobuf:"varint,2,opt,name=Age,proto3" json:"Age,omitempty"`
  41. }
  42. func (m *TestItem) Reset() { *m = TestItem{} }
  43. func (m *TestItem) String() string { return proto1.CompactTextString(m) }
  44. func (*TestItem) ProtoMessage() {}
  45. func (*TestItem) Descriptor() ([]byte, []int) { return fileDescriptorTest, []int{0} }
  46. func (m *TestItem) GetName() string {
  47. if m != nil {
  48. return m.Name
  49. }
  50. return ""
  51. }
  52. func (m *TestItem) GetAge() int32 {
  53. if m != nil {
  54. return m.Age
  55. }
  56. return 0
  57. }
  58. func init() {
  59. proto1.RegisterType((*TestItem)(nil), "proto.TestItem")
  60. proto1.RegisterEnum("proto.FOO", FOO_name, FOO_value)
  61. }
  62. func (m *TestItem) Marshal() (dAtA []byte, err error) {
  63. size := m.Size()
  64. dAtA = make([]byte, size)
  65. n, err := m.MarshalTo(dAtA)
  66. if err != nil {
  67. return nil, err
  68. }
  69. return dAtA[:n], nil
  70. }
  71. func (m *TestItem) MarshalTo(dAtA []byte) (int, error) {
  72. var i int
  73. _ = i
  74. var l int
  75. _ = l
  76. if len(m.Name) > 0 {
  77. dAtA[i] = 0xa
  78. i++
  79. i = encodeVarintTest(dAtA, i, uint64(len(m.Name)))
  80. i += copy(dAtA[i:], m.Name)
  81. }
  82. if m.Age != 0 {
  83. dAtA[i] = 0x10
  84. i++
  85. i = encodeVarintTest(dAtA, i, uint64(m.Age))
  86. }
  87. return i, nil
  88. }
  89. func encodeFixed64Test(dAtA []byte, offset int, v uint64) int {
  90. dAtA[offset] = uint8(v)
  91. dAtA[offset+1] = uint8(v >> 8)
  92. dAtA[offset+2] = uint8(v >> 16)
  93. dAtA[offset+3] = uint8(v >> 24)
  94. dAtA[offset+4] = uint8(v >> 32)
  95. dAtA[offset+5] = uint8(v >> 40)
  96. dAtA[offset+6] = uint8(v >> 48)
  97. dAtA[offset+7] = uint8(v >> 56)
  98. return offset + 8
  99. }
  100. func encodeFixed32Test(dAtA []byte, offset int, v uint32) int {
  101. dAtA[offset] = uint8(v)
  102. dAtA[offset+1] = uint8(v >> 8)
  103. dAtA[offset+2] = uint8(v >> 16)
  104. dAtA[offset+3] = uint8(v >> 24)
  105. return offset + 4
  106. }
  107. func encodeVarintTest(dAtA []byte, offset int, v uint64) int {
  108. for v >= 1<<7 {
  109. dAtA[offset] = uint8(v&0x7f | 0x80)
  110. v >>= 7
  111. offset++
  112. }
  113. dAtA[offset] = uint8(v)
  114. return offset + 1
  115. }
  116. func (m *TestItem) Size() (n int) {
  117. var l int
  118. _ = l
  119. l = len(m.Name)
  120. if l > 0 {
  121. n += 1 + l + sovTest(uint64(l))
  122. }
  123. if m.Age != 0 {
  124. n += 1 + sovTest(uint64(m.Age))
  125. }
  126. return n
  127. }
  128. func sovTest(x uint64) (n int) {
  129. for {
  130. n++
  131. x >>= 7
  132. if x == 0 {
  133. break
  134. }
  135. }
  136. return n
  137. }
  138. func sozTest(x uint64) (n int) {
  139. return sovTest(uint64((x << 1) ^ uint64((int64(x) >> 63))))
  140. }
  141. func (m *TestItem) Unmarshal(dAtA []byte) error {
  142. l := len(dAtA)
  143. iNdEx := 0
  144. for iNdEx < l {
  145. preIndex := iNdEx
  146. var wire uint64
  147. for shift := uint(0); ; shift += 7 {
  148. if shift >= 64 {
  149. return ErrIntOverflowTest
  150. }
  151. if iNdEx >= l {
  152. return io.ErrUnexpectedEOF
  153. }
  154. b := dAtA[iNdEx]
  155. iNdEx++
  156. wire |= (uint64(b) & 0x7F) << shift
  157. if b < 0x80 {
  158. break
  159. }
  160. }
  161. fieldNum := int32(wire >> 3)
  162. wireType := int(wire & 0x7)
  163. if wireType == 4 {
  164. return fmt.Errorf("proto: TestItem: wiretype end group for non-group")
  165. }
  166. if fieldNum <= 0 {
  167. return fmt.Errorf("proto: TestItem: illegal tag %d (wire type %d)", fieldNum, wire)
  168. }
  169. switch fieldNum {
  170. case 1:
  171. if wireType != 2 {
  172. return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
  173. }
  174. var stringLen uint64
  175. for shift := uint(0); ; shift += 7 {
  176. if shift >= 64 {
  177. return ErrIntOverflowTest
  178. }
  179. if iNdEx >= l {
  180. return io.ErrUnexpectedEOF
  181. }
  182. b := dAtA[iNdEx]
  183. iNdEx++
  184. stringLen |= (uint64(b) & 0x7F) << shift
  185. if b < 0x80 {
  186. break
  187. }
  188. }
  189. intStringLen := int(stringLen)
  190. if intStringLen < 0 {
  191. return ErrInvalidLengthTest
  192. }
  193. postIndex := iNdEx + intStringLen
  194. if postIndex > l {
  195. return io.ErrUnexpectedEOF
  196. }
  197. m.Name = string(dAtA[iNdEx:postIndex])
  198. iNdEx = postIndex
  199. case 2:
  200. if wireType != 0 {
  201. return fmt.Errorf("proto: wrong wireType = %d for field Age", wireType)
  202. }
  203. m.Age = 0
  204. for shift := uint(0); ; shift += 7 {
  205. if shift >= 64 {
  206. return ErrIntOverflowTest
  207. }
  208. if iNdEx >= l {
  209. return io.ErrUnexpectedEOF
  210. }
  211. b := dAtA[iNdEx]
  212. iNdEx++
  213. m.Age |= (int32(b) & 0x7F) << shift
  214. if b < 0x80 {
  215. break
  216. }
  217. }
  218. default:
  219. iNdEx = preIndex
  220. skippy, err := skipTest(dAtA[iNdEx:])
  221. if err != nil {
  222. return err
  223. }
  224. if skippy < 0 {
  225. return ErrInvalidLengthTest
  226. }
  227. if (iNdEx + skippy) > l {
  228. return io.ErrUnexpectedEOF
  229. }
  230. iNdEx += skippy
  231. }
  232. }
  233. if iNdEx > l {
  234. return io.ErrUnexpectedEOF
  235. }
  236. return nil
  237. }
  238. func skipTest(dAtA []byte) (n int, err error) {
  239. l := len(dAtA)
  240. iNdEx := 0
  241. for iNdEx < l {
  242. var wire uint64
  243. for shift := uint(0); ; shift += 7 {
  244. if shift >= 64 {
  245. return 0, ErrIntOverflowTest
  246. }
  247. if iNdEx >= l {
  248. return 0, io.ErrUnexpectedEOF
  249. }
  250. b := dAtA[iNdEx]
  251. iNdEx++
  252. wire |= (uint64(b) & 0x7F) << shift
  253. if b < 0x80 {
  254. break
  255. }
  256. }
  257. wireType := int(wire & 0x7)
  258. switch wireType {
  259. case 0:
  260. for shift := uint(0); ; shift += 7 {
  261. if shift >= 64 {
  262. return 0, ErrIntOverflowTest
  263. }
  264. if iNdEx >= l {
  265. return 0, io.ErrUnexpectedEOF
  266. }
  267. iNdEx++
  268. if dAtA[iNdEx-1] < 0x80 {
  269. break
  270. }
  271. }
  272. return iNdEx, nil
  273. case 1:
  274. iNdEx += 8
  275. return iNdEx, nil
  276. case 2:
  277. var length int
  278. for shift := uint(0); ; shift += 7 {
  279. if shift >= 64 {
  280. return 0, ErrIntOverflowTest
  281. }
  282. if iNdEx >= l {
  283. return 0, io.ErrUnexpectedEOF
  284. }
  285. b := dAtA[iNdEx]
  286. iNdEx++
  287. length |= (int(b) & 0x7F) << shift
  288. if b < 0x80 {
  289. break
  290. }
  291. }
  292. iNdEx += length
  293. if length < 0 {
  294. return 0, ErrInvalidLengthTest
  295. }
  296. return iNdEx, nil
  297. case 3:
  298. for {
  299. var innerWire uint64
  300. var start int = iNdEx
  301. for shift := uint(0); ; shift += 7 {
  302. if shift >= 64 {
  303. return 0, ErrIntOverflowTest
  304. }
  305. if iNdEx >= l {
  306. return 0, io.ErrUnexpectedEOF
  307. }
  308. b := dAtA[iNdEx]
  309. iNdEx++
  310. innerWire |= (uint64(b) & 0x7F) << shift
  311. if b < 0x80 {
  312. break
  313. }
  314. }
  315. innerWireType := int(innerWire & 0x7)
  316. if innerWireType == 4 {
  317. break
  318. }
  319. next, err := skipTest(dAtA[start:])
  320. if err != nil {
  321. return 0, err
  322. }
  323. iNdEx = start + next
  324. }
  325. return iNdEx, nil
  326. case 4:
  327. return iNdEx, nil
  328. case 5:
  329. iNdEx += 4
  330. return iNdEx, nil
  331. default:
  332. return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
  333. }
  334. }
  335. panic("unreachable")
  336. }
  337. var (
  338. ErrInvalidLengthTest = fmt.Errorf("proto: negative length found during unmarshaling")
  339. ErrIntOverflowTest = fmt.Errorf("proto: integer overflow")
  340. )
  341. func init() { proto1.RegisterFile("test.proto", fileDescriptorTest) }
  342. var fileDescriptorTest = []byte{
  343. // 122 bytes of a gzipped FileDescriptorProto
  344. 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0x49, 0x2d, 0x2e,
  345. 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x05, 0x53, 0x4a, 0x06, 0x5c, 0x1c, 0x21, 0xa9,
  346. 0xc5, 0x25, 0x9e, 0x25, 0xa9, 0xb9, 0x42, 0x42, 0x5c, 0x2c, 0x7e, 0x89, 0xb9, 0xa9, 0x12, 0x8c,
  347. 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x60, 0xb6, 0x90, 0x00, 0x17, 0xb3, 0x63, 0x7a, 0xaa, 0x04, 0x93,
  348. 0x02, 0xa3, 0x06, 0x6b, 0x10, 0x88, 0xa9, 0xc5, 0xc3, 0xc5, 0xec, 0xe6, 0xef, 0x2f, 0xc4, 0xca,
  349. 0xc5, 0x18, 0x21, 0xc0, 0xe0, 0x24, 0x70, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f,
  350. 0x1e, 0xc9, 0x31, 0xce, 0x78, 0x2c, 0xc7, 0x90, 0xc4, 0x06, 0x36, 0xd8, 0x18, 0x10, 0x00, 0x00,
  351. 0xff, 0xff, 0x16, 0x80, 0x60, 0x15, 0x6d, 0x00, 0x00, 0x00,
  352. }