Documentation
¶
Index ¶
Constants ¶
const ( TypeMessagePackStr = "msgp" TypeJSONStr = "json" )
string versions of the Type enumeration values
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Encoder ¶
type Encoder interface {
Marshal(interface{}) ([]byte, error)
Unmarshal([]byte, interface{}) error
}
Encoder defines a universal interface that all EncodingType implementations have to adhere.
func NewEncoder ¶
NewEncoder creates an Encoder, using the standard Encoder implementation matched for the given Encoding Type.
type JSONEncoder ¶
type JSONEncoder struct {
// contains filtered or unexported fields
}
JSONEncoder defines the standard implementation for the JSON Encoding Type, using a single bytes.Buffer for all marshal calls, and using the Encoder type of the std encoding/json pkg internally.
func NewJSONEncoder ¶
func NewJSONEncoder() *JSONEncoder
NewJSONEncoder creates a new JSONEncoder, allocating a new bytes buffer and a (std) JSON Encoder (encapsulating the buffer).
See JSONEncoder for more information.
func (JSONEncoder) Marshal ¶
func (encoder JSONEncoder) Marshal(v interface{}) ([]byte, error)
Marshal implements Encoder.Marshal
func (JSONEncoder) Unmarshal ¶
func (encoder JSONEncoder) Unmarshal(data []byte, v interface{}) error
Unmarshal implements encoder.Unmarshal
type MessagePackEncoder ¶
type MessagePackEncoder struct {
// contains filtered or unexported fields
}
MessagePackEncoder defines the standard implementation for the MessagePack Encoding Type, using a single bytes.Buffer for all marshal calls, and using a single shared instance of the Reader/Writer types of the github.com/tinylib/msgp/msgp pkg internally.
func NewMessagePackEncoder ¶
func NewMessagePackEncoder() *MessagePackEncoder
NewMessagePackEncoder creates a new MessagePackEncoder, allocating a new bytes buffer and a MessagePack Writer (encapsulating the buffer).
See MessagePackEncoder for more information.
func (MessagePackEncoder) Marshal ¶
func (encoder MessagePackEncoder) Marshal(v interface{}) ([]byte, error)
Marshal implements Encoder.Marshal
func (MessagePackEncoder) Unmarshal ¶
func (encoder MessagePackEncoder) Unmarshal(data []byte, v interface{}) error
Unmarshal implements encoding.Unmarshal