/
redis.pb.json.go
38 lines (35 loc) · 1.41 KB
/
redis.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: config/protocol/redis/redis.proto
package redis
import (
"bytes"
"encoding/json"
"github.com/gogo/protobuf/jsonpb"
)
// CompressionJSONMarshaler describes the default jsonpb.Marshaler used by all
// instances of Compression. This struct is safe to replace or modify but
// should not be done so concurrently.
var CompressionJSONMarshaler = 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 *Compression) MarshalJSON() ([]byte, error) {
if m == nil {
return json.Marshal(nil)
}
buf := &bytes.Buffer{}
if err := CompressionJSONMarshaler.Marshal(buf, m); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var _ json.Marshaler = (*Compression)(nil)
// CompressionJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
// instances of Compression. This struct is safe to replace or modify but
// should not be done so concurrently.
var CompressionJSONUnmarshaler = 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 *Compression) UnmarshalJSON(b []byte) error {
return CompressionJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
}
var _ json.Unmarshaler = (*Compression)(nil)