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 ToJSON(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)
- type Data
- func (d *Data) Cleanup()
- func (d *Data) Datasource(alias string, args ...string) (interface{}, error)
- func (d *Data) DatasourceExists(alias string) bool
- func (d *Data) DatasourceReachable(alias string, args ...string) bool
- func (d *Data) DefineDatasource(alias, value string) (string, error)
- func (d *Data) Include(alias string, args ...string) (string, error)
- type Source
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 ¶
type Data ¶
Data -
func (*Data) Cleanup ¶
func (d *Data) Cleanup()
Cleanup - clean up datasources before shutting the process down - things like Logging out happen here
func (*Data) Datasource ¶
Datasource -
func (*Data) DatasourceExists ¶
DatasourceExists -
func (*Data) DatasourceReachable ¶
DatasourceReachable - Determines if the named datasource is reachable with the given arguments. Reads from the datasource, and discards the returned data.
func (*Data) DefineDatasource ¶
DefineDatasource -