Versions in this module Expand all Collapse all v0 v0.1.0 Jan 23, 2021 Changes in this version + const Hcl + const Ini + const JSON + const Toml + const Yaml + const Yml + var JSONAllowComments = true + var JSONDriver = &jsonDriver + func AddDriver(driver Driver) + func BindStruct(key string, dst interface{}) error + func Bool(key string, defVal ...bool) bool + func ClearAll() + func Data() map[string]interface + func Delimiter(sep byte) func(*Options) + func DumpTo(out io.Writer, format string) (int64, error) + func EnableCache(opts *Options) + func Exists(key string, findByPath ...bool) bool + func Float(key string, defVal ...float64) float64 + func Get(key string, findByPath ...bool) interface + func GetEnv(name string, defVal ...string) (val string) + func GetValue(key string, findByPath ...bool) (interface{}, bool) + func Getenv(name string, defVal ...string) (val string) + func Int(key string, defVal ...int) int + func Int64(key string, defVal ...int64) int64 + func IntMap(key string) map[string]int + func Ints(key string) []int + func LoadData(dataSource ...interface{}) error + func LoadExists(sourceFiles ...string) error + func LoadFiles(sourceFiles ...string) error + func LoadFlags(keys []string) error + func LoadOSEnv(keys []string, keyToLower bool) + func LoadRemote(format, url string) error + func LoadSources(format string, src []byte, more ...[]byte) error + func LoadStrings(format string, str string, more ...string) error + func MapStruct(key string, dst interface{}) error + func ParseEnv(opts *Options) + func Readonly(opts *Options) + func Set(key string, val interface{}, setByPath ...bool) error + func SetData(data map[string]interface{}) + func SetDecoder(format string, decoder Decoder) + func SetEncoder(format string, encoder Encoder) + func String(key string, defVal ...string) string + func StringMap(key string) map[string]string + func Strings(key string) []string + func Uint(key string, defVal ...uint) uint + func WithOptions(opts ...func(*Options)) + func WriteTo(out io.Writer) (int64, error) + type Config struct + func Default() *Config + func New(name string) *Config + func NewEmpty(name string) *Config + func NewWithOptions(name string, opts ...func(*Options)) *Config + func (c *Config) AddDriver(driver Driver) + func (c *Config) BindStruct(key string, dst interface{}) error + func (c *Config) Bool(key string, defVal ...bool) (value bool) + func (c *Config) ClearAll() + func (c *Config) ClearCaches() + func (c *Config) ClearData() + func (c *Config) Data() map[string]interface{} + func (c *Config) DelDriver(format string) + func (c *Config) DumpTo(out io.Writer, format string) (n int64, err error) + func (c *Config) Error() error + func (c *Config) Exists(key string, findByPath ...bool) (ok bool) + func (c *Config) Float(key string, defVal ...float64) (value float64) + func (c *Config) Get(key string, findByPath ...bool) interface{} + func (c *Config) GetValue(key string, findByPath ...bool) (value interface{}, ok bool) + func (c *Config) HasDecoder(format string) bool + func (c *Config) HasEncoder(format string) bool + func (c *Config) Int(key string, defVal ...int) (value int) + func (c *Config) Int64(key string, defVal ...int64) (value int64) + func (c *Config) IntMap(key string) (mp map[string]int) + func (c *Config) Ints(key string) (arr []int) + func (c *Config) IsEmpty() bool + func (c *Config) LoadData(dataSources ...interface{}) (err error) + func (c *Config) LoadExists(sourceFiles ...string) (err error) + func (c *Config) LoadFiles(sourceFiles ...string) (err error) + func (c *Config) LoadFlags(keys []string) (err error) + func (c *Config) LoadOSEnv(keys []string, keyToLower bool) + func (c *Config) LoadRemote(format, url string) (err error) + func (c *Config) LoadSources(format string, src []byte, more ...[]byte) (err error) + func (c *Config) LoadStrings(format string, str string, more ...string) (err error) + func (c *Config) LoadedFiles() []string + func (c *Config) MapStruct(key string, dst interface{}) error + func (c *Config) Name() string + func (c *Config) Options() *Options + func (c *Config) Readonly() + func (c *Config) Set(key string, val interface{}, setByPath ...bool) (err error) + func (c *Config) SetData(data map[string]interface{}) + func (c *Config) SetDecoder(format string, decoder Decoder) + func (c *Config) SetDecoders(decoders map[string]Decoder) + func (c *Config) SetEncoder(format string, encoder Encoder) + func (c *Config) SetEncoders(encoders map[string]Encoder) + func (c *Config) String(key string, defVal ...string) string + func (c *Config) StringMap(key string) (mp map[string]string) + func (c *Config) Strings(key string) (arr []string) + func (c *Config) Structure(key string, dst interface{}) error + func (c *Config) ToJSON() string + func (c *Config) Uint(key string, defVal ...uint) (value uint) + func (c *Config) WithOptions(opts ...func(*Options)) + func (c *Config) WriteTo(out io.Writer) (n int64, err error) + type Decoder func(blob []byte, v interface{}) (err error) + var JSONDecoder Decoder = func(data []byte, v interface{}) (err error) { ... } + type Driver interface + GetDecoder func() Decoder + GetEncoder func() Encoder + Name func() string + type Encoder func(v interface{}) (out []byte, err error) + var JSONEncoder Encoder = json.Marshal + type Options struct + Delimiter byte + DumpFormat string + EnableCache bool + ParseEnv bool + ParseKey bool + ReadFormat string + Readonly bool + TagName string + func GetOptions() *Options Other modules containing this package github.com/wempy-id/cfg/v2