readr

package
v0.0.0-...-7636381 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseCSV

func ParseCSV(filepath string, headerRows int, fieldMap *FieldIndexMap) ([]structs.PriceRecord, error)

ParseCSV reads a csv at the given filepath and converts it to pricing records we can examine

Types

type FieldIndexMap

type FieldIndexMap struct {
	UUID               int
	ProductID          int
	CustomerID         int
	PurchaseDate       int
	DocumentNumber     int
	DocumentLineNumber int
	Price              int
}

FieldIndexMap provides a structure which enables readr to find data fields in the csv provided. Seven fields are required to build records, but not all might be present in the data sent to this command. Use a negative value for readr to "build" the field using the row index.

var DefaultFieldMap FieldIndexMap = FieldIndexMap{
	UUID:               0,
	ProductID:          1,
	CustomerID:         2,
	PurchaseDate:       3,
	DocumentNumber:     4,
	DocumentLineNumber: 5,
	Price:              6,
}

Jump to

Keyboard shortcuts

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