Skip to content

Fast reader for delimiter-separated data

License

Notifications You must be signed in to change notification settings

cristalhq/dsvreader

Repository files navigation

dsvreader

build-img pkg-img version-img

Fast reader for delimiter-separated data in Go.

Features

See docs.

Install

Go version 1.17+

go get github.com/cristalhq/dsvreader

Example

bs := bytes.NewBufferString(
`foo\t42\n
bar\t123\n`)

r := dsvreader.NewTSV(bs)
for r.Next() {
    col1 := r.String()
    col2 := r.Int()
    fmt.Printf("col1=%s, col2=%d\n", col1, col2)
}

if err := r.Error(); err != nil {
    panic("unexpected error: %s", err)
}

See examples: example_test.go.

License

MIT License.