anyframer

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SliceToFrame

func SliceToFrame(name string, input []any, columns []Column) (frame *data.Frame, err error)

func StructToFrame

func StructToFrame(name string, input any) (frame *data.Frame, err error)

func ToPointer

func ToPointer(value any) any

Types

type AnyFramer

type AnyFramer struct {
	Name         string      `json:"name,omitempty"`
	InputType    InputType   `json:"inputType,omitempty"`
	RawURL       string      `json:"rawUrl,omitempty"`
	Headers      http.Header `json:"headers,omitempty"`
	RootSelector string      `json:"rootSelector,omitempty"`
	Columns      []Column    `json:"columns,omitempty"`
	CSVOptions   CSVOptions  `json:"csvOptions,omitempty"`
}

AnyFramer defines the framer options

func (*AnyFramer) GuessType

func (options *AnyFramer) GuessType(input string) InputType

GuessType guesses the framer type from input string and other framer parameters such as RawURL, headers

func (*AnyFramer) ToFrame

func (framerOptions *AnyFramer) ToFrame(input any) (*data.Frame, error)

ToFrame converts the given input string or input interface to data frame

type CSVOptions

type CSVOptions struct {
	Delimiter          string   `json:"delimiter,omitempty"`
	Comment            string   `json:"comment,omitempty"`
	RelaxColumnCount   bool     `json:"relaxColumnCount,omitempty"`
	SkipLinesWithError bool     `json:"skipLinesWithError,omitempty"`
	NoHeaders          bool     `json:"noHeaders,omitempty"`
	Headers            []string `json:"headers,omitempty"`
}

CSVOptions ...

type Column

type Column struct {
	Selector   string       `json:"selector,omitempty"`
	Alias      string       `json:"alias,omitempty"`
	Format     ColumnFormat `json:"format,omitempty"`
	TimeFormat string       `json:"timeFormat,omitempty"`
}

Column ...

type ColumnFormat

type ColumnFormat string

ColumnFormat ...

const (
	// ColumnFormatString ...
	ColumnFormatString ColumnFormat = "string"
	// ColumnFormatNumber ...
	ColumnFormatNumber ColumnFormat = "number"
	// ColumnFormatBoolean ...
	ColumnFormatBoolean ColumnFormat = "boolean"
	// ColumnFormatTimeStamp ...
	ColumnFormatTimeStamp ColumnFormat = "timestamp"
	// ColumnFormatUnixMsecTimeStamp ...
	ColumnFormatUnixMsecTimeStamp ColumnFormat = "timestamp_epoch"
	// ColumnFormatUnixSecTimeStamp ...
	ColumnFormatUnixSecTimeStamp ColumnFormat = "timestamp_epoch_s"
)

type InputType

type InputType string

InputType ...

const (
	// InputTypeUnknown ...
	InputTypeUnknown InputType = "unknown"
	// InputTypeJSON ...
	InputTypeJSON InputType = "json"
	// InputTypeCSV ...
	InputTypeCSV InputType = "csv"
	// InputTypeTSV ...
	InputTypeTSV InputType = "tsv"
	// InputTypeHTML ...
	InputTypeHTML InputType = "html"
	// InputTypeXML ...
	InputTypeXML InputType = "xml"
)

Jump to

Keyboard shortcuts

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