hastycsv

package module
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2019 License: MIT Imports: 8 Imported by: 0

README

HastyCSV Build Status GoDoc

Fast, but not-fully-compliant (not even close!), CSV reader.

Usage

Take a look at the examples in this project's examples/ subdirectory. And then run them!

go run examples/example_1_read_from_stream.go
go run examples/example_2_read_from_file.go

Documentation

Overview

Package hastycsv is fast, simple, and NOT-RFC-4180-COMPLIANT CSV reader.

Take a look at README and code examples in https://github.com/cet001/hastycsv for usage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseUint32 added in v0.4.0

func ParseUint32(data []byte) (uint32, error)

ParseUint32() parses an ascii byte array into a uint32 value.

func ReadFile

func ReadFile(csvFilePath string, comma byte, nextRecord Next) error

Types

type Field

type Field struct {
	// contains filtered or unexported fields
}

Represents a field (encoded as a UTF-8 string) within a CSV record.

func (Field) Bytes added in v0.4.0

func (me Field) Bytes() []byte

Returns the backing byte slice of this field.

func (Field) Float32

func (me Field) Float32() float32

Parses this field as a float32.

func (Field) IsEmpty added in v0.3.0

func (me Field) IsEmpty() bool

Returns true if this field is empty.

func (Field) String

func (me Field) String() string

Returns this field as a string.

func (Field) ToLower

func (me Field) ToLower() Field

Interprets this field as an ASCII string and performs an in-place conversion to lowercase.

func (Field) Uint32

func (me Field) Uint32() uint32

Parses this field as a Uint32.

type Next added in v0.2.0

type Next func(i int, record []Field) error

Definition of a callback function that serves as a sequential record iterator. Read() and ReadFile() will stop reading the input records if this function returns an error.

type Reader

type Reader struct {
	// Comma is the field delimiter.
	// It is set to comma (',') by NewReader.
	// Comma cannot be \r or \n.
	Comma byte
	// contains filtered or unexported fields
}

Reads records from a CSV-encoded file or io.Reader.

func NewReader

func NewReader() *Reader

Returns a new Reader whose Delimiter is set to the comma character (',').

func (*Reader) Read

func (me *Reader) Read(r io.Reader, nextRecord Next) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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