Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultBufferSize = 1024
Functions ¶
This section is empty.
Types ¶
type Reader ¶
type Reader struct { Separator byte SkipHeading bool BufferSize int // contains filtered or unexported fields }
Reader implements a DSV reader that reads the pipe separated values that Bill outputs.
func NewReader ¶
NewReader returns a new Reader that reads from r. The number of expected fields per row can be specified so the parser can safely deal with fields containing line breaks. The buffer size may be specified post-instantiate but the default should be fine for most cases. If fields is left at zero, the first line will be used to set the expected field count for the rest of the document. This means that if the CSV is malformed
func (*Reader) ReadAll ¶
ReadAll reads all records and passes them to the specified function. This function will make no heap allocations in best case scenarios. The only time this function will allocate is if a field exceeds the default field buffer size of 1024, in which case the struct field `wrBuffer` will be resized to 1.5x the size. The other two potential allocation spots, are the two `append` calls in the switch blocks, these are allocated lazily as well as if the `rowBuffer` cell is at capacity and requires resizing to fit the new data.