Documentation ¶
Index ¶
- func Load(file string, v interface{}, opts ...Option) error
- func LoadConfig(file string, v interface{}, opts ...Option) error
- func LoadConfigFromJsonBytes(content []byte, v interface{}) error
- func LoadConfigFromYamlBytes(content []byte, v interface{}) error
- func LoadFromJsonBytes(content []byte, v interface{}) error
- func LoadFromTomlBytes(content []byte, v interface{}) error
- func LoadFromYamlBytes(content []byte, v interface{}) error
- func MustLoad(path string, v interface{}, opts ...Option)
- type Option
- type Properties
- type PropertyError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadConfig ¶
LoadConfig loads config into v from file, .json, .yaml and .yml are acceptable. Deprecated: use Load instead.
func LoadConfigFromJsonBytes ¶
LoadConfigFromJsonBytes loads config into v from content json bytes. Deprecated: use LoadFromJsonBytes instead.
func LoadConfigFromYamlBytes ¶
LoadConfigFromYamlBytes loads config into v from content yaml bytes. Deprecated: use LoadFromYamlBytes instead.
func LoadFromJsonBytes ¶
LoadFromJsonBytes loads config into v from content json bytes.
func LoadFromTomlBytes ¶
LoadFromTomlBytes loads config into v from content toml bytes.
func LoadFromYamlBytes ¶
LoadFromYamlBytes loads config into v from content yaml bytes.
Types ¶
type Option ¶
type Option func(opt *options)
Option defines the method to customize the config options.
type Properties ¶
type Properties interface { GetString(key string) string SetString(key, value string) GetInt(key string) int SetInt(key string, value int) ToString() string }
Properties interface provides the means to access configuration.
func LoadProperties ¶
func LoadProperties(filename string, opts ...Option) (Properties, error)
LoadProperties loads the properties into a properties configuration instance. Returns an error that indicates if there was a problem loading the configuration.
func NewProperties ¶
func NewProperties() Properties
NewProperties builds a new properties configuration structure.
type PropertyError ¶
type PropertyError struct {
// contains filtered or unexported fields
}
PropertyError represents a configuration error message.
func (*PropertyError) Error ¶
func (configError *PropertyError) Error() string
Error returns the error message.