csv

package
v0.0.0-...-c02d1aa Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MalformedCSVFile, IsMalformedCSVFile = customerr.ErrorFactory(
	"The CSV file cannot be converted to the requested struct.",
)

Functions

func CSVFileSplitter

func CSVFileSplitter(src string, delim rune, comment rune) iter.Iter[[]string]

func CSVGenerator

func CSVGenerator(sep string, callback func(iter int) (string, bool)) string

func CSVToStruct

func CSVToStruct[R any](src iter.Iter[[]string], dateTimeFormat string) iter.Iter[R]

TODO - finish comment TODO - rename timeDate to dateTime (idiot) Only basic types are supported through the CSV interface (which mirrors the limitations of a CSV file). For things like arrays and maps JSON is far more expressive and less error prone. Supported types:

  • All integer types (int,int8,int16,int32,int64)
  • All unsigned integer types (uint,uint8,uint16,uint32,uint64)
  • All float types (float32,float64)
  • Strings
  • Booleans
  • TimeDate formats

The CSV file **MUST** have headers. Without this the structs fields cannot be set properly. If any columns are missing or there are blank values the corresponding values in the structs that are generated will be zero-value initialized.

func Flatten

func Flatten(elems iter.Iter[[]string], sep string) iter.Iter[string]

func StructToCSV

func StructToCSV[R any](elems iter.Iter[R],
	addHeaders bool,
	timeDateFormat string) iter.Iter[[]string]

Types

This section is empty.

Jump to

Keyboard shortcuts

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