godumper: github.com/ahmdrz/godumper Index | Files

package godumper

import "github.com/ahmdrz/godumper"

This library can dump slice , array and etc to CSV files.

Index

Package Files

godumper.go

Constants

const (
    XSLX int = 10 << iota
    CSV
)

type Dumper Uses

type Dumper struct {
    Header []string
    Type   interface{}
    Body   [][]string
    // contains filtered or unexported fields
}

Dumper , This struct contains Header , Type and Body. Header is header of CSV file. Body is 2D array for the body of CSV file. And Type is the type of interface which you want to dump.

func New Uses

func New(item interface{}, outputType int) (*Dumper, error)

New , This method return an error only if

Invalid input, input must be a struct

And return the Dumper struct as base of this library. The input must be a struct.

Todo : allow method to receive map values.

func (*Dumper) Dump Uses

func (dumper *Dumper) Dump(inputSet interface{}) error

Dump This method return error if :

	index out of range (body must be a child of header)
 not struct input for body
 input was not a slice or array

And after called , the body is ready for save or something else...

func (*Dumper) DumpAndSave Uses

func (dumper *Dumper) DumpAndSave(inputSet interface{}, output string) error

DumpAndSave This method return error if :

	index out of range (body must be a child of header)
 not struct input for body
 input was not a slice or array

And after called , the body is ready for save or something else...

func (*Dumper) Save Uses

func (dumper *Dumper) Save(filename string) error

Save This method return error if :

	can't create file.
 can't write header.
 can't write body

And after called , Header and Body will available in file.

Package godumper imports 5 packages (graph). Updated 2017-12-21. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).