csv

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package csv workers to read and write csv format

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

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

Decoder parse csv lines into key value pairs

func NewDecoder

func NewDecoder(opts DecoderOptions) *Decoder

NewDecoder return a new csv decoder with given options

func (*Decoder) Process

func (d *Decoder) Process(ctx context.Context, args selina.ProcessArgs) error

Process implements selina.Worker interface

type DecoderOptions

type DecoderOptions struct {
	Header  []string
	Comma   rune
	Comment rune
	Handler selina.ErrorHandler
	Codec   selina.Marshaler
}

DecoderOptions configure csv read format

type Encoder

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

Encoder transform messages into csv text

func NewEncoder

func NewEncoder(opts EncoderOptions) *Encoder

NewEncoder returns a new Encoder with given options

func (*Encoder) Process

func (e *Encoder) Process(ctx context.Context, args selina.ProcessArgs) error

Process implements selina.Worker interface

type EncoderOptions

type EncoderOptions struct {
	// Header acts as a filter, if a field is not in header is skipped
	Header []string
	// Comma default ,
	Comma rune
	// UseCRLF use \r\n instead of \n
	UseCRLF    bool
	Handler    selina.ErrorHandler
	ReadFormat selina.Unmarshaler
}

EncoderOptions configure csv encoding

Jump to

Keyboard shortcuts

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