@@ -9,24 +9,30 @@ package jsonrpc2
9
9
import "github.com/francoispqt/gojay"
10
10
11
11
// UnmarshalJSONObject implements gojay's UnmarshalerJSONObject
12
- func (v * Error ) UnmarshalJSONObject (dec * gojay.Decoder , k string ) error {
12
+ func (e * Error ) UnmarshalJSONObject (dec * gojay.Decoder , k string ) error {
13
13
switch k {
14
14
case keyCode :
15
- return dec .Int64 ((* int64 )(& v .Code ))
15
+ return dec .Int64 ((* int64 )(& e .Code ))
16
16
case keyMessage :
17
- return dec .String (& v .Message )
17
+ return dec .String (& e .Message )
18
18
}
19
19
return nil
20
20
}
21
21
22
22
// NKeys returns the number of keys to unmarshal
23
- func (v * Error ) NKeys () int { return 2 }
23
+ func (e * Error ) NKeys () int { return 2 }
24
24
25
25
// MarshalJSONObject implements gojay's MarshalerJSONObject
26
- func (v * Error ) MarshalJSONObject (enc * gojay.Encoder ) {
27
- enc .IntKey (keyCode , int (v .Code ))
28
- enc .StringKey (keyMessage , v .Message )
26
+ func (e * Error ) MarshalJSONObject (enc * gojay.Encoder ) {
27
+ enc .IntKey (keyCode , int (e .Code ))
28
+ enc .StringKey (keyMessage , e .Message )
29
29
}
30
30
31
31
// IsNil returns wether the structure is nil value or not
32
- func (v * Error ) IsNil () bool { return v == nil }
32
+ func (e * Error ) IsNil () bool { return e == nil }
33
+
34
+ // compile time check whether the Error implements a gojay.MarshalerJSONObject interface.
35
+ var _ gojay.MarshalerJSONObject = (* Error )(nil )
36
+
37
+ // compile time check whether the Error implements a gojay.UnmarshalerJSONObject interface.
38
+ var _ gojay.UnmarshalerJSONObject = (* Error )(nil )
0 commit comments