Documentation
¶
Overview ¶
Package gob provides Gob encoding helpers and adapters used by go-service.
This package integrates the standard library gob encoder/decoder behind the go-service encoding abstraction.
Start with the package-level constructors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Encoder ¶
type Encoder struct{}
Encoder implements gob encoding and decoding.
It uses the standard library encoding/gob encoder/decoder with default settings.
func NewEncoder ¶
func NewEncoder() *Encoder
NewEncoder constructs a gob encoder.
This encoder is a thin adapter around the standard library encoding/gob package that satisfies github.com/alexfalkowski/go-service/v2/encoding/codec.Encoder.
func (*Encoder) Decode ¶
Decode reads gob from r and decodes it into v.
In most cases v should be a pointer to the destination value (for example *MyStruct). Decode reads one gob value and rejects additional values in the same stream.
func (*Encoder) Encode ¶
Encode writes v to w as gob.
This is a thin wrapper around `gob.NewEncoder(w).Encode(v)`. gob has no required-field concept, so github.com/alexfalkowski/go-service/v2/encoding/codec.WithAllowPartial has no effect.