data

package
v3.4.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2019 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CSV

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

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, err error)

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, err error)

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{}, error)

JSON - Unmarshal a JSON Object. Can be ejson-encrypted.

func JSONArray

func JSONArray(in string) ([]interface{}, error)

JSONArray - Unmarshal a JSON Array

func TOML

func TOML(in string) (interface{}, error)

TOML - Unmarshal a TOML Object

func ToCSV

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

ToCSV -

func ToJSON

func ToJSON(in interface{}) (string, error)

ToJSON - Stringify a struct as JSON

func ToJSONPretty

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

ToJSONPretty - Stringify a struct as JSON (indented)

func ToTOML

func ToTOML(in interface{}) (string, error)

ToTOML - Stringify a struct as TOML

func ToYAML

func ToYAML(in interface{}) (string, error)

ToYAML - Stringify a struct as YAML

func YAML

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

YAML - Unmarshal a YAML Object

func YAMLArray

func YAMLArray(in string) ([]interface{}, error)

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

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

func (d *Data) DefineDatasource(alias, value string) (string, 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