Documentation ¶
Overview ¶
Package configstruct parses unstructured maps into structures
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Set ¶
Set interprets the field names in defaults and looks up config values in the config passed in. Any values found in config will be set in the opt structure.
opt must be a pointer to a struct. The struct should have entirely public fields. The field names are converted from CamelCase to snake_case and looked up in the config supplied or a `config:"field_name"` is looked up.
If items are found then they are converted from string to native types and set in opt.
All the field types in the struct must implement fmt.Scanner.
func StringToInterface ¶
StringToInterface turns in into an interface{} the same type as def
Types ¶
type Item ¶
type Item struct { Name string // snake_case Field string // CamelCase Num int // number of the field in the struct Value interface{} }
Item describes a single entry in the options structure