Documentation
¶
Index ¶
- func ParseTargetsFromExcel(file *multipart.FileHeader) (string, error)
- type ExcelParser
- func (ep *ExcelParser) AsyncReadAllRows(ctx context.Context, sheet string) (<-chan []string, error)
- func (ep *ExcelParser) GetFileObject() *excelize.File
- func (ep *ExcelParser) ReadRows(ctx context.Context, sheet string, rowsNum int) (dataList [][]string, err error)
- func (ep *ExcelParser) Save(ctx context.Context) error
- func (ep *ExcelParser) WriteRow(ctx context.Context, sheet string, row int, data []interface{}) error
- func (ep *ExcelParser) WriteRows(ctx context.Context, sheet string, startRow int, data [][]interface{}) error
- type ParserWithOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseTargetsFromExcel ¶
func ParseTargetsFromExcel(file *multipart.FileHeader) (string, error)
Types ¶
type ExcelParser ¶
type ExcelParser struct {
// contains filtered or unexported fields
}
nolint
func NewExcelParser ¶
func NewExcelParser(ctx context.Context, filePath string, ops ...ParserWithOption) (*ExcelParser, error)
NewExcelParser 创建excel的解析器
func (*ExcelParser) AsyncReadAllRows ¶
AsyncReadAllRows 异步读取指定sheet的所有数据
func (*ExcelParser) GetFileObject ¶
func (ep *ExcelParser) GetFileObject() *excelize.File
func (*ExcelParser) ReadRows ¶
func (ep *ExcelParser) ReadRows(ctx context.Context, sheet string, rowsNum int) (dataList [][]string, err error)
rowsNum: 指定行数, 如果小于0, 则是所有行数据; 如果rowsNum>实际行数, 返回所有行数据
type ParserWithOption ¶
type ParserWithOption func(*ExcelParser)
func WithLogger ¶
func WithLogger(logg logger.Logger) ParserWithOption
Click to show internal directories.
Click to hide internal directories.