Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Unmarshal ¶
func Unmarshal(dest interface{}) error
Unmarshal reads configuration data from the package's DataSource into a struct.
This is the singleton/package-level interface to flatpack, for applications that want to use the default data source (process environment) or set a process-wide data source at startup.
NOTE: flatpack currently lacks a public non-singleton interface, but it would be easy to add by simply exporting flatpack.new() and declaring an Unmarshaller interface.
Types ¶
type BadType ¶
BadType is an error that provides information about invalid types encountered while unmarshalling.
type BadValue ¶
BadValue is an error that provides information about malformed values encountered while unmarshalling.
type Getter ¶
Getter represents a read-only repository of key/value pairs where the keys are ordered sequences of strings and the values are strings. It's analogous to a map[Key]string, but the data may be retrieved from a network or filesystem source and the structured key name may be treated as an indicator of hierarchy or containment within the data source, e.g. URL hierarchy on an HTTP k/v store, or directory hierarchy on a filesystem-based store.
type Key ¶
type Key []string
Key is an ordered sequence of struct field names.
type NoReflection ¶
type NoReflection struct {
Name Key
}
NoReflection is an error that indicates something went wrong when reflecting on an unmarshalling target. Generally, this is caused by trying to unmarshal into a struct that has unexported fields (i.e. whose names begin with a lower-case letter).
To avoid this error, either remove the unexported fields from your struct or mark them with the flatpack:"ignore" field tag.
func (*NoReflection) Error ¶
func (e *NoReflection) Error() string
type Validater ¶
type Validater interface {
Validate() error
}
Validater represents an object that knows how to validate itself. If the object you pass to Unmarshal implements this interface, flatpack will call it for you and return the error if anything fails to validate.
Note that this is a ValidatER (a thing that can Validate itself), not a ValidatOR (a thing that knows how to validate other things).