config

package module
v0.0.0-...-3f40f9d Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: MIT Imports: 14 Imported by: 5

README

config

AFAIRE

Go Report Card Go Reference

Licence

MIT.


Copyright (c) 2021-2022 losyme

Documentation

Index

Constants

View Source
const ErrKeyNotFound = errors.Sentinel("key not found")

Variables

This section is empty.

Functions

func DefaultDecoderConfig

func DefaultDecoderConfig() *mapstructure.DecoderConfig

Types

type Config

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

func New

func New(opts ...Option) *Config

func (*Config) AddPath

func (c *Config) AddPath(path string) error

func (*Config) Data

func (c *Config) Data() map[string]interface{}

func (*Config) Decode

func (c *Config) Decode(output interface{}, msdc *mapstructure.DecoderConfig, keys ...string) error

func (*Config) Get

func (c *Config) Get(keys ...string) (interface{}, error)

func (*Config) GetBool

func (c *Config) GetBool(keys ...string) (bool, error)

func (*Config) GetDuration

func (c *Config) GetDuration(keys ...string) (time.Duration, error)

func (*Config) GetFloat64

func (c *Config) GetFloat64(keys ...string) (float64, error)

func (*Config) GetInt

func (c *Config) GetInt(keys ...string) (int, error)

func (*Config) GetString

func (c *Config) GetString(keys ...string) (string, error)

func (*Config) GetStringSlice

func (c *Config) GetStringSlice(keys ...string) ([]string, error)

func (*Config) IsSet

func (c *Config) IsSet(keys ...string) bool

func (*Config) LoadEnv

func (c *Config) LoadEnv(name, key string) bool

func (*Config) LoadFile

func (c *Config) LoadFile(name string, mustExist bool) error

func (*Config) Set

func (c *Config) Set(value interface{}, keys ...string)

func (*Config) SetDefault

func (c *Config) SetDefault(value interface{}, keys ...string)

func (*Config) SetEnvPrefix

func (c *Config) SetEnvPrefix(prefix string)

type Option

type Option func(*Config)

func WithData

func WithData(data map[string]interface{}) Option

Jump to

Keyboard shortcuts

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