Skip to content

Commit cb22f23

Browse files
committed
types: fix gojay method reciever name
1 parent b6c8d2c commit cb22f23

File tree

1 file changed

+66
-66
lines changed

1 file changed

+66
-66
lines changed

types_gojay.go

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -57,147 +57,147 @@ var _ json.Marshaler = (*RawMessage)(nil)
5757
var _ json.Unmarshaler = (*RawMessage)(nil)
5858

5959
// UnmarshalJSONObject implements gojay's UnmarshalerJSONObject
60-
func (v *wireRequest) UnmarshalJSONObject(dec *gojay.Decoder, k string) error {
60+
func (r *wireRequest) UnmarshalJSONObject(dec *gojay.Decoder, k string) error {
6161
switch k {
6262
case keyJSONRPC:
63-
return dec.String(&v.JSONRPC)
63+
return dec.String(&r.JSONRPC)
6464
case keyID:
65-
s := v.ID.String()
65+
s := r.ID.String()
6666
return dec.String(&s)
6767
case keyMethod:
68-
return dec.String(&v.Method)
68+
return dec.String(&r.Method)
6969
case keyParams:
70-
if v.Params == nil {
71-
v.Params = &json.RawMessage{}
70+
if r.Params == nil {
71+
r.Params = &json.RawMessage{}
7272
}
73-
return dec.EmbeddedJSON((*gojay.EmbeddedJSON)(v.Params))
73+
return dec.EmbeddedJSON((*gojay.EmbeddedJSON)(r.Params))
7474
}
7575
return nil
7676
}
7777

7878
// NKeys returns the number of keys to unmarshal
79-
func (v *wireRequest) NKeys() int { return 4 }
79+
func (r *wireRequest) NKeys() int { return 4 }
8080

8181
// MarshalJSONObject implements gojay's MarshalerJSONObject
82-
func (v *wireRequest) MarshalJSONObject(enc *gojay.Encoder) {
83-
enc.StringKey(keyJSONRPC, v.JSONRPC)
84-
enc.StringKey(keyID, v.ID.String())
85-
enc.StringKey(keyMethod, v.Method)
86-
enc.AddEmbeddedJSONKeyOmitEmpty(keyParams, (*gojay.EmbeddedJSON)(v.Params))
82+
func (r *wireRequest) MarshalJSONObject(enc *gojay.Encoder) {
83+
enc.StringKey(keyJSONRPC, r.JSONRPC)
84+
enc.StringKey(keyID, r.ID.String())
85+
enc.StringKey(keyMethod, r.Method)
86+
enc.AddEmbeddedJSONKeyOmitEmpty(keyParams, (*gojay.EmbeddedJSON)(r.Params))
8787
}
8888

8989
// IsNil returns wether the structure is nil value or not
90-
func (v *wireRequest) IsNil() bool { return v == nil }
90+
func (r *wireRequest) IsNil() bool { return r == nil }
9191

9292
// UnmarshalJSONObject implements gojay's UnmarshalerJSONObject
93-
func (v *wireResponse) UnmarshalJSONObject(dec *gojay.Decoder, k string) error {
93+
func (r *wireResponse) UnmarshalJSONObject(dec *gojay.Decoder, k string) error {
9494
switch k {
9595
case keyJSONRPC:
96-
return dec.String(&v.JSONRPC)
96+
return dec.String(&r.JSONRPC)
9797
case keyID:
98-
s := v.ID.String()
98+
s := r.ID.String()
9999
return dec.String(&s)
100100
case keyError:
101-
if v.Error == nil {
102-
v.Error = &Error{}
101+
if r.Error == nil {
102+
r.Error = &Error{}
103103
}
104-
return dec.Object(v.Error)
104+
return dec.Object(r.Error)
105105
case keyResult:
106-
if v.Result == nil {
107-
v.Result = &json.RawMessage{}
106+
if r.Result == nil {
107+
r.Result = &json.RawMessage{}
108108
}
109-
return dec.EmbeddedJSON((*gojay.EmbeddedJSON)(v.Result))
109+
return dec.EmbeddedJSON((*gojay.EmbeddedJSON)(r.Result))
110110
}
111111
return nil
112112
}
113113

114114
// NKeys returns the number of keys to unmarshal
115-
func (v *wireResponse) NKeys() int { return 4 }
115+
func (r *wireResponse) NKeys() int { return 4 }
116116

117117
// MarshalJSONObject implements gojay's MarshalerJSONObject
118-
func (v *wireResponse) MarshalJSONObject(enc *gojay.Encoder) {
119-
enc.StringKey(keyJSONRPC, v.JSONRPC)
120-
enc.StringKey(keyID, v.ID.String())
121-
enc.ObjectKeyOmitEmpty(keyError, v.Error)
122-
enc.AddEmbeddedJSONKeyOmitEmpty(keyResult, (*gojay.EmbeddedJSON)(v.Result))
118+
func (r *wireResponse) MarshalJSONObject(enc *gojay.Encoder) {
119+
enc.StringKey(keyJSONRPC, r.JSONRPC)
120+
enc.StringKey(keyID, r.ID.String())
121+
enc.ObjectKeyOmitEmpty(keyError, r.Error)
122+
enc.AddEmbeddedJSONKeyOmitEmpty(keyResult, (*gojay.EmbeddedJSON)(r.Result))
123123
}
124124

125125
// IsNil returns wether the structure is nil value or not
126-
func (v *wireResponse) IsNil() bool { return v == nil }
126+
func (r *wireResponse) IsNil() bool { return r == nil }
127127

128128
// UnmarshalJSONObject implements gojay's UnmarshalerJSONObject
129-
func (v *Combined) UnmarshalJSONObject(dec *gojay.Decoder, k string) error {
129+
func (r *Combined) UnmarshalJSONObject(dec *gojay.Decoder, k string) error {
130130
switch k {
131131
case keyJSONRPC:
132-
return dec.String(&v.JSONRPC)
132+
return dec.String(&r.JSONRPC)
133133
case keyID:
134-
if v.ID == nil {
135-
v.ID = &ID{}
134+
if r.ID == nil {
135+
r.ID = &ID{}
136136
}
137-
s := v.ID.String()
137+
s := r.ID.String()
138138
return dec.String(&s)
139139
case keyMethod:
140-
return dec.String(&v.Method)
140+
return dec.String(&r.Method)
141141
case keyParams:
142-
if v.Params == nil {
143-
v.Params = &json.RawMessage{}
142+
if r.Params == nil {
143+
r.Params = &json.RawMessage{}
144144
}
145-
return dec.EmbeddedJSON((*gojay.EmbeddedJSON)(v.Params))
145+
return dec.EmbeddedJSON((*gojay.EmbeddedJSON)(r.Params))
146146
case keyError:
147-
if v.Error == nil {
148-
v.Error = &Error{}
147+
if r.Error == nil {
148+
r.Error = &Error{}
149149
}
150-
return dec.Object(v.Error)
150+
return dec.Object(r.Error)
151151
case keyResult:
152-
if v.Result == nil {
153-
v.Result = &json.RawMessage{}
152+
if r.Result == nil {
153+
r.Result = &json.RawMessage{}
154154
}
155-
return dec.EmbeddedJSON((*gojay.EmbeddedJSON)(v.Result))
155+
return dec.EmbeddedJSON((*gojay.EmbeddedJSON)(r.Result))
156156
}
157157
return nil
158158
}
159159

160160
// NKeys returns the number of keys to unmarshal
161-
func (v *Combined) NKeys() int { return 6 }
161+
func (r *Combined) NKeys() int { return 6 }
162162

163163
// MarshalJSONObject implements gojay's MarshalerJSONObject
164-
func (v *Combined) MarshalJSONObject(enc *gojay.Encoder) {
165-
enc.StringKey(keyJSONRPC, v.JSONRPC)
166-
enc.StringKeyOmitEmpty(keyID, v.ID.String())
167-
enc.StringKey(keyMethod, v.Method)
168-
enc.AddEmbeddedJSONKeyOmitEmpty(keyParams, (*gojay.EmbeddedJSON)(v.Params))
169-
enc.ObjectKeyOmitEmpty(keyError, v.Error)
170-
enc.AddEmbeddedJSONKeyOmitEmpty(keyResult, (*gojay.EmbeddedJSON)(v.Result))
164+
func (r *Combined) MarshalJSONObject(enc *gojay.Encoder) {
165+
enc.StringKey(keyJSONRPC, r.JSONRPC)
166+
enc.StringKeyOmitEmpty(keyID, r.ID.String())
167+
enc.StringKey(keyMethod, r.Method)
168+
enc.AddEmbeddedJSONKeyOmitEmpty(keyParams, (*gojay.EmbeddedJSON)(r.Params))
169+
enc.ObjectKeyOmitEmpty(keyError, r.Error)
170+
enc.AddEmbeddedJSONKeyOmitEmpty(keyResult, (*gojay.EmbeddedJSON)(r.Result))
171171
}
172172

173173
// IsNil returns wether the structure is nil value or not
174-
func (v *Combined) IsNil() bool { return v == nil }
174+
func (r *Combined) IsNil() bool { return r == nil }
175175

176176
// UnmarshalJSONObject implements gojay's UnmarshalerJSONObject
177-
func (v *NotificationMessage) UnmarshalJSONObject(dec *gojay.Decoder, k string) error {
177+
func (m *NotificationMessage) UnmarshalJSONObject(dec *gojay.Decoder, k string) error {
178178
switch k {
179179
case keyJSONRPC:
180-
return dec.String(&v.JSONRPC)
180+
return dec.String(&m.JSONRPC)
181181
case keyMethod:
182-
return dec.String(&v.Method)
182+
return dec.String(&m.Method)
183183
case keyParams:
184-
if v.Params == nil {
185-
v.Params = &json.RawMessage{}
184+
if m.Params == nil {
185+
m.Params = &json.RawMessage{}
186186
}
187-
return dec.EmbeddedJSON((*gojay.EmbeddedJSON)(v.Params))
187+
return dec.EmbeddedJSON((*gojay.EmbeddedJSON)(m.Params))
188188
}
189189
return nil
190190
}
191191

192192
// NKeys returns the number of keys to unmarshal
193-
func (v *NotificationMessage) NKeys() int { return 3 }
193+
func (m *NotificationMessage) NKeys() int { return 3 }
194194

195195
// MarshalJSONObject implements gojay's MarshalerJSONObject
196-
func (v *NotificationMessage) MarshalJSONObject(enc *gojay.Encoder) {
197-
enc.StringKey(keyJSONRPC, v.JSONRPC)
198-
enc.StringKey(keyMethod, v.Method)
199-
enc.AddEmbeddedJSONKeyOmitEmpty(keyParams, (*gojay.EmbeddedJSON)(v.Params))
196+
func (m *NotificationMessage) MarshalJSONObject(enc *gojay.Encoder) {
197+
enc.StringKey(keyJSONRPC, m.JSONRPC)
198+
enc.StringKey(keyMethod, m.Method)
199+
enc.AddEmbeddedJSONKeyOmitEmpty(keyParams, (*gojay.EmbeddedJSON)(m.Params))
200200
}
201201

202202
// IsNil returns wether the structure is nil value or not
203-
func (v *NotificationMessage) IsNil() bool { return v == nil }
203+
func (m *NotificationMessage) IsNil() bool { return m == nil }

0 commit comments

Comments
 (0)