Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultValidator = validator.New(validator.WithRequiredStructEnabled())
DefaultValidator is the default validator used by the config package.
Functions ¶
Types ¶
type GetConfigProviderByName ¶
GetConfigProviderByName gets a provider by name.
type LoadAndValidateParams ¶
type LoadAndValidateParams[T any] func(ctx context.Context, target target.Target, userInput map[string]any) (T, error)
LoadAndValidateParams restores and validates the parameters from the given user input map.
type Provider ¶
type Provider interface { // Name - name of the provider. Name() string // Resolve - resolves the configuration for the given target and user input map. Resolve(ctx context.Context, target target.Target, userInput map[string]any) (string, error) // contains filtered or unexported methods }
Provider provides a configuration.
func Provide ¶
func Provide[T any]( name string, loader LoadAndValidateParams[T], resolver ResolveConfig[T], ) Provider
Provide creates a config provider using the loader and resolver functions.
type ProviderRegistry ¶
type ProviderRegistry interface { // Register - registers a config provider. Register(provider Provider) ProviderRegistry // GetByName - gets a provider by name. GetByName(name string) (Provider, bool) // GetNames - gets the names of all registered providers. GetNames() []string }
ProviderRegistry is a registry of configuration providers.
func NewRegistry ¶
func NewRegistry() ProviderRegistry
Click to show internal directories.
Click to hide internal directories.