Documentation
¶
Overview ¶
Package toml provides TOML encoding helpers and adapters used by go-service.
This package integrates TOML encoding/decoding 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 TOML encoding and decoding.
It uses BurntSushi/toml and rejects undecoded keys.
func NewEncoder ¶
func NewEncoder() *Encoder
NewEncoder constructs a TOML encoder.
This encoder is a thin adapter around github.com/BurntSushi/toml that satisfies github.com/alexfalkowski/go-service/v2/encoding/codec.Encoder.
func (*Encoder) Decode ¶
Decode reads TOML from r and decodes it into v.
In most cases v should be a pointer to the destination value (for example *MyStruct).
This method rejects keys that do not decode into v unless github.com/alexfalkowski/go-service/v2/encoding/codec.WithDiscardUnknown is supplied.
func (*Encoder) Encode ¶
Encode writes v to w as TOML.
This is a thin wrapper around `toml.NewEncoder(w).Encode(v)`. TOML has no required-field concept, so github.com/alexfalkowski/go-service/v2/encoding/codec.WithAllowPartial has no effect.