exchange: github.com/qor/exchange/backends/csv Index | Files

package csv

import "github.com/qor/exchange/backends/csv"

Index

Package Files

csv.go reader.go writer.go xlsx2csv.go

type CSV Uses

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

CSV CSV struct

func New Uses

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 Uses

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

NewReader new csv reader

func (*CSV) NewWriter Uses

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

NewWriter new csv writer

type Config Uses

type Config struct {
    TrimSpace bool
}

Config CSV exchange config

type Rows Uses

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

Rows CSV rows struct

func (Rows) Header Uses

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

Header CSV header column

func (*Rows) Next Uses

func (rows *Rows) Next() bool

Next read next rows from CSV

func (Rows) ReadRow Uses

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

ReadRow read row from CSV

func (*Rows) Total Uses

func (rows *Rows) Total() uint

Total CSV total rows

type Writer Uses

type Writer struct {
    *CSV

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

Writer CSV writer struct

func (*Writer) Flush Uses

func (writer *Writer) Flush() error

Flush flush all changes

func (*Writer) WriteHeader Uses

func (writer *Writer) WriteHeader() error

WriteHeader write header

func (*Writer) WriteRow Uses

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

WriteRow write row

Package csv imports 15 packages (graph) and is imported by 7 packages. Updated 2019-04-11. Refresh now. Tools for package owners.