Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Default = Msgpack
Default is the default CodecFunc
Functions ¶
This section is empty.
Types ¶
type Codec ¶
type Codec interface { Encode(val any) error Decode(val any) error Unmarshal(data []byte, v any) error Marshal(v any) ([]byte, error) }
Codec is able to encode and decode messages to/from the given io.ReadWriter
func Msgpack ¶
func Msgpack(rw io.ReadWriter) Codec
Msgpack is a CodecFunc that creates a Msgpack Codec
type CodecFunc ¶
type CodecFunc func(io.ReadWriter) Codec
CodecFunc is a function that returns a new Codec bound to the given io.ReadWriter
type MsgpackCodec ¶
type MsgpackCodec struct { *msgpack.Encoder *msgpack.Decoder }
func (MsgpackCodec) Marshal ¶
func (MsgpackCodec) Marshal(v any) ([]byte, error)
func (MsgpackCodec) Unmarshal ¶
func (MsgpackCodec) Unmarshal(data []byte, v any) error
Click to show internal directories.
Click to hide internal directories.