data

package
v2.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2018 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CSV

func CSV(args ...string) [][]string

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

func CSVByColumn(args ...string) (cols map[string][]string)

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

func CSVByRow(args ...string) (rows []map[string]string)

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 JSON

func JSON(in string) map[string]interface{}

JSON - Unmarshal a JSON Object

func JSONArray

func JSONArray(in string) []interface{}

JSONArray - Unmarshal a JSON Array

func TOML

func TOML(in string) interface{}

TOML - Unmarshal a TOML Object

func ToCSV

func ToCSV(args ...interface{}) string

ToCSV -

func ToJSON

func ToJSON(in interface{}) string

ToJSON - Stringify a struct as JSON

func ToJSONPretty

func ToJSONPretty(indent string, in interface{}) string

ToJSONPretty - Stringify a struct as JSON (indented)

func ToTOML

func ToTOML(in interface{}) string

ToTOML - Stringify a struct as TOML

func ToYAML

func ToYAML(in interface{}) string

ToYAML - Stringify a struct as YAML

func YAML

func YAML(in string) map[string]interface{}

YAML - Unmarshal a YAML Object

func YAMLArray

func YAMLArray(in string) []interface{}

YAMLArray - Unmarshal a YAML Array

Types

type Data

type Data struct {
	Sources map[string]*Source
	// contains filtered or unexported fields
}

Data -

func NewData

func NewData(datasourceArgs, headerArgs []string) (*Data, error)

NewData - constructor for 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

func (d *Data) Datasource(alias string, args ...string) (interface{}, error)

Datasource -

func (*Data) DatasourceExists

func (d *Data) DatasourceExists(alias string) bool

DatasourceExists -

func (*Data) DatasourceReachable added in v2.5.0

func (d *Data) DatasourceReachable(alias string, args ...string) bool

DatasourceReachable - Determines if the named datasource is reachable with the given arguments. Reads from the datasource, and discards the returned data.

func (*Data) DefineDatasource added in v2.7.0

func (d *Data) DefineDatasource(alias, value string) (*Source, error)

DefineDatasource -

func (*Data) Include

func (d *Data) Include(alias string, args ...string) (string, error)

Include -

type Source

type Source struct {
	Alias string
	URL   *url.URL
	// contains filtered or unexported fields
}

Source - a data source

func (*Source) String

func (s *Source) String() string

String is the method to format the flag's value, part of the flag.Value interface. The String method's output will be used in diagnostics.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL