Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode decodes the contents of data into a pointer v. ext is the file extension for the format of data, which must be one of the following: toml, yaml or json. The last target of v pointed to must be a struct, map or empty interface. If no error occurs, v will be filled with the decoded data.
The process can be roughly divided into four steps: 1. Call function from different dependency packages to decode the data into a map[string]any value. 2. Build a tree of nodes from the top down, these nodes contain only value. 3. Assign metadata such as actual type to these nodes depending on the type of target. 4. Fill value to v depending on the metadata and value from nodes.
During the process, if occurs an empty interface that actual type cannot be determined, then treated it as a string.
Types ¶
This section is empty.