importer

package
v2.26.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2024 License: CC0-1.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExcelFileType         = "excel"
	ExcelWorkbookFileType = "excel_workbook"
	CSVFileType           = "csv"
	UndefinedFileType     = ""

	ExcelExt         = ".xls"
	ExcelWorkbookExt = ".xlsx"
	CSVExt           = ".csv"
)

Variables

This section is empty.

Functions

func GetDataFromXls added in v2.22.0

func GetDataFromXls(file multipart.File) ([][]string, error)

func GetDataFromXlsx added in v2.22.0

func GetDataFromXlsx(file multipart.File, sheetName string) ([][]string, error)

func New

func New(opt ...ImportOptions) *importer

Types

type ImportOptions

type ImportOptions func(reader *importer)

func WithCtx

func WithCtx(ctx context.Context) ImportOptions

func WithExtFile

func WithExtFile(ext string) ImportOptions

func WithFile

func WithFile(file multipart.File) ImportOptions

func WithProcessFn

func WithProcessFn(fn processFn) ImportOptions

func WithProcessName added in v2.17.7

func WithProcessName(processName string) ImportOptions

func WithSentNotifToSlack

func WithSentNotifToSlack(sent bool, channel ...string) ImportOptions

func WithSheetName

func WithSheetName(sheetName string) ImportOptions

func WithStructDestination

func WithStructDestination(structDestination interface{}) ImportOptions

func WithTransaction

func WithTransaction(trx database.Transactions) ImportOptions

func WithWorker

func WithWorker(totalWorker int) ImportOptions

type ImportResult added in v2.18.0

type ImportResult struct {
	FailedList    map[string][]interface{} `json:"failed_list"`
	TotalData     int                      `json:"total_data"`
	TotalFailed   int                      `json:"total_failed"`
	ExecutionTime float64                  `json:"execution_time"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL