model.pb.go 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. // Code generated by protoc-gen-gogo. DO NOT EDIT.
  2. // source: model.proto
  3. /*
  4. Package model is a generated protocol buffer package.
  5. It is generated from these files:
  6. model.proto
  7. It has these top-level messages:
  8. Article
  9. */
  10. package testdata
  11. import proto "github.com/golang/protobuf/proto"
  12. import fmt "fmt"
  13. import math "math"
  14. import _ "github.com/gogo/protobuf/gogoproto"
  15. import io "io"
  16. // Reference imports to suppress errors if they are not otherwise used.
  17. var _ = proto.Marshal
  18. var _ = fmt.Errorf
  19. var _ = math.Inf
  20. // This is a compile-time assertion to ensure that this generated file
  21. // is compatible with the proto package it is being compiled against.
  22. // A compilation error at this line likely means your copy of the
  23. // proto package needs to be updated.
  24. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
  25. type Article struct {
  26. ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"id"`
  27. Title string `protobuf:"bytes,3,opt,name=Title,proto3" json:"title"`
  28. }
  29. func (m *Article) Reset() { *m = Article{} }
  30. func (m *Article) String() string { return proto.CompactTextString(m) }
  31. func (*Article) ProtoMessage() {}
  32. func (*Article) Descriptor() ([]byte, []int) { return fileDescriptorModel, []int{0} }
  33. func init() {
  34. proto.RegisterType((*Article)(nil), "model.Article")
  35. }
  36. func (m *Article) Marshal() (dAtA []byte, err error) {
  37. size := m.Size()
  38. dAtA = make([]byte, size)
  39. n, err := m.MarshalTo(dAtA)
  40. if err != nil {
  41. return nil, err
  42. }
  43. return dAtA[:n], nil
  44. }
  45. func (m *Article) MarshalTo(dAtA []byte) (int, error) {
  46. var i int
  47. _ = i
  48. var l int
  49. _ = l
  50. if m.ID != 0 {
  51. dAtA[i] = 0x8
  52. i++
  53. i = encodeVarintModel(dAtA, i, uint64(m.ID))
  54. }
  55. if len(m.Title) > 0 {
  56. dAtA[i] = 0x1a
  57. i++
  58. i = encodeVarintModel(dAtA, i, uint64(len(m.Title)))
  59. i += copy(dAtA[i:], m.Title)
  60. }
  61. return i, nil
  62. }
  63. func encodeVarintModel(dAtA []byte, offset int, v uint64) int {
  64. for v >= 1<<7 {
  65. dAtA[offset] = uint8(v&0x7f | 0x80)
  66. v >>= 7
  67. offset++
  68. }
  69. dAtA[offset] = uint8(v)
  70. return offset + 1
  71. }
  72. func (m *Article) Size() (n int) {
  73. var l int
  74. _ = l
  75. if m.ID != 0 {
  76. n += 1 + sovModel(uint64(m.ID))
  77. }
  78. l = len(m.Title)
  79. if l > 0 {
  80. n += 1 + l + sovModel(uint64(l))
  81. }
  82. return n
  83. }
  84. func sovModel(x uint64) (n int) {
  85. for {
  86. n++
  87. x >>= 7
  88. if x == 0 {
  89. break
  90. }
  91. }
  92. return n
  93. }
  94. func sozModel(x uint64) (n int) {
  95. return sovModel(uint64((x << 1) ^ uint64((int64(x) >> 63))))
  96. }
  97. func (m *Article) Unmarshal(dAtA []byte) error {
  98. l := len(dAtA)
  99. iNdEx := 0
  100. for iNdEx < l {
  101. preIndex := iNdEx
  102. var wire uint64
  103. for shift := uint(0); ; shift += 7 {
  104. if shift >= 64 {
  105. return ErrIntOverflowModel
  106. }
  107. if iNdEx >= l {
  108. return io.ErrUnexpectedEOF
  109. }
  110. b := dAtA[iNdEx]
  111. iNdEx++
  112. wire |= (uint64(b) & 0x7F) << shift
  113. if b < 0x80 {
  114. break
  115. }
  116. }
  117. fieldNum := int32(wire >> 3)
  118. wireType := int(wire & 0x7)
  119. if wireType == 4 {
  120. return fmt.Errorf("proto: Article: wiretype end group for non-group")
  121. }
  122. if fieldNum <= 0 {
  123. return fmt.Errorf("proto: Article: illegal tag %d (wire type %d)", fieldNum, wire)
  124. }
  125. switch fieldNum {
  126. case 1:
  127. if wireType != 0 {
  128. return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
  129. }
  130. m.ID = 0
  131. for shift := uint(0); ; shift += 7 {
  132. if shift >= 64 {
  133. return ErrIntOverflowModel
  134. }
  135. if iNdEx >= l {
  136. return io.ErrUnexpectedEOF
  137. }
  138. b := dAtA[iNdEx]
  139. iNdEx++
  140. m.ID |= (int64(b) & 0x7F) << shift
  141. if b < 0x80 {
  142. break
  143. }
  144. }
  145. case 3:
  146. if wireType != 2 {
  147. return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType)
  148. }
  149. var stringLen uint64
  150. for shift := uint(0); ; shift += 7 {
  151. if shift >= 64 {
  152. return ErrIntOverflowModel
  153. }
  154. if iNdEx >= l {
  155. return io.ErrUnexpectedEOF
  156. }
  157. b := dAtA[iNdEx]
  158. iNdEx++
  159. stringLen |= (uint64(b) & 0x7F) << shift
  160. if b < 0x80 {
  161. break
  162. }
  163. }
  164. intStringLen := int(stringLen)
  165. if intStringLen < 0 {
  166. return ErrInvalidLengthModel
  167. }
  168. postIndex := iNdEx + intStringLen
  169. if postIndex > l {
  170. return io.ErrUnexpectedEOF
  171. }
  172. m.Title = string(dAtA[iNdEx:postIndex])
  173. iNdEx = postIndex
  174. default:
  175. iNdEx = preIndex
  176. skippy, err := skipModel(dAtA[iNdEx:])
  177. if err != nil {
  178. return err
  179. }
  180. if skippy < 0 {
  181. return ErrInvalidLengthModel
  182. }
  183. if (iNdEx + skippy) > l {
  184. return io.ErrUnexpectedEOF
  185. }
  186. iNdEx += skippy
  187. }
  188. }
  189. if iNdEx > l {
  190. return io.ErrUnexpectedEOF
  191. }
  192. return nil
  193. }
  194. func skipModel(dAtA []byte) (n int, err error) {
  195. l := len(dAtA)
  196. iNdEx := 0
  197. for iNdEx < l {
  198. var wire uint64
  199. for shift := uint(0); ; shift += 7 {
  200. if shift >= 64 {
  201. return 0, ErrIntOverflowModel
  202. }
  203. if iNdEx >= l {
  204. return 0, io.ErrUnexpectedEOF
  205. }
  206. b := dAtA[iNdEx]
  207. iNdEx++
  208. wire |= (uint64(b) & 0x7F) << shift
  209. if b < 0x80 {
  210. break
  211. }
  212. }
  213. wireType := int(wire & 0x7)
  214. switch wireType {
  215. case 0:
  216. for shift := uint(0); ; shift += 7 {
  217. if shift >= 64 {
  218. return 0, ErrIntOverflowModel
  219. }
  220. if iNdEx >= l {
  221. return 0, io.ErrUnexpectedEOF
  222. }
  223. iNdEx++
  224. if dAtA[iNdEx-1] < 0x80 {
  225. break
  226. }
  227. }
  228. return iNdEx, nil
  229. case 1:
  230. iNdEx += 8
  231. return iNdEx, nil
  232. case 2:
  233. var length int
  234. for shift := uint(0); ; shift += 7 {
  235. if shift >= 64 {
  236. return 0, ErrIntOverflowModel
  237. }
  238. if iNdEx >= l {
  239. return 0, io.ErrUnexpectedEOF
  240. }
  241. b := dAtA[iNdEx]
  242. iNdEx++
  243. length |= (int(b) & 0x7F) << shift
  244. if b < 0x80 {
  245. break
  246. }
  247. }
  248. iNdEx += length
  249. if length < 0 {
  250. return 0, ErrInvalidLengthModel
  251. }
  252. return iNdEx, nil
  253. case 3:
  254. for {
  255. var innerWire uint64
  256. var start int = iNdEx
  257. for shift := uint(0); ; shift += 7 {
  258. if shift >= 64 {
  259. return 0, ErrIntOverflowModel
  260. }
  261. if iNdEx >= l {
  262. return 0, io.ErrUnexpectedEOF
  263. }
  264. b := dAtA[iNdEx]
  265. iNdEx++
  266. innerWire |= (uint64(b) & 0x7F) << shift
  267. if b < 0x80 {
  268. break
  269. }
  270. }
  271. innerWireType := int(innerWire & 0x7)
  272. if innerWireType == 4 {
  273. break
  274. }
  275. next, err := skipModel(dAtA[start:])
  276. if err != nil {
  277. return 0, err
  278. }
  279. iNdEx = start + next
  280. }
  281. return iNdEx, nil
  282. case 4:
  283. return iNdEx, nil
  284. case 5:
  285. iNdEx += 4
  286. return iNdEx, nil
  287. default:
  288. return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
  289. }
  290. }
  291. panic("unreachable")
  292. }
  293. var (
  294. ErrInvalidLengthModel = fmt.Errorf("proto: negative length found during unmarshaling")
  295. ErrIntOverflowModel = fmt.Errorf("proto: integer overflow")
  296. )
  297. func init() { proto.RegisterFile("model.proto", fileDescriptorModel) }
  298. var fileDescriptorModel = []byte{
  299. // 166 bytes of a gzipped FileDescriptorProto
  300. 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xce, 0xcd, 0x4f, 0x49,
  301. 0xcd, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x05, 0x73, 0xa4, 0x74, 0xd3, 0x33, 0x4b,
  302. 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0xd3, 0xf3, 0xf5, 0xc1, 0xb2, 0x49,
  303. 0xa5, 0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0x74, 0x29, 0x39, 0x71, 0xb1, 0x3b, 0x16, 0x95,
  304. 0x64, 0x26, 0xe7, 0xa4, 0x0a, 0x89, 0x71, 0x31, 0x79, 0xba, 0x48, 0x30, 0x2a, 0x30, 0x6a, 0x30,
  305. 0x3b, 0xb1, 0xbd, 0xba, 0x27, 0xcf, 0x94, 0x99, 0x12, 0xc4, 0xe4, 0xe9, 0x22, 0x24, 0xcf, 0xc5,
  306. 0x1a, 0x92, 0x59, 0x92, 0x93, 0x2a, 0xc1, 0xac, 0xc0, 0xa8, 0xc1, 0xe9, 0xc4, 0xf9, 0xea, 0x9e,
  307. 0x3c, 0x6b, 0x09, 0x48, 0x20, 0x08, 0x22, 0xee, 0x24, 0x71, 0xe2, 0xa1, 0x1c, 0xc3, 0x85, 0x87,
  308. 0x72, 0x0c, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8c,
  309. 0xc7, 0x72, 0x0c, 0x49, 0x6c, 0x60, 0x4b, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x11, 0xa6,
  310. 0xfa, 0x1c, 0xa9, 0x00, 0x00, 0x00,
  311. }