20 lines
305 B
Go
20 lines
305 B
Go
package broker
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
type jsonCodec struct{}
|
|
|
|
func (j jsonCodec) Marshal(v interface{}) ([]byte, error) {
|
|
return json.Marshal(v)
|
|
}
|
|
|
|
func (j jsonCodec) Unmarshal(d []byte, v interface{}) error {
|
|
return json.Unmarshal(d, v)
|
|
}
|
|
|
|
func (j jsonCodec) String() string {
|
|
return "json"
|
|
}
|