Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataType ¶
type DataType interface {
// Name returns the name of the datatype being used
Name() string
// Zero returns the zero value of the datatype
Zero() any
// Validate, validates that the assigned datatype works for the value
// that was passed in
// returns true/false if the value supplied is of the datatype used
Validate(v any) bool
// Format returns a formatted string of the value
// corresponding to the datatype used
Format(v any) string
// Parse attempts to convert the string value provided into the
// datattype assigned.
// Returns the converted datatype value as a string, int, bool, etc
// and error message if the string value could not be converted
Parse(s string) (any, error)
}
main datatype interface declares that any DataType used in mapping of fields must include the following methods
type FieldMap ¶
type FieldMap struct {
Fields []Field
}
func NewFieldMap ¶
Contstructor for new FieldMap returns a FieldMap
func (*FieldMap) GetFieldByIndex ¶
GetFieldByIndex functions like a _,ok idiom similar to GetFieldByName, but returns a field who's index matches the value passed into the function call
func (*FieldMap) GetFieldByName ¶
GetFieldByName functions like a _,ok idiom if the name passed in matches one of the fields on FieldMap, then it is returned if not, an empty Field is returned with False
type Option ¶
func WithIndex ¶
WithIndex specifies the index of the field (first is 0) this is to be used with DELIMITED files where the delimiter is later specified on the extraction engine.
ex: someField = NewField("MyField", StringType{}, WithIndex(0))
func WithOffset ¶
WithOffset specifies the start char (position 1 = 1) of the field followed by the length of the field. This is to be used with FIXED WIDTH files
ex: someField = NewField("MyField", StringType{}, WithOffset(1, 15))
type RowData ¶
type RowData struct{}
func ParseDelimitted ¶
ParseDelimitted iterates over a delimitted file for each row it creates a rowData struct (rd) per the field mapping provided
returns a slice of rowData structs in the order of the original file
type StringType ¶
type StringType struct{}
StringType implementation
func (StringType) Format ¶
func (s StringType) Format(v any) string
func (StringType) Name ¶
func (s StringType) Name() string
func (StringType) Validate ¶
func (s StringType) Validate(v any) bool
func (StringType) Zero ¶
func (s StringType) Zero() any