Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder manages reading data from a CSV into tagged structs.
func NewDecoder ¶
NewDecoder initializes itself with the headers of the CSV file to build mappings to read data into structs.
func NewDecoderFromCSVReader ¶
NewDecoderFromCSVReader intializes a decoder using the given csv.Reader. This allows the caller to configure options on the csv.Reader (e.g. what delimiter to use) instead of using the defaults.
func (Decoder) MatchedHeaders ¶
MatchedHeaders returns an array of strings (headers) using the Decoder mappings created during decoder initialization. Returns an empty array when no headers are matched.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder manages writing a tagged struct into a CSV
func NewEncoder ¶
NewEncoder prepares mappings from struct to CSV based on struct tags.
func NewEncoderFromCSVWriter ¶
NewEncoderFromCSVWriter intializes an encoder using the given csv.Writer. This allows the caller to configure options on the csv.Writer (e.g. what delimiter to use) instead of using the defaults.