utils

package
v0.0.36 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExcelColumn

type ExcelColumn struct {
	Title  string /* 标题 */
	Path   string /* 路径 */
	Column string /* 列 */
}

type Exporter

type Exporter struct {
	*excelize.File
	Columns    []ExcelColumn
	Sheet      string
	Index      int
	CurrentRow int

	Sheets []string
	// contains filtered or unexported fields
}

func NewExporter

func NewExporter(columns []ExcelColumn) *Exporter

func (*Exporter) AppendRow

func (e *Exporter) AppendRow(record interface{})

func (*Exporter) PrepareHeader

func (e *Exporter) PrepareHeader() *Exporter

func (*Exporter) Save

func (e *Exporter) Save()

func (*Exporter) WithColumns

func (e *Exporter) WithColumns(columns []ExcelColumn) *Exporter

func (*Exporter) WithCurrentRow

func (e *Exporter) WithCurrentRow(currentRow int) *Exporter

func (*Exporter) WithIndex

func (e *Exporter) WithIndex(index int) *Exporter

func (*Exporter) WithSheet

func (e *Exporter) WithSheet(sheet string) *Exporter

func (*Exporter) Write

func (e *Exporter) Write(ctx *gin.Context, prefix string, opts ...excelize.Options)

Write provides a function to write to an io.Writer.

type Importer

type Importer struct {
	*excelize.File
	Columns    []string
	Sheet      string
	Index      int
	CurrentRow int

	Sheets []string
	// contains filtered or unexported fields
}

func NewImporter

func NewImporter() *Importer

func (*Importer) PrepareHeader

func (e *Importer) PrepareHeader() *Importer

func (*Importer) ReadFile

func (e *Importer) ReadFile(fileName string, callback func([]map[string]string), batchInSize int) (err error)

func (*Importer) ReadReader

func (e *Importer) ReadReader(reader io.Reader, callback func([]map[string]string), batchInSize int) (err error)

func (*Importer) WithColumns

func (e *Importer) WithColumns(columns []string) *Importer

func (*Importer) WithCurrentRow

func (e *Importer) WithCurrentRow(currentRow int) *Importer

func (*Importer) WithIndex

func (e *Importer) WithIndex(index int) *Importer

func (*Importer) WithSheet

func (e *Importer) WithSheet(sheet string) *Importer

Jump to

Keyboard shortcuts

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