package excel_import import "io" type ( Option func(*ImportExcel) Regex struct { Rule string //匹配正则 MatchBool bool //匹配结果为true抛错还是匹配为false抛错 Desc string //抛错内容 } ) func WithSpeedMod(speedMod bool) Option { return func(s *ImportExcel) { s.SpeedMod = speedMod } } func WithSliceLen(sliceLen uint) Option { return func(s *ImportExcel) { s.SliceLen = sliceLen } } func WithHeader(header []string) Option { return func(s *ImportExcel) { s.Header = header } } func WithTaskId(taskId string) Option { return func(s *ImportExcel) { s.TaskId = taskId } } func WithRowPicHandle(picSaveHandle func(pic *Pic) (url string, err error)) Option { return func(s *ImportExcel) { s.PicSaveHandle = picSaveHandle } } func WithDeleteOssHandle(deleteOssHandle func(ObjectName []string) (err error)) Option { return func(s *ImportExcel) { s.DeleteOssHandle = deleteOssHandle } } func WithGetFileObject(getFileObject func(fileObjectUrl string) (body io.ReadCloser, err error)) Option { return func(s *ImportExcel) { s.GetFileObject = getFileObject } } func WithTrimFiled(trimFiledMap []string) Option { return func(s *ImportExcel) { s.TrimFiled = trimFiledMap } } func WithFiledRegex(regexFiledMap map[string]*Regex) Option { return func(s *ImportExcel) { s.RegexFiledMap = regexFiledMap } } func WithExcelDownLoadUrl(url string) Option { return func(s *ImportExcel) { s.DownloadUrl = url } }