msgpack

package
v2.725.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 2 Imported by: 0

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

type Decoder struct {
	*msgpack.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

func NewDecoder(r io.Reader) *Decoder

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.

func (*Decoder) Close

func (d *Decoder) Close() error

Close is a no-op: the underlying MessagePack decoder has no finalization state to flush.

type Encoder

type Encoder struct {
	*msgpack.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

func NewEncoder(w io.Writer) *Encoder

NewEncoder constructs a streaming MessagePack Encoder bound to w.

func (*Encoder) Close

func (e *Encoder) Close() error

Close is a no-op: the underlying MessagePack encoder has no finalization state to flush.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL