config

package
v2.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: MIT Imports: 11 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeTOML

func DecodeTOML(r io.Reader, v any) error

DecodeTOML decodes toml from r in to v. Requires strict field matches and returns full toml.StrictMissingError details.

func NamedMultiErrorList

func NamedMultiErrorList(err error, name string) error

func Validate

func Validate(cfg interface{}) (err error)

Validate returns any errors from calling Validated.ValidateConfig on cfg and any nested types that implement Validated.

Types

type ErrDeprecated added in v2.7.0

type ErrDeprecated struct {
	Name    string
	Version semver.Version
}

func (ErrDeprecated) Error added in v2.7.0

func (e ErrDeprecated) Error() string

type ErrEmpty

type ErrEmpty = config.ErrEmpty

type ErrInvalid

type ErrInvalid = config.ErrInvalid

func NewErrDuplicate

func NewErrDuplicate(name string, value any) ErrInvalid

NewErrDuplicate returns an ErrInvalid with a standard duplicate message.

type ErrMissing

type ErrMissing = config.ErrMissing

type ErrOverride

type ErrOverride struct {
	Name string
}

func (ErrOverride) Error

func (e ErrOverride) Error() string

type UniqueStrings

type UniqueStrings = config.UniqueStrings

UniqueStrings is a helper for tracking unique values in string form.

type Validated

type Validated interface {
	// ValidateConfig returns nil if the config is valid, otherwise an error describing why it is invalid.
	//
	// For implementations:
	//  - Use package multierr to accumulate all errors, rather than returning the first encountered.
	//  - If an anonymous field also implements ValidateConfig(), it must be called explicitly!
	ValidateConfig() error
}

Validated configurations impose constraints that must be checked.

Jump to

Keyboard shortcuts

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