data

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	// contains filtered or unexported fields
}

func NewData

func NewData(sources ...*Source) *Data

func (*Data) Data

func (d *Data) Data() (interface{}, error)

func (*Data) Validate

func (d *Data) Validate() error

type FileOpener

type FileOpener struct {
	// contains filtered or unexported fields
}

func NewFileOpener

func NewFileOpener(path string) *FileOpener

func (FileOpener) Open

func (o FileOpener) Open() (io.ReadCloser, error)

type HTTPOpener added in v0.1.0

type HTTPOpener struct {
	// contains filtered or unexported fields
}

func NewHTTPOpener added in v0.1.0

func NewHTTPOpener(client *http.Client, url string) *HTTPOpener

func (HTTPOpener) Open added in v0.1.0

func (o HTTPOpener) Open() (io.ReadCloser, error)

type Opener

type Opener interface {
	Open() (io.ReadCloser, error)
}

type Parser

type Parser interface {
	Parse([]byte) (interface{}, error)
}
var JSON Parser = &jsonParser{}
var Raw Parser = &rawParser{}
var YAML Parser = &yamlParser{}

type ReaderOpener added in v0.1.0

type ReaderOpener struct {
	// contains filtered or unexported fields
}

func NewReaderOpener added in v0.1.0

func NewReaderOpener(reader io.Reader) *ReaderOpener

func (ReaderOpener) Open added in v0.1.0

func (o ReaderOpener) Open() (io.ReadCloser, error)

type Source

type Source struct {
	// contains filtered or unexported fields
}

func NewSource

func NewSource(key string, opener Opener, parser Parser) *Source

func (*Source) Data

func (s *Source) Data() (interface{}, error)

func (*Source) Key

func (s *Source) Key() string

Jump to

Keyboard shortcuts

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