Documentation ¶
Index ¶
- type NamedCsvReader
- type Record
- func (record *Record) GetBoolean(key string) bool
- func (record *Record) GetFloat32(key string) float32
- func (record *Record) GetFloat64(key string) float64
- func (record *Record) GetInt(key string) int
- func (record *Record) GetInt32(key string) int32
- func (record *Record) GetInt64(key string) int64
- func (record *Record) GetString(key string) string
- func (record *Record) GetTime(layout string, key string) time.Time
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NamedCsvReader ¶
type NamedCsvReader struct {
// contains filtered or unexported fields
}
Named csv reader represents the reader instance.
func NewReader ¶
func NewReader(file *os.File) *NamedCsvReader
NewReader returns a new named csv reader for the given file.
func (*NamedCsvReader) Read ¶
func (reader *NamedCsvReader) Read() chan *Record
Read advances the reader to the next record.
func (*NamedCsvReader) WithHeaders ¶
func (reader *NamedCsvReader) WithHeaders(headers ...string) *NamedCsvReader
WithHeaders configures the headers used to read the csv data.
type Record ¶
type Record struct { Error error // Error that occurend when reading the record, if any. RowNum int // The row number of the record *NamedCsvReader // contains filtered or unexported fields }
Record represents a single record of the named csv reader.
func (*Record) GetBoolean ¶
GetBoolean returns the value of the specified column as boolean. 1, t, T, TRUE, true, True, 0, f, F, FALSE, false, False as value. Any other value returns false.
func (*Record) GetFloat32 ¶
GetFloat32 returns the value of the specified column as float32. When no value is found it returns 0.
func (*Record) GetFloat64 ¶
GetFloat64 returns the value of the specified column as float64. When no value is found it returns 0.
func (*Record) GetInt ¶
GetInt returns the value of the specified column as int. When no value is found it returns 0.
func (*Record) GetInt32 ¶
GetInt32 returns the value of the specified column as int32. When no value is found it returns 0.
func (*Record) GetInt64 ¶
GetInt64 returns the value of the specified column as int64. When no value is found it returns 0.