Documentation ¶
Index ¶
- Variables
- func IsNotFoundErr(err error) bool
- type Config
- func (c *Config) GetBool(k string) (bool, error)
- func (c *Config) GetDuration(k string) (time.Duration, error)
- func (c *Config) GetFloat(k string) (float64, error)
- func (c *Config) GetInt(k string) (int, error)
- func (c *Config) GetSlice(k string) ([]string, error)
- func (c *Config) GetString(k string) (string, error)
- func (c *Config) GetTime(k string) (time.Time, error)
- func (c *Config) GetURL(k string) (*url.URL, error)
- func (c *Config) Len() int
- func (c *Config) Map() map[string]string
- func (c *Config) MustBool(k string) bool
- func (c *Config) MustDuration(k string) time.Duration
- func (c *Config) MustFloat(k string) float64
- func (c *Config) MustInt(k string) int
- func (c *Config) MustSlice(k string) []string
- func (c *Config) MustString(k string) string
- func (c *Config) MustTime(k string) time.Time
- func (c *Config) MustURL(k string) *url.URL
- func (c *Config) SetBool(k string, b bool)
- func (c *Config) SetDuration(k string, d time.Duration)
- func (c *Config) SetFloat(k string, f float64)
- func (c *Config) SetInt(k string, i int)
- func (c *Config) SetSlice(k string, s []string)
- func (c *Config) SetString(k, v string)
- func (c *Config) SetTime(k string, t time.Time)
- func (c *Config) SetURL(k string, u *url.URL)
- func (c *Config) String() string
- type ErrKeyNotFound
- type Provider
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidCommaString = errors.New("Invalid comma separated string")
)
Functions ¶
func IsNotFoundErr ¶
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is a go routine safe configuration store structure which can be accessed via providers
func Parse ¶
Parse parses the configuration from a provider and returns a pointer to a configuration store
func (*Config) GetBool ¶
GetBool gets the requested value from the configuration map and returns it as a boolean. Returns an error if the key can't be found.
func (*Config) GetDuration ¶
GetDuration gets the requested value from the configuration map and returns it as a Duration. Returns an error if the key can't be found.
func (*Config) GetFloat ¶
GetFloat gets the requested value from the configuration map and returns it as a float64. Returns an error if the key can't be found.
func (*Config) GetInt ¶
GetInt gets the requested value from the configuration map and returns it as an integer. Returns an error if the key can't be found.
func (*Config) GetSlice ¶
GetSlice gets the requested value, which must be a comma separated string, from the configuration map and returns it as a slice. Returns an error if the key can't be found.
func (*Config) GetString ¶
GetString gets the requested value from the configuration map and returns it as a string. Returns an error if the key can't be found.
func (*Config) GetTime ¶
GetTime gets the requested value from the configuration map and returns it as a Time. Returns an error if the key can't be found.
func (*Config) GetURL ¶
GetURL gets the requested value from the configuration map and returns it as a pointer to a URL. Returns an error if the key can't be found.
func (*Config) MustBool ¶
MustBool gets the requested value from the configuration map and returns it as a boolean. Panics if the key can't be found.
func (*Config) MustDuration ¶
MustDuration gets the requested value from the configuration map and returns it as a Duration. Panics if the key can't be found.
func (*Config) MustFloat ¶
MustFloat gets the requested value from the configuration map and returns it as a float64. Panics if the key can't be found.
func (*Config) MustInt ¶
MustInt gets the requested value from the configuration map and returns it as an integer. Panics if the key can't be found.
func (*Config) MustSlice ¶
MustSlice gets the requested value, which must be a comma separated string, from the configuration map and returns it as a slice. Panics if the key can't be found.
func (*Config) MustString ¶
MustString gets the requested value from the configuration map and returns it as a string. Will panic if the key can't be found.
func (*Config) MustTime ¶
MustTime gets the requested value from the configuration map and returns it as a Duration. Panics if the key can't be found.
func (*Config) MustURL ¶
MustURL gets the requested value from the configuration map and returns it as a pointer to a URL. Panics if the key can't be found.
func (*Config) SetBool ¶
SetBool updates the configuration map with the provided value for the provided key
func (*Config) SetDuration ¶
SetDuration updates the configuration map with the provided value for the provided key
func (*Config) SetFloat ¶
SetFloat updates the configuration map with the provided value for the provided key
func (*Config) SetInt ¶
SetInt updates the configuration map with the provided value for the provided key
func (*Config) SetSlice ¶
SetSlice updates the configuration map with the provided value for the provided key
func (*Config) SetString ¶
SetString updates the configuration map with the provided value for the provided key
func (*Config) SetTime ¶
SetTime updates the configuration map with the provided value for the provided key
type ErrKeyNotFound ¶
type ErrKeyNotFound struct {
Key string
}
func (ErrKeyNotFound) Error ¶
func (err ErrKeyNotFound) Error() string