fix(excel):修正部分文案,增加对于错误信息的JSON输出定义。
This commit is contained in:
parent
592e93b2c9
commit
21803bf832
|
@ -25,9 +25,9 @@ type ExcelAnalyzer[T any] struct {
|
|||
}
|
||||
|
||||
type ExcelAnalysisError struct {
|
||||
Row int
|
||||
Col int
|
||||
Err error
|
||||
Row int `json:"row"`
|
||||
Col int `json:"col"`
|
||||
Err error `json:"error"`
|
||||
}
|
||||
|
||||
func NewColumnRecognizer(tag string, patterns ...string) ColumnRecognizer {
|
||||
|
@ -137,7 +137,7 @@ func (a *ExcelAnalyzer[T]) Analysis(bean T) ([]T, []ExcelAnalysisError) {
|
|||
} else {
|
||||
v, err := strconv.Atoi(matchValue)
|
||||
if err != nil {
|
||||
errs = append(errs, ExcelAnalysisError{Row: rowIndex + 1, Col: recognizer.MatchIndex + 1, Err: fmt.Errorf("单元格内容应为不带小鼠的整数。%w", err)})
|
||||
errs = append(errs, ExcelAnalysisError{Row: rowIndex + 1, Col: recognizer.MatchIndex + 1, Err: fmt.Errorf("单元格内容应为不带小数的整数。%w", err)})
|
||||
actualField.SetInt(0)
|
||||
} else {
|
||||
actualField.SetInt(int64(v))
|
||||
|
|
Loading…
Reference in New Issue
Block a user