Debian Codegraph @

api/v1/lib/encoding/codecs/codecs.go

raw symbols SCIP
1 package codecs
2
3 import (
4 "github.com/mesos/mesos-go/api/v1/lib/encoding"
5 "github.com/mesos/mesos-go/api/v1/lib/encoding/json"
6 "github.com/mesos/mesos-go/api/v1/lib/encoding/proto"
7 )
8
9 const (
10 // MediaTypeProtobuf is the Protobuf serialization format media type.
11 MediaTypeProtobuf = encoding.MediaType("application/x-protobuf")
12 // MediaTypeJSON is the JSON serialiation format media type.
13 MediaTypeJSON = encoding.MediaType("application/json")
14
15 NameProtobuf = "protobuf"
16 NameJSON = "json"
17 )
18
19 // ByMediaType are pre-configured default Codecs, ready to use OOTB
20 var ByMediaType = map[encoding.MediaType]encoding.Codec{
21 MediaTypeProtobuf: encoding.Codec{
22 Name: NameProtobuf,
23 Type: MediaTypeProtobuf,
24 NewEncoder: proto.NewEncoder,
25 NewDecoder: proto.NewDecoder,
26 },
27 MediaTypeJSON: encoding.Codec{
28 Name: NameJSON,
29 Type: MediaTypeJSON,
30 NewEncoder: json.NewEncoder,
31 NewDecoder: json.NewDecoder,
32 },
33 }