Versions in this module Expand all Collapse all v0 v0.1.0 Sep 11, 2026 Changes in this version + func AtLeastOneOf(fields ...Set) error + func Check[T any](opts ...Option) error + func Document[T any](w io.Writer, opts ...Option) error + func Matches(field, v string, re *regexp.Regexp) error + func MutuallyExclusive(fields ...Set) error + func NotEmpty(field string, v string) error + func NotWeakSecret(current Mode, field, v string, known ...string) error + func OneOf[T comparable](field string, v T, allowed ...T) error + func Range[T int | int8 | int16 | int32 | int64 | float32 | float64](field string, v, lo, hi T) error + func Required(field string, v any) error + func RequiredIn(mode, current Mode, field string, v any) error + func RequiredWhen(field string, present bool, condition string, holds bool) error + type DecodeError struct + Err error + Key string + Path string + Source string + Value string + func (e *DecodeError) Error() string + func (e *DecodeError) Unwrap() error + type Decoder interface + Decode func(typ reflect.Type, raw string) (any, bool, error) + type DecoderFunc func(typ reflect.Type, raw string) (any, bool, error) + func (f DecoderFunc) Decode(typ reflect.Type, raw string) (any, bool, error) + type Defaulter interface + Defaults func() + type Deriver interface + Derive func() error + type Field struct + Key string + Path string + Secret bool + Source string + Value string + type KeyLister interface + Keys func() []string + type Mode string + const ModeDev + const ModeProd + const ModeTest + type Observer interface + ObserveResolve func(f Field) + type ObserverFunc func(f Field) + func (f ObserverFunc) ObserveResolve(field Field) + type Option func(*options) + func DefaultSources(extra ...any) Option + func DefaultSourcesIn(dir string, extra ...any) Option + func Reveal() Option + func WithDecoder(d Decoder) Option + func WithMode(m Mode) Option + func WithModeKey(key string) Option + func WithObserver(ob Observer) Option + func WithSources(sources ...any) Option + func WithTransform(fn func(key, value, source string) (string, error)) Option + func WithTransformer(t Transformer) Option + type RequiredError struct + Empty bool + Key string + Mode Mode + Path string + func (e *RequiredError) Error() string + type Result struct + func Load[T any](opts ...Option) (*T, *Result, error) + func (r *Result) Explain(w io.Writer) error + func (r *Result) Fields() []Field + func (r *Result) Files() []string + func (r *Result) JSON() ([]byte, error) + func (r *Result) Mode() Mode + func (r *Result) Unknown() []UnknownKey + type Set struct + Name string + Value any + type Source interface + Lookup func(key string) (value string, found bool, err error) + Name func() string + func FlagSource(name string, typed map[string]string) Source + func FromEnviron() Source + func FromFS(fsys fs.FS, paths ...string) Source + func FromFiles(paths ...string) Source + func FromFlagSet(fs *flag.FlagSet) Source + func FromMap(m map[string]string) Source + func FromPrefixedEnviron(prefix string) Source + func SourceFunc(name string, fn func(key string) (value string, found bool, err error)) Source + type SourceError struct + Err error + Key string + Source string + func (e *SourceError) Error() string + func (e *SourceError) Unwrap() error + type StructuredSource interface + Apply func(dst any) error + Name func() string + func FromJSON(b []byte) StructuredSource + func FromStruct(name string, v any) StructuredSource + func StructuredFunc(name string, fn func(dst any) error) StructuredSource + type Transformer interface + Transform func(key, value, source string) (string, error) + type TransformerFunc func(key, value, source string) (string, error) + func (f TransformerFunc) Transform(key, value, source string) (string, error) + type UnknownKey struct + Key string + Source string + func (u UnknownKey) String() string + type UnreachableFieldError struct + Path string + Type string + func (e *UnreachableFieldError) Error() string + type UnreachableHookError struct + Hook string + Path string + Type string + func (e *UnreachableHookError) Error() string + type ValidationError struct + Msg string + Path string + Rule string + func (e *ValidationError) Error() string + type Validator interface + Validate func() error + type Watcher struct + func NewWatcher[T any](build func() []Option) (*Watcher[T], error) + func (w *Watcher[T]) Current() *T + func (w *Watcher[T]) Generation() uint64 + func (w *Watcher[T]) Reload() error + func (w *Watcher[T]) Result() *Result + func (w *Watcher[T]) Snapshot() (*T, *Result)