config

package
v1.3.10 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultString

func DefaultString(key, defaultVal string) string

func Exist

func Exist(key string) bool

func GetBool

func GetBool(key string) bool

func GetDuration

func GetDuration(key string) time.Duration

func GetFloat

func GetFloat(key string) float64

func GetInt

func GetInt(key string) int

func GetInt64

func GetInt64(key string) int64

func GetIntSlice

func GetIntSlice(key string) []int

func GetString

func GetString(key string) string

func GetStringMap

func GetStringMap(key string) map[string]string

func GetStringMapStringSlice

func GetStringMapStringSlice(key string) map[string][]string

func GetStringSlice

func GetStringSlice(key string) []string

func GetTime

func GetTime(key string) time.Time

func SetProvider

func SetProvider(provider Provider)

Types

type Config

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

func Default

func Default() *Config

func New

func New(opts ...Option) *Config

func (*Config) Exist

func (conf *Config) Exist(key string) bool

func (*Config) GetBool

func (conf *Config) GetBool(key string) bool

func (*Config) GetDuration

func (conf *Config) GetDuration(key string) time.Duration

func (*Config) GetFloat

func (conf *Config) GetFloat(key string) float64

func (*Config) GetInt

func (conf *Config) GetInt(key string) int

func (*Config) GetInt64

func (conf *Config) GetInt64(key string) int64

func (*Config) GetIntSlice

func (conf *Config) GetIntSlice(key string) []int

func (*Config) GetString

func (conf *Config) GetString(key string) string

func (*Config) GetStringMap

func (conf *Config) GetStringMap(key string) map[string]string

func (*Config) GetStringMapStringSlice

func (conf *Config) GetStringMapStringSlice(key string) map[string][]string

func (*Config) GetStringSlice

func (conf *Config) GetStringSlice(key string) []string

func (*Config) GetTime

func (conf *Config) GetTime(key string) time.Time

func (*Config) Init

func (conf *Config) Init() error

func (*Config) Provider

func (conf *Config) Provider(provider Provider)

type Option

type Option func(*Options)

func WithDefault

func WithDefault(isDefault bool) Option

func WithProviders

func WithProviders(providers []string) Option

type Options

type Options struct {
	Providers []string
	Default   bool
}

type Provider

type Provider interface {
	Get(key string) interface{}
	OnWatch(func()) error
	ReadConfig() error
	Unmarshal(key string, receiver interface{}) error
	Exist(key string) bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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