Documentation
¶
Index ¶
- func NewDefaultUnmarshalConfig() koanf.UnmarshalConf
- func NewUnmarshalConfig() koanf.UnmarshalConf
- func Unmarshal(koanf *koanf.Koanf, key string, destination any, opts ...Option) error
- func UnmarshalAll(koanf *koanf.Koanf, destination any, opts ...Option) error
- func UnmarshalAllWithMetadata(koanf *koanf.Koanf, destination any, opts ...Option) (mapstructure.Metadata, error)
- func UnmarshalWithMetadata(koanf *koanf.Koanf, key string, destination any, opts ...Option) (mapstructure.Metadata, error)
- type Koanf
- func (kwt *Koanf) ClearTracker() *Koanf
- func (kwt *Koanf) Filtered(keys ...string) *Koanf
- func (kwt *Koanf) IsSet(key string) bool
- func (kwt *Koanf) Load(p koanf.Provider, pa koanf.Parser, opts ...koanf.Option) error
- func (kwt *Koanf) Map() map[string]any
- func (kwt *Koanf) Track() *Koanf
- func (kwt *Koanf) TrackAll() *Koanf
- func (kwt *Koanf) TrackFlags() *Koanf
- func (kwt *Koanf) Unmarshal(destination any, opts ...Option) error
- func (kwt *Koanf) UnmarshalWithMetadata(destination any, opts ...Option) (mapstructure.Metadata, error)
- func (kwt *Koanf) WithFlags(newF *pflag.FlagSet) *Koanf
- func (kwt *Koanf) WithKoanf(newK *koanf.Koanf) *Koanf
- type Option
- type SetMap
- type Tracker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDefaultUnmarshalConfig ¶
func NewDefaultUnmarshalConfig() koanf.UnmarshalConf
NewDefaultUnmarshalConfig creates a new default UnmarshalConf with the default tag.
func NewUnmarshalConfig ¶
func NewUnmarshalConfig() koanf.UnmarshalConf
NewUnmarshalConfig creates a new UnmarshalConf with the default decoder config.
func Unmarshal ¶
Unmarshal unmarshals with optional additional options, starting from the provided key.
func UnmarshalAll ¶
UnmarshalAll unmarshals all keys from the Koanf instance into the provided struct.
func UnmarshalAllWithMetadata ¶
func UnmarshalAllWithMetadata(koanf *koanf.Koanf, destination any, opts ...Option) (mapstructure.Metadata, error)
UnmarshalAllWithMetadata unmarshals all keys from the Koanf instance into the provided struct and returns metadata.
func UnmarshalWithMetadata ¶
func UnmarshalWithMetadata( koanf *koanf.Koanf, key string, destination any, opts ...Option, ) (mapstructure.Metadata, error)
UnmarshalWithMetadata unmarshals with metadata and optional additional options, starting from the provided key.
Types ¶
type Koanf ¶
Koanf is a wrapper around koanf.Koanf that tracks the keys that have been set.
func FromStruct ¶
FromStruct creates a new Koanf instance from a struct, loading the struct's fields into the koanf.Koanf instance.
func (*Koanf) ClearTracker ¶
ClearTracker overwrites the Tracker in the Koanf instance with a fresh Tracker instance.
func (*Koanf) Filtered ¶
Filtered returns a new Koanf instance that only contains the specified keys. Any keys that don't exist in the original instance are ignored.
func (*Koanf) TrackFlags ¶
TrackFlags tracks changed flags from a FlagSet.
func (*Koanf) UnmarshalWithMetadata ¶
func (kwt *Koanf) UnmarshalWithMetadata(destination any, opts ...Option) (mapstructure.Metadata, error)
UnmarshalWithMetadata unmarshals the configuration into the provided struct and returns metadata.
type Option ¶
type Option func(*koanf.UnmarshalConf)
Option is a function that modifies an UnmarshalConf.
func WithErrorUnused ¶
func WithErrorUnused() Option
WithErrorUnused causes errors on unused fields.
type SetMap ¶
SetMap is a map that tracks the keys that have been set and whether they were changed.
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracker is a structure that tracks the keys in a koanf instance and their changed status.
func (*Tracker) TrackFlags ¶
TrackFlags tracks changed flags from a FlagSet.