/
outer_fast.pb.go
175 lines (166 loc) · 4.12 KB
/
outer_fast.pb.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
// Code generated by protoc-gen-go-fast. DO NOT EDIT.
// versions:
// protoc-gen-go-fast v0.0.1
// protoc v3.15.8
// source: test/outer.proto
package pb
import (
fmt "fmt"
fastproto "github.com/billyplus/fastproto"
protohelper "github.com/billyplus/fastproto/protohelper"
protowire "google.golang.org/protobuf/encoding/protowire"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
math "math"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the packages it is being compiled against.
var _ = fmt.Errorf
var _ = math.MaxFloat32
var _ = protowire.MinValidNumber
var _ = protohelper.Skip
var _ = protoimpl.MinVersion
func (x *OuterMsg) XxxReset() {
*x = OuterMsg{}
}
func (x *OuterMsg) Unmarshal(data []byte) error {
for len(data) > 0 {
num, wireType, n := protowire.ConsumeTag(data)
if n < 0 {
return protowire.ParseError(n)
}
if num <= 0 {
return fmt.Errorf("proto: OuterMsg: illegal tag %d (wire type %d)", num, wireType)
}
data = data[n:]
switch num {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Eid", wireType)
}
v, n := protowire.ConsumeVarint(data)
if n < 0 {
return protowire.ParseError(n)
}
data = data[n:]
x.Eid = int64(v)
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OpenId", wireType)
}
v, n := protowire.ConsumeBytes(data)
if n < 0 {
return protowire.ParseError(n)
}
data = data[n:]
x.OpenId = string(v)
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
}
v, n := protowire.ConsumeBytes(data)
if n < 0 {
return protowire.ParseError(n)
}
data = data[n:]
x.Name = string(v)
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Job", wireType)
}
v, n := protowire.ConsumeVarint(data)
if n < 0 {
return protowire.ParseError(n)
}
data = data[n:]
x.Job = int32(v)
case 5:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Sex", wireType)
}
v, n := protowire.ConsumeVarint(data)
if n < 0 {
return protowire.ParseError(n)
}
data = data[n:]
x.Sex = int32(v)
default:
_, n = protowire.ConsumeBytes(data)
if n < 0 {
return protowire.ParseError(n)
}
x.unknownFields = append(x.unknownFields, data[:n]...)
data = data[n:]
}
}
return nil
}
func (x *OuterMsg) MarshalTo(data []byte) (n int, err error) {
maxN := cap(data)
data, err = x.AppendToSizedBuffer(data[:0])
if maxN < len(data) {
return 0, fmt.Errorf("Not enough space for message(OuterMsg)")
}
return len(data), nil
}
func (x *OuterMsg) Marshal() ([]byte, error) {
data := make([]byte, 0, fastproto.Size(x))
data, err := x.AppendToSizedBuffer(data)
if err != nil {
return nil, err
}
return data, nil
}
func (x *OuterMsg) AppendToSizedBuffer(data []byte) (ret []byte, err error) {
if x.Eid != 0 {
data = protowire.AppendVarint(data, 8)
data = protowire.AppendVarint(data, uint64(x.Eid))
}
if len(x.OpenId) > 0 {
data = protowire.AppendVarint(data, 18)
data = protowire.AppendVarint(data, uint64(len(x.OpenId)))
data = append(data, x.OpenId...)
}
if len(x.Name) > 0 {
data = protowire.AppendVarint(data, 26)
data = protowire.AppendVarint(data, uint64(len(x.Name)))
data = append(data, x.Name...)
}
if x.Job != 0 {
data = protowire.AppendVarint(data, 32)
data = protowire.AppendVarint(data, uint64(x.Job))
}
if x.Sex != 0 {
data = protowire.AppendVarint(data, 40)
data = protowire.AppendVarint(data, uint64(x.Sex))
}
return data, nil
}
func (x *OuterMsg) Size() (n int) {
if x == nil {
return 0
}
var l int
_ = l
if x.Eid != 0 {
n += 1 + protowire.SizeVarint(uint64(x.Eid))
}
l = len(x.OpenId)
if l > 0 {
n += 1 + protowire.SizeBytes(l)
}
l = len(x.Name)
if l > 0 {
n += 1 + protowire.SizeBytes(l)
}
if x.Job != 0 {
n += 1 + protowire.SizeVarint(uint64(x.Job))
}
if x.Sex != 0 {
n += 1 + protowire.SizeVarint(uint64(x.Sex))
}
if x.unknownFields != nil {
n += len(x.unknownFields)
}
x.sizeCache = int32(n)
return
}