csvhelper

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: MIT Imports: 8 Imported by: 0

README

csvhelper

Documentation

Index

Constants

View Source
const (
	TableTypeMap = iota
	TableTypeSlice
)
View Source
const TAG = "csv-field"

Variables

This section is empty.

Functions

func ReorganizeKeyField

func ReorganizeKeyField(keyField string) string

func SaveCSVByData

func SaveCSVByData[T saveValueType](filename string, source []map[string]T)

func SaveCSVByTable

func SaveCSVByTable(filename string, source CSVTable)

func StructBind

func StructBind(obj interface{}, data map[string]interface{}) error

func ToFloat32

func ToFloat32(value interface{}) float32

func ToFloat64

func ToFloat64(value interface{}) float64

func ToInt

func ToInt(value interface{}) int

func ToString

func ToString(value interface{}) string

Types

type CSVTable

type CSVTable interface {
	GetDataItem(interface{}) interface{}
	GetMapData() map[interface{}]interface{}
	GetSliceData() []interface{}
	SetKeyField(string)
	GetKeyField() string
	// contains filtered or unexported methods
}

func Load

func Load(filePath string, tableType int, keyField string, newRow func() interface{}) CSVTable

type DataModel

type DataModel interface {
	CSVDataBind(raw map[string]interface{})
}

Jump to

Keyboard shortcuts

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