config

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2025 License: MIT Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

func New added in v1.4.0

func New(opts ...Option) (*Config, error)

func (*Config) Delete added in v1.4.0

func (c *Config) Delete(key string)

func (*Config) Mandatory added in v1.4.0

func (c *Config) Mandatory() Mandatory

func (*Config) Optional added in v1.4.0

func (c *Config) Optional() Optional

func (*Config) Read added in v1.4.0

func (c *Config) Read(ptr any) error

func (*Config) Set added in v1.4.0

func (c *Config) Set(key string, value any)

type Mandatory added in v1.4.0

type Mandatory struct {
	// contains filtered or unexported fields
}

func (Mandatory) Bool added in v1.4.0

func (m Mandatory) Bool(key string) (bool, error)

func (Mandatory) Duration added in v1.4.0

func (m Mandatory) Duration(key string) (time.Duration, error)

func (Mandatory) Int added in v1.4.0

func (m Mandatory) Int(key string) (int, error)

func (Mandatory) String added in v1.4.0

func (m Mandatory) String(key string) (string, error)

type Option added in v1.4.0

type Option func(l *Config)

func WithEnvPrefix added in v1.4.0

func WithEnvPrefix(prefix string) Option

func WithExtraSource added in v1.4.0

func WithExtraSource(source Source) Option

func WithValidator added in v1.4.0

func WithValidator(validator Validator) Option

type Optional added in v1.4.0

type Optional struct {
	// contains filtered or unexported fields
}

func (Optional) Bool added in v1.4.0

func (o Optional) Bool(key string, defValue bool) bool

func (Optional) Duration added in v1.4.0

func (o Optional) Duration(key string, defValue time.Duration) time.Duration

func (Optional) Int added in v1.4.0

func (o Optional) Int(key string, defValue int) int

func (Optional) String added in v1.4.0

func (o Optional) String(key string, defValue string) string

type Source added in v1.4.0

type Source interface {
	Config() (map[string]string, error)
}

type Validator added in v1.4.0

type Validator interface {
	ValidateToError(value any) error
}

type YamlFileSource added in v1.4.0

type YamlFileSource struct {
	// contains filtered or unexported fields
}

func NewYamlConfig added in v1.4.0

func NewYamlConfig(file string) YamlFileSource

func (YamlFileSource) Config added in v1.4.0

func (y YamlFileSource) Config() (map[string]string, error)

Jump to

Keyboard shortcuts

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