Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/loov/csvcolumn
CSV column reader
https://github.com/loov/csvcolumn
Last synced: 7 days ago
JSON representation
CSV column reader
- Host: GitHub
- URL: https://github.com/loov/csvcolumn
- Owner: loov
- License: mit
- Created: 2018-06-01T16:12:13.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-05T10:20:33.000Z (almost 5 years ago)
- Last Synced: 2024-11-08T21:55:14.434Z (2 months ago)
- Language: Go
- Size: 6.84 KB
- Stars: 2
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# csvcolumn
[![GoDoc](https://godoc.org/github.com/loov/csvcolumn?status.svg)](http://godoc.org/github.com/loov/csvcolumn)
csvcolumn package implements convenient CSV reading with column access.
Internally it uses https://golang.org/pkg/encoding/csv/,
which means it inherits all the same restrictions.``` go
const CSV = `Index,Age,Name
1,52,Alice
5,42,Bob
512,31,Charlie
`func Example() {
source := strings.NewReader(CSV)data := csvcolumn.NewReader(source)
data.LazyQuotes = true
name, age := data.String("Name"), data.Int("Age")for data.Next() && data.Err() == nil {
fmt.Println(*name, *age)
}if data.Err() != nil {
fmt.Println(data.Err())
}
}
```