Documentation ¶
Index ¶
Constants ¶
const IntDesiredFormat = "int"
IntDesiredFormat is a ErrValueFormat.DesiredFormatDesc variant
Variables ¶
var ErrEmptyProperty = fmt.Errorf("cannot find a value for an empty property")
ErrEmptyProperty is returned when a config function is given an empty string property
Functions ¶
func LoadProperties ¶
func LoadProperties(typedSource *TypedSource, properties ...property) error
LoadProperties will try load properties from source into variable reference
Types ¶
type ErrPropertyNotSet ¶
type ErrPropertyNotSet struct {
Property string
}
ErrPropertyNotSet is returned when a property has no corresponding value
func (*ErrPropertyNotSet) Error ¶
func (e *ErrPropertyNotSet) Error() string
Error implements the error interface
type ErrUnknownPropertyType ¶
type ErrUnknownPropertyType struct {
Type string
}
ErrUnknownPropertyType is returned when a property is not known
func NewErrUnknownPropertyType ¶
func NewErrUnknownPropertyType(typ interface{}) *ErrUnknownPropertyType
NewErrUnknownPropertyType is a constructor
func (*ErrUnknownPropertyType) Error ¶
func (e *ErrUnknownPropertyType) Error() string
Error implements the error interface
type ErrValueFormat ¶
ErrValueFormat is returned when the value found for a property cannot be converted to the desired format
func (*ErrValueFormat) Error ¶
func (e *ErrValueFormat) Error() string
Error implements the error interface
type IntProperty ¶
type IntProperty struct {
// contains filtered or unexported fields
}
IntProperty holds an int mapping
type Source ¶
type Source interface { // Note: property must be in upper case format, like an environment variable. GetString(property string) (string, error) }
Source provides configuration values
type StringProperty ¶
type StringProperty struct {
// contains filtered or unexported fields
}
StringProperty holds a string mapping
type TypedSource ¶
type TypedSource struct {
// contains filtered or unexported fields
}
TypedSource provides typed configuration values from a normal Source
func NewTypedSource ¶
func NewTypedSource(backingSource Source) *TypedSource
NewTypedSource is a constructor