Documentation
¶
Overview ¶
Package msgpack provides a streaming MessagePack github.com/alexfalkowski/go-service/v2/encoding/stream.Encoder/ github.com/alexfalkowski/go-service/v2/encoding/stream.Decoder pair used by go-service.
It wraps github.com/Basekick-Labs/msgpack/v6's own NewEncoder/NewDecoder types, which are each bound to one writer/reader for many Encode/Decode calls, unlike github.com/alexfalkowski/go-service/v2/encoding/msgpack's Decode, which rejects trailing values because a stream is expected to contain many values.
Start with the package-level constructors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
Decoder streams MessagePack values from a reader bound at construction.
Decoder embeds the github.com/Basekick-Labs/msgpack/v6.Decoder, so [Decoder.Decode] is the embedded decoder's own method. Decoder satisfies github.com/alexfalkowski/go-service/v2/encoding/stream.Decoder structurally, without this package importing that package.
func NewDecoder ¶
NewDecoder constructs a streaming MessagePack Decoder bound to r.
Unlike github.com/alexfalkowski/go-service/v2/encoding/msgpack.Encoder's Decode, the returned decoder allows additional MessagePack values after the first: it does not enforce single-value trailing-data rejection, since a stream is expected to carry many values. Decode rejects unknown destination fields unless github.com/alexfalkowski/go-service/v2/encoding/codec.WithDiscardUnknown is supplied.
type Encoder ¶
Encoder streams MessagePack values to a writer bound at construction.
Encoder embeds the github.com/Basekick-Labs/msgpack/v6.Encoder, so [Encoder.Encode] is the embedded encoder's own method. Encoder satisfies github.com/alexfalkowski/go-service/v2/encoding/stream.Encoder structurally, without this package importing that package: github.com/alexfalkowski/go-service/v2/encoding/stream.NewMap imports this package to pre-register the default "msgpack" kind, and this package importing that one back would be a compile-time import cycle.
func NewEncoder ¶
NewEncoder constructs a streaming MessagePack Encoder bound to w.