data

package
v2.6.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 9, 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 AWSSMPGetter

type AWSSMPGetter interface {
	GetParameter(*ssm.GetParameterInput) (*ssm.GetParameterOutput, error)
}

AWSSMPGetter - A subset of SSM API for use in unit testing

type Data

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

Data -

func NewData

func NewData(datasourceArgs []string, 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) Include

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

Include -

func (*Data) ReadSource

func (d *Data) ReadSource(source *Source, args ...string) ([]byte, error)

ReadSource -

type Source

type Source struct {
	Alias  string
	URL    *url.URL
	Ext    string
	Type   string
	Params map[string]string
	FS     vfs.Filesystem // used for file: URLs, nil otherwise
	HC     *http.Client   // used for http[s]: URLs, nil otherwise
	VC     *vault.Vault   // used for vault: URLs, nil otherwise
	KV     *libkv.LibKV   // used for consul:, etcd:, zookeeper: & boltdb: URLs, nil otherwise
	ASMPG  AWSSMPGetter   // used for aws+smp:, nil otherwise
	Header http.Header    // used for http[s]: URLs, nil otherwise
}

Source - a data source

func NewSource

func NewSource(alias string, URL *url.URL) (*Source, error)

NewSource - builds a &Source

func ParseSource

func ParseSource(value string) (*Source, error)

ParseSource -

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