config

package
v0.3.22 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidInput  = errors.New("invalid input")
	ErrMissingInput  = errors.New("missing input")
	ErrUnimplemented = errors.New("unimplemented")
)

Functions

func Dereference

func Dereference[T any](ptr *T) T

Dereference safely dereferences a pointer into the underlying value or the empty value for the type.

func Merge

func Merge[T any](dst *T, src T) error

Merge is a helper function for invoking 'mergo.Merge' with consistent settings.

Types

type Configurable

type Configurable[T any] interface {
	Configurer[T]
	Validator[T]
	Merger
}

type Configurer

type Configurer[T any] interface {
	Configure(c T) error
}

Configurer is a type which can configure itself based on the current invocation. Note that 'Configure' must *not* set default values as this method might be called prior to complete resolution of user inputs.

type Merger

type Merger interface {
	MergeInto(other any) error
}

Merger is a type which can merge from or into other objects (typically, but not always, of the same type).

type Validator

type Validator[T any] interface {
	Validate(c T) error
}

Validator is a type which can validate itself.

Jump to

Keyboard shortcuts

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