Documentation
¶
Overview ¶
Package data contains functions that parse and produce data structures in different formats.
Supported formats are: JSON, YAML, TOML, and CSV.
Index ¶
- func CSV(args ...string) ([][]string, error)
- func CSVByColumn(args ...string) (cols map[string][]string, err error)
- func CSVByRow(args ...string) (rows []map[string]string, err error)
- func JSON(in string) (map[string]interface{}, error)
- func JSONArray(in string) ([]interface{}, error)
- func TOML(in string) (interface{}, error)
- func ToCSV(args ...interface{}) (string, error)
- func ToJSON2(in interface{}) (string, error)
- func ToJSONPretty(indent string, in interface{}) (string, error)
- func ToTOML(in interface{}) (string, error)
- func ToYAML(in interface{}) (string, error)
- func YAML(in string) (map[string]interface{}, error)
- func YAMLArray(in string) ([]interface{}, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CSV ¶
CSV - Unmarshal CSV parameters:
delim - (optional) the (single-character!) field delimiter, defaults to "," in - the CSV-format string to parse
returns:
an array of rows, which are arrays of cells (strings)
func CSVByColumn ¶
CSVByColumn - Unmarshal CSV in a Columnar form parameters:
delim - (optional) the (single-character!) field delimiter, defaults to "," hdr - (optional) comma-separated list of column names, set to "" to get auto-named columns (A-Z), omit to use the first line in - the CSV-format string to parse
returns:
a map of columns, indexed by the header name. values are arrays of strings
func CSVByRow ¶
CSVByRow - Unmarshal CSV in a row-oriented form parameters:
delim - (optional) the (single-character!) field delimiter, defaults to "," hdr - (optional) comma-separated list of column names, set to "" to get auto-named columns (A-Z), omit to use the first line in - the CSV-format string to parse
returns:
an array of rows, indexed by the header name
func ToJSONPretty ¶
ToJSONPretty - Stringify a struct as JSON (indented)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.