manipulation

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrUnsupportedDataType = Error("unsupported data type")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CSVTransformer

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

func NewCSVTransformer

func NewCSVTransformer(tablifier Tablifier, cfg CSVTransformerConfig) *CSVTransformer

func (*CSVTransformer) Transform

func (t *CSVTransformer) Transform(ctx context.Context, pages <-chan []byte, w io.Writer) error

type CSVTransformerConfig

type CSVTransformerConfig struct {
	UseHeader bool   // True to use header as a first line
	Delimiter string // Field delimiter (set to ',' by default)
	UseCRLF   bool   // True to use \r\n as the line terminator
}

type DataTransformer

type DataTransformer interface {
	Transform(ctx context.Context, pages <-chan []byte, w io.Writer) error
}

DataTransformer transforms input data and writes it to the given writer

type Error

type Error string

func (Error) Error

func (e Error) Error() string

type JSONTablifier

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

JSONTablifier create table from input json bytes using the Remapper which must end up with json object where all properties are arrays that represent columns e.g. { "Name":["Alan","Alex","Boris"], "Age": [42, 49, 15] }

func NewJSONTablifier

func NewJSONTablifier(
	columnsRemapper Remapper,
	logger app.Logger,
	config *JSONTablifierConfig,
) *JSONTablifier

func (*JSONTablifier) Table

func (t *JSONTablifier) Table(in []byte) (*dframe.Table, error)

type JSONTablifierConfig added in v0.3.0

type JSONTablifierConfig struct {
	// Columns determines which columns should be added to the result
	// columns will be selected in the order in which they are specified
	Columns []string
}

type KazaamRemapper

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

func NewKazaamRemapper

func NewKazaamRemapper(k *kazaam.Kazaam) *KazaamRemapper

func (*KazaamRemapper) Remap

func (r *KazaamRemapper) Remap(in []byte) ([]byte, error)

type NoOpRemapper

type NoOpRemapper struct {
}

func NewNoOpRemapper

func NewNoOpRemapper() *NoOpRemapper

func (NoOpRemapper) Remap

func (n NoOpRemapper) Remap(in []byte) ([]byte, error)

type PDFTransformer

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

func NewPDFTransformer

func NewPDFTransformer(remapper Remapper, pageTemplate *template.Template) *PDFTransformer

func (*PDFTransformer) Transform

func (t *PDFTransformer) Transform(ctx context.Context, pages <-chan []byte, w io.Writer) error

type Remapper

type Remapper interface {
	Remap(in []byte) ([]byte, error)
}

type Tablifier

type Tablifier interface {
	Table(in []byte) (*dframe.Table, error)
}

Jump to

Keyboard shortcuts

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