Documentation
¶
Index ¶
- func Decode(r io.Reader, outStruct interface{}, format Format) error
- func Encode(inStruct interface{}, w io.Writer, format Format) error
- func Marshal(inStruct interface{}, format Format) ([]byte, error)
- func Unmarshal(data []byte, outStruct interface{}, format Format) error
- type Format
- type FormatSerializer
- type JSONSerializer
- type MsgpackSerializer
- func (m *MsgpackSerializer) Decode(r io.Reader, outStruct interface{}) error
- func (m *MsgpackSerializer) Encode(inStruct interface{}, w io.Writer) error
- func (m *MsgpackSerializer) Marshal(inStruct interface{}) ([]byte, error)
- func (m *MsgpackSerializer) Unmarshal(rawBytes []byte, outStruct interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FormatSerializer ¶
type FormatSerializer interface {
Marshal(interface{}) ([]byte, error)
Unmarshal([]byte, interface{}) error
Encode(interface{}, io.Writer) error
Decode(io.Reader, interface{}) error
}
FormatSerializer defines the method set for a format to be used by the smart serializer.
type JSONSerializer ¶
type JSONSerializer struct{}
JSONSerializer serializes messages to json.
func (*JSONSerializer) Decode ¶
func (m *JSONSerializer) Decode(r io.Reader, outStruct interface{}) error
Decode unmarshals the struct from a stream.
func (*JSONSerializer) Encode ¶
func (m *JSONSerializer) Encode(inStruct interface{}, w io.Writer) error
Encode marshals the struct to a stream.
func (*JSONSerializer) Marshal ¶
func (m *JSONSerializer) Marshal(inStruct interface{}) ([]byte, error)
Marshal marshals inStruct to msgpack.
func (*JSONSerializer) Unmarshal ¶
func (m *JSONSerializer) Unmarshal(rawBytes []byte, outStruct interface{}) error
Unmarshal unmarshals a raw msgpack message to a struct.
type MsgpackSerializer ¶
type MsgpackSerializer struct {
}
MsgpackSerializer implements msgpack serialization for the smart serializer.
func (*MsgpackSerializer) Decode ¶
func (m *MsgpackSerializer) Decode(r io.Reader, outStruct interface{}) error
Decode unmarshals the struct from a stream.
func (*MsgpackSerializer) Encode ¶
func (m *MsgpackSerializer) Encode(inStruct interface{}, w io.Writer) error
Encode marshals the struct to a stream.
func (*MsgpackSerializer) Marshal ¶
func (m *MsgpackSerializer) Marshal(inStruct interface{}) ([]byte, error)
Marshal marshals inStruct to msgpack.
func (*MsgpackSerializer) Unmarshal ¶
func (m *MsgpackSerializer) Unmarshal(rawBytes []byte, outStruct interface{}) error
Unmarshal unmarshals a raw msgpack message to a struct.
Click to show internal directories.
Click to hide internal directories.