csv

package
v0.0.0-...-8e12e25 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2020 License: MIT Imports: 15 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CSV

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

CSV CSV struct

func New

func New(value interface{}, config ...Config) *CSV

New initialize CSV backend, config is option, the last one will be used if there are more than one configs

func (*CSV) NewReader

func (c *CSV) NewReader(res *exchange.Resource, context *qor.Context) (exchange.Rows, error)

NewReader new csv reader

func (*CSV) NewWriter

func (c *CSV) NewWriter(res *exchange.Resource, context *qor.Context) (exchange.Writer, error)

NewWriter new csv writer

type Config

type Config struct {
	TrimSpace bool
}

Config CSV exchange config

type Rows

type Rows struct {
	*CSV
	Resource *exchange.Resource
	// contains filtered or unexported fields
}

Rows CSV rows struct

func (Rows) Header

func (rows Rows) Header() (results []string)

Header CSV header column

func (*Rows) Next

func (rows *Rows) Next() bool

Next read next rows from CSV

func (Rows) ReadRow

func (rows Rows) ReadRow() (*resource.MetaValues, error)

ReadRow read row from CSV

func (*Rows) Total

func (rows *Rows) Total() uint

Total CSV total rows

type Writer

type Writer struct {
	*CSV

	Resource *exchange.Resource
	Writer   *csv.Writer
	// contains filtered or unexported fields
}

Writer CSV writer struct

func (*Writer) Flush

func (writer *Writer) Flush() error

Flush flush all changes

func (*Writer) WriteHeader

func (writer *Writer) WriteHeader() error

WriteHeader write header

func (*Writer) WriteRow

func (writer *Writer) WriteRow(record interface{}) (*resource.MetaValues, error)

WriteRow write row

Jump to

Keyboard shortcuts

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