data

package
v0.0.0-...-0f93d55 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTMLFilter

func HTMLFilter(input io.ReadCloser, filter string) ([]string, error)

HTMLFilter filters the input with the CSS selector string and returns the matching elements.

func JSONFilter

func JSONFilter(input io.ReadCloser, filter string) ([]interface{}, error)

JSONFilter filters the input with the CSS selector string and returns the matching elements.

func New

func New(urls []string, filter string, columns []types.ColumnSelector) (
	types.Source, error)

New creates a new data source for the URL.

func NewCSV

func NewCSV(input []io.ReadCloser, filter string,
	columns []types.ColumnSelector) (types.Source, error)

NewCSV creates a new CSV data source from the input.

func NewHTML

func NewHTML(input []io.ReadCloser, filter string,
	columns []types.ColumnSelector) (types.Source, error)

NewHTML creates a new HTML data source from the input.

func NewJSON

func NewJSON(input []io.ReadCloser, filter string,
	columns []types.ColumnSelector) (types.Source, error)

NewJSON creates a new JSON data source from the input.

Types

type CSV

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

CSV implements a data source from comma-separated values (CSV).

func (*CSV) Columns

func (c *CSV) Columns() []types.ColumnSelector

Columns implements the Source.Columns().

func (*CSV) Get

func (c *CSV) Get() ([]types.Row, error)

Get implements the Source.Get().

type Format

type Format int

Format specifies input data format.

const (
	FormatUnknown Format = iota
	FormatCSV
	FormatHTML
	FormatJSON
)

Known input data formats.

func (Format) String

func (f Format) String() string

type HTML

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

HTML implements a data source from HTML data.

func (*HTML) Columns

func (html *HTML) Columns() []types.ColumnSelector

Columns implements the Source.Columns().

func (*HTML) Get

func (html *HTML) Get() ([]types.Row, error)

Get implements the Source.Get().

type JSON

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

JSON implements a data source from JavaScript Object Notation (JSON).

func (*JSON) Columns

func (src *JSON) Columns() []types.ColumnSelector

Columns implements the Source.Columns().

func (*JSON) Get

func (src *JSON) Get() ([]types.Row, error)

Get implements the Source.Get().

type NewSource

type NewSource func(in []io.ReadCloser, filter string,
	columns []types.ColumnSelector) (types.Source, error)

NewSource defines a constructor for data sources.

type Resolver

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

Resolver resolves data format from input meta data.

func (Resolver) Format

func (r Resolver) Format() (Format, error)

Format returns the resolved input format.

func (*Resolver) ResolveMediaType

func (r *Resolver) ResolveMediaType(t string)

ResolveMediaType resolves the input format from content media type.

func (*Resolver) ResolvePath

func (r *Resolver) ResolvePath(path string)

ResolvePath resolves the input format from file path.

Jump to

Keyboard shortcuts

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