Read
Overview
Read parses CSV from r; the first row is used as column keys.
Part of the csv package — Node.js analog: papaparse.
Signature
go
func Read(ctx context.Context, r io.Reader) ([]map[string]string, error)Compare: Node.js · Standard Go · gox
js
// Typical papaparse pattern in Node.jsgo
r := csv.NewReader(f)
records, err := r.ReadAll()go
import "github.com/sahilkhaire/gox/csv"
rows, err := csv.Read(ctx, r, csv.ReadOptions{Header: true})Example
go
import "github.com/sahilkhaire/gox/csv"
rows, err := csv.Read(ctx, r, csv.ReadOptions{Header: true})Tips
Import github.com/sahilkhaire/gox/csv and call Read directly. See the comparison below for the standard library equivalent.
Standard library alternative
Use the standard library directly:
go
r := csv.NewReader(f)
records, err := r.ReadAll()