Documentation ¶
Index ¶
- Variables
- type Error
- type ExcelLayout
- type FiledTagsParserTests
- type Layout
- func (l *Layout) AddError(err Error)
- func (l *Layout) AddErrors(errs []Error)
- func (l *Layout) AddRow(r interface{}) error
- func (l *Layout) CountRows() int
- func (l *Layout) GetErrors() []Error
- func (l *Layout) GetRows() []interface{}
- func (l *Layout) HasErrors() bool
- func (l *Layout) Iterate(fnc func(i int, r interface{}) error) error
- type Row
- type RowParserTests
- type StructParserTests
- type TestRow
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCommaSeparatedInvalid error = errors.New("invalid comma separated expected value")
View Source
var ErrDateFormatInvalid error = errors.New("invalid or unexpected datetime format")
View Source
var ErrDecimalInvalid error = errors.New("invalid integer value")
View Source
var ErrEmailValueRuleFail error = errors.New("email value rule validation fail")
View Source
var ErrExcelNoSheetFound error = errors.New("no sheet found on file")
ExcelLayout Errors
View Source
var ErrExcelValidationFail error = errors.New("file rows validation fail")
View Source
var ErrIntegerInvalid error = errors.New("invalid integer value")
View Source
var ErrMaxLengthValueRuleFail error = errors.New("max length rule fail")
View Source
var ErrMaxValueRuleFail error = errors.New("max value rule fail")
View Source
var ErrMinLengthValueRuleFail error = errors.New("min length rule fail")
View Source
var ErrMinValueRuleFail error = errors.New("min value rule fail")
View Source
var ErrNotUnique error = errors.New("value is not unique")
View Source
var ErrRegexInvalid error = errors.New("invalid regex value")
View Source
var ErrRegexRuleFail error = errors.New("regex matching rule fail")
View Source
var ErrRequiredValueRuleFail error = errors.New("value required rule fail")
View Source
var ErrTagEmptyFieldTag error = errors.New("empty \"excelLayout\" tag found")
View Source
var ErrTagInvalidMaxMinLengthValues error = errors.New("the \"maxLength\" value should be greater than \"minLength\" value tag entry")
View Source
var ErrTagInvalidMaxMinValues error = errors.New("the \"max\" value should be greater than \"min\" value tag entry")
View Source
var ErrTagMaxForbidden error = errors.New("the use of value \"max\" tag entry is not allow for strings")
View Source
var ErrTagMaxLengthForbidden error = errors.New("the use of value \"maxLength\" tag entry is not allow for numbers")
View Source
var ErrTagMinForbidden error = errors.New("the use of value \"min\" tag entry is not allow for strings")
View Source
var ErrTagMinLengthForbidden error = errors.New("the use of value \"minLength\" tag entry is not allow for numbers")
View Source
var ErrTagMissingColumnValue error = errors.New("expected value for \"column\" tag entry")
View Source
var ErrTagMissingDateFormatValue error = errors.New("expected value for \"dateformat\" tag entry")
View Source
var ErrTagMissingMaxLengthValue error = errors.New("expected value for \"maxLength\" tag entry")
View Source
var ErrTagMissingMaxValue error = errors.New("expected value for \"max\" tag entry")
View Source
var ErrTagMissingMinLengthValue error = errors.New("expected value for \"minLength\" tag entry")
View Source
var ErrTagMissingMinValue error = errors.New("expected value for \"min\" tag entry")
View Source
var ErrTagMissingRegexValue error = errors.New("expected value for \"regex\" tag entry")
View Source
var ErrTagNoFieldTag error = errors.New("no \"excelLayout\" tag found")
Parser Errors
View Source
var ErrUrlValueRuleFail error = errors.New("url value rule validation fail")
Functions ¶
This section is empty.
Types ¶
type ExcelLayout ¶
type ExcelLayout struct { Layout // contains filtered or unexported fields }
func (*ExcelLayout) GetFilePath ¶
func (l *ExcelLayout) GetFilePath() string
func (*ExcelLayout) ParseCells ¶
func (l *ExcelLayout) ParseCells(r interface{}, cells []string) []Error
func (*ExcelLayout) ParseStruct ¶
func (l *ExcelLayout) ParseStruct(r interface{}) []Error
func (*ExcelLayout) ReadFile ¶
func (l *ExcelLayout) ReadFile(rowType interface{}, filePath string) error
type FiledTagsParserTests ¶
type FiledTagsParserTests struct {
// contains filtered or unexported fields
}
*
- Field Tag Parser Test struct
type Layout ¶
type Layout struct { Rows interface{} IgnoreEmpty bool // contains filtered or unexported fields }
type RowParserTests ¶
type RowParserTests struct {
// contains filtered or unexported fields
}
*
- Row Parser Test struct
func (*RowParserTests) IsErrorExpected ¶
func (rt *RowParserTests) IsErrorExpected(e error) bool
*
- Check if an error is in expected errors list
type StructParserTests ¶
type StructParserTests struct {
// contains filtered or unexported fields
}
func (*StructParserTests) IsErrorExpected ¶
func (rt *StructParserTests) IsErrorExpected(e error) bool
*
- Check if an error is in expected errors list
type TestRow ¶
type TestRow struct { Row ID int `excelLayout:"column:A,required,min:1,unique"` Username string `excelLayout:"column:B,required,minLength:6"` Password string `excelLayout:"column:C,required,minLength:8"` Avatar string `excelLayout:"column:D,url"` Fullname string `excelLayout:"column:E,required,maxLength:25"` Email string `excelLayout:"column:F,required,email"` Age int `excelLayout:"column:G,required,min:18,max:50"` Key string `excelLayout:"column:H,required,regex:p([a-z]+)ch"` }
Click to show internal directories.
Click to hide internal directories.