/
address.pb.json.go
38 lines (35 loc) · 1.35 KB
/
address.pb.json.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
// Code generated by protoc-gen-jsonify. DO NOT EDIT.
// source: common/address.proto
package common
import (
"bytes"
"encoding/json"
"github.com/gogo/protobuf/jsonpb"
)
// AddressJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of Address. This struct is safe to replace or modify but
// should not be done so concurrently.
var AddressJSONMarshaler = new(jsonpb.Marshaler)
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
// uses the more correct jsonpb package to correctly marshal the message.
func (m *Address) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := AddressJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*Address)(nil)
// AddressJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of Address. This struct is safe to replace or modify but
// should not be done so concurrently.
var AddressJSONUnmarshaler = new(jsonpb.Unmarshaler)
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
// uses the more correct jsonpb package to correctly unmarshal the message.
func (m *Address) UnmarshalJSON(b []byte) error {
return AddressJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*Address)(nil)