/csv

A CSV library that doesn't force you into allocations

Primary LanguageGoOtherNOASSERTION

CSV

GoDoc Build Status

CSV is a CSV library that doesn't force you to make allocations. The CSV writer in the standard library takes a slice of strings. If your CSV is made up of a whole load of floats, you'll need to create a lot of strings from the floats, and for a big CSV file this can cause a big problem with garbage. Similarly the CSV reader returns slices of strings, each of which will cause an allocation.

Example

w := NewWriter(os.Stdout)
// Write a header
w.String("header1")
w.String("header2")
w.String("header3")
_ = w.LineComplete()
w.String("cheese")
w.Float64(1.7)
w.Bool(true)
_ = w.LineComplete()
w.String("carrots")
w.Float64(3.14)
w.Bool(false)
_ = w.LineComplete()