Documentation ¶
Index ¶
- func GetMetaType(obj interface{}) reflect.Type
- type CSVReader
- type ContactGetter
- type CsvParser
- type ExampleContact1
- func (c1 ExampleContact1) GetAge() int
- func (c1 ExampleContact1) GetBirthdate() time.Time
- func (c1 ExampleContact1) GetDescription() string
- func (c1 ExampleContact1) GetEmail() string
- func (c1 ExampleContact1) GetFirstName() string
- func (c1 ExampleContact1) GetLastName() string
- func (c1 ExampleContact1) GetSalary32() float32
- func (c1 ExampleContact1) GetSalary64() float64
- func (c1 ExampleContact1) GetTitle() string
- func (c1 ExampleContact1) GetVacationDays() uint
- func (c1 ExampleContact1) GetWorking() bool
- type ExampleContact2
- func (c2 ExampleContact2) GetAge() int
- func (c2 ExampleContact2) GetBirthdate() time.Time
- func (c2 ExampleContact2) GetDescription() string
- func (c2 ExampleContact2) GetEmail() string
- func (c2 ExampleContact2) GetFirstName() string
- func (c2 ExampleContact2) GetLastName() string
- func (c2 ExampleContact2) GetSalary32() float32
- func (c2 ExampleContact2) GetSalary64() float64
- func (c2 ExampleContact2) GetTitle() string
- func (c2 ExampleContact2) GetVacationDays() uint
- func (c2 ExampleContact2) GetWorking() bool
- type ExampleContact3
- func (c3 ExampleContact3) GetAge() int
- func (c3 ExampleContact3) GetBirthdate() time.Time
- func (c3 ExampleContact3) GetDescription() string
- func (c3 ExampleContact3) GetEmail() string
- func (c3 ExampleContact3) GetFirstName() string
- func (c3 ExampleContact3) GetLastName() string
- func (c3 ExampleContact3) GetSalary32() float32
- func (c3 ExampleContact3) GetSalary64() float64
- func (c3 ExampleContact3) GetTitle() string
- func (c3 ExampleContact3) GetVacationDays() uint
- func (c3 ExampleContact3) GetWorking() bool
- type ExampleContactInvalidBoolean
- type ExampleContactInvalidFloat32
- type ExampleContactInvalidFloat64
- type ExampleContactInvalidInt
- type ExampleContactInvalidTime
- type ExampleContactInvalidUint
- type ExampleContactWithCsvColumnFieldTooHigh
- type ExampleContactWithCsvTagLessThanZero
- type ExampleContactWithCsvTagNotAnInteger
- type NoMarshalFuncError
- type NoUnmarshalFuncError
- type Stringer
- type TypeMarshaller
- type TypeUnmarshaller
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CSVReader ¶
func NewFileLoader ¶
type ContactGetter ¶
type ContactGetter interface { GetFirstName() string GetLastName() string GetWorking() bool GetAge() int GetSalary32() float32 GetSalary64() float64 GetVacationDays() uint GetTitle() string GetEmail() string GetBirthdate() time.Time GetDescription() string }
ContactGetter is a wrapper for the different types of contact structs we want to test
type CsvParser ¶
type CsvParser struct { CsvReader CSVReader CsvSeparator rune BindObject interface{} Setter func(field reflect.Value, colName string, raw string) bool }
CsvParser parses a csv file and returns an array of pointers the type specified
type ExampleContact1 ¶
type ExampleContact1 struct { FirstName string `csv:"0"` LastName string `csv:"1"` Working bool `csv:"2"` Age int `csv:"3"` Salary32 float32 `csv:"4"` Salary64 float64 `csv:"5"` VacationDays uint `csv:"6"` Title string `csv:"7"` Email string `csv:"8"` Birthdate time.Time `csv:"9" csvDate:"2006-01-02"` Description string `csv:"10"` }
ExampleContact1 specifies all the csv struct tag fields
func (ExampleContact1) GetAge ¶
func (c1 ExampleContact1) GetAge() int
func (ExampleContact1) GetBirthdate ¶
func (c1 ExampleContact1) GetBirthdate() time.Time
func (ExampleContact1) GetDescription ¶
func (c1 ExampleContact1) GetDescription() string
func (ExampleContact1) GetEmail ¶
func (c1 ExampleContact1) GetEmail() string
func (ExampleContact1) GetFirstName ¶
func (c1 ExampleContact1) GetFirstName() string
func (ExampleContact1) GetLastName ¶
func (c1 ExampleContact1) GetLastName() string
func (ExampleContact1) GetSalary32 ¶
func (c1 ExampleContact1) GetSalary32() float32
func (ExampleContact1) GetSalary64 ¶
func (c1 ExampleContact1) GetSalary64() float64
func (ExampleContact1) GetTitle ¶
func (c1 ExampleContact1) GetTitle() string
func (ExampleContact1) GetVacationDays ¶
func (c1 ExampleContact1) GetVacationDays() uint
func (ExampleContact1) GetWorking ¶
func (c1 ExampleContact1) GetWorking() bool
type ExampleContact2 ¶
type ExampleContact2 struct { FirstName string LastName string `csv:"1"` Working bool Age int Salary32 float32 Salary64 float64 VacationDays uint Title string `csv:"7"` Email string Birthdate time.Time `csv:"9" csvDate:"2006-01-02"` Description string `csv:"10"` }
ExampleContact2 specifies some of the csv struct tag fields
func (ExampleContact2) GetAge ¶
func (c2 ExampleContact2) GetAge() int
func (ExampleContact2) GetBirthdate ¶
func (c2 ExampleContact2) GetBirthdate() time.Time
func (ExampleContact2) GetDescription ¶
func (c2 ExampleContact2) GetDescription() string
func (ExampleContact2) GetEmail ¶
func (c2 ExampleContact2) GetEmail() string
func (ExampleContact2) GetFirstName ¶
func (c2 ExampleContact2) GetFirstName() string
func (ExampleContact2) GetLastName ¶
func (c2 ExampleContact2) GetLastName() string
func (ExampleContact2) GetSalary32 ¶
func (c2 ExampleContact2) GetSalary32() float32
func (ExampleContact2) GetSalary64 ¶
func (c2 ExampleContact2) GetSalary64() float64
func (ExampleContact2) GetTitle ¶
func (c2 ExampleContact2) GetTitle() string
func (ExampleContact2) GetVacationDays ¶
func (c2 ExampleContact2) GetVacationDays() uint
func (ExampleContact2) GetWorking ¶
func (c2 ExampleContact2) GetWorking() bool
type ExampleContact3 ¶
type ExampleContact3 struct { FirstName string LastName string Working bool Age int Salary32 float32 Salary64 float64 VacationDays uint Title string Email string Birthdate time.Time `csvDate:"2006-01-02"` Description string }
ExampleContact3 specifies any of the csv struct tag fields
func (ExampleContact3) GetAge ¶
func (c3 ExampleContact3) GetAge() int
func (ExampleContact3) GetBirthdate ¶
func (c3 ExampleContact3) GetBirthdate() time.Time
func (ExampleContact3) GetDescription ¶
func (c3 ExampleContact3) GetDescription() string
func (ExampleContact3) GetEmail ¶
func (c3 ExampleContact3) GetEmail() string
func (ExampleContact3) GetFirstName ¶
func (c3 ExampleContact3) GetFirstName() string
func (ExampleContact3) GetLastName ¶
func (c3 ExampleContact3) GetLastName() string
func (ExampleContact3) GetSalary32 ¶
func (c3 ExampleContact3) GetSalary32() float32
func (ExampleContact3) GetSalary64 ¶
func (c3 ExampleContact3) GetSalary64() float64
func (ExampleContact3) GetTitle ¶
func (c3 ExampleContact3) GetTitle() string
func (ExampleContact3) GetVacationDays ¶
func (c3 ExampleContact3) GetVacationDays() uint
func (ExampleContact3) GetWorking ¶
func (c3 ExampleContact3) GetWorking() bool
type ExampleContactInvalidBoolean ¶
type ExampleContactInvalidBoolean struct { FirstName string LastName bool //this is not a bool! Working bool Age int Salary32 float32 Salary64 float64 VacationDays uint Title string Email string Birthdate time.Time Description string }
ExampleContactInvalidBoolean is made for testing bool wrong field
type ExampleContactInvalidFloat32 ¶
type ExampleContactInvalidFloat32 struct { FirstName string LastName float32 //this is not an int! Working bool Age int Salary32 float32 Salary64 float64 VacationDays uint Title string Email string Birthdate time.Time Description string }
ExampleContactInvalidFloat32 is made for testing uint wrong field
type ExampleContactInvalidFloat64 ¶
type ExampleContactInvalidFloat64 struct { FirstName string LastName float64 //this is not an int! Working bool Age int Salary32 float32 Salary64 float64 VacationDays uint Title string Email string Birthdate time.Time Description string }
ExampleContactInvalidFloat64 is made for testing uint wrong field
type ExampleContactInvalidInt ¶
type ExampleContactInvalidInt struct { FirstName string LastName int //this is not an int! Working bool Age int Salary32 float32 Salary64 float64 VacationDays uint Title string Email string Birthdate time.Time Description string }
ExampleContactInvalidInt is made for testing uint wrong field
type ExampleContactInvalidTime ¶
type ExampleContactInvalidTime struct { FirstName string `csv:"0"` LastName string `csv:"1"` Working bool `csv:"2"` Age int `csv:"3"` Salary32 float32 `csv:"4"` Salary64 float64 `csv:"5"` VacationDays uint `csv:"6"` Title string `csv:"7"` Email string `csv:"8"` Birthdate time.Time `csv:"9" csvDate:"invalidDateFormat"` Description string `csv:"10"` }
ExampleContactInvalidTime is made for testing an invalid date format
type ExampleContactInvalidUint ¶
type ExampleContactInvalidUint struct { FirstName string LastName uint //this is not an uint! Working bool Age int Salary32 float32 Salary64 float64 VacationDays uint Title string Email string Birthdate time.Time Description string }
ExampleContactInvalidUint is made for testing uint wrong field
type ExampleContactWithCsvColumnFieldTooHigh ¶
type ExampleContactWithCsvColumnFieldTooHigh struct {
LastName string `csv:"1000"`
}
ExampleContactWithCsvColumnFieldTooHigh has a csv column tag that exceed the number of csv columns in a row
type ExampleContactWithCsvTagLessThanZero ¶
type ExampleContactWithCsvTagLessThanZero struct {
LastName string `csv:"-2"`
}
ExampleContactWithCsvTagLessThanZero has a csv column tag that is negative
type ExampleContactWithCsvTagNotAnInteger ¶
type ExampleContactWithCsvTagNotAnInteger struct {
LastName string `csv:"notAnInteger"`
}
ExampleContactWithCsvTagNotAnInteger has a csv column tag that is not an integer
type NoMarshalFuncError ¶
type NoMarshalFuncError struct {
// contains filtered or unexported fields
}
NoMarshalFuncError is the custom error type to be raised in case there is no marshal function defined on type
func (NoMarshalFuncError) Error ¶
func (e NoMarshalFuncError) Error() string
type NoUnmarshalFuncError ¶
type NoUnmarshalFuncError struct {
// contains filtered or unexported fields
}
NoUnmarshalFuncError is the custom error type to be raised in case there is no unmarshal function defined on type
func (NoUnmarshalFuncError) Error ¶
func (e NoUnmarshalFuncError) Error() string
type Stringer ¶
type Stringer interface {
String() string
}
Stringer is implemented by any value that has a String method This converter is used to convert the value to it string representation This converter will be used if your value does not implement TypeMarshaller
type TypeMarshaller ¶
TypeMarshaller is implemented by any value that has a MarshalCSV method This converter is used to convert the value to it string representation
type TypeUnmarshaller ¶
TypeUnmarshaller is implemented by any value that has an UnmarshalCSV method This converter is used to convert a string to your value representation of that string