Documentation ¶
Overview ¶
Package record provides records for the charlatan package
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CSVRecord ¶
type CSVRecord struct {
// contains filtered or unexported fields
}
CSVRecord is a CSV record, i.e. a line from a CSV file
If created with a header its fields can be retrieved with their column name. In any case, one can use a "$N" field name, where N is the column index, starting at 0.
All values are retrieved as strings, and the special field "*" can be used to get a string representation of the record values.
func NewCSVRecord ¶
NewCSVRecord returns a new CSVRecord
func NewCSVRecordWithHeader ¶
NewCSVRecordWithHeader returns a new CSVRecord with the given header
func (*CSVRecord) ColumnNameIndex ¶
ColumnNameIndex searches the index of the column name in this record’s header. If it doesn’t have a header or if the column wasn’t found, the method returns -1. The column name match is case-sensitive, the first matching one is used.
type JSONRecord ¶
type JSONRecord struct { SoftMatching bool // contains filtered or unexported fields }
JSONRecord is a record for JSON objects.
It supports the special field "*", as in "SELECT * FROM x WHERE y", which returns the JSON as-is, except that the keys order is not garanteed.
If the SoftMatching attribute is set to true, non-existing fields are returned as null contants instead of failing with an error.
func NewJSONRecordFromDecoder ¶
func NewJSONRecordFromDecoder(dec *json.Decoder) (*JSONRecord, error)
NewJSONRecordFromDecoder creates a new JSONRecord from a JSON decoder