excel

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportZip

func ExportZip[T comparable](dst io.Writer, excels []*Excel[T]) error

ExportZip export excel data to zip

func Import

func Import[T comparable](r io.Reader, opts ...excelize.Options) (datas []*T, err error)

Import excel data support type: string, int, int64, uint, float64 if you want to handle imported data, please implement Handle interface eg: func (User) ExcelHandle(users []*User) {}

Types

type Excel

type Excel[T comparable] struct {
	*excelize.File
	FileName     string
	Data         any
	Headers      []string
	HeaderMapper amap.AMap
	ExcelMapper  map[tag.GtField]string
	// contains filtered or unexported fields
}

func Export

func Export[T comparable](data any) (e *Excel[T], err error)

Export excel data

func NewExcel

func NewExcel[T comparable]() *Excel[T]

func (*Excel[T]) Export

func (f *Excel[T]) Export(data any) (err error)

func (*Excel[T]) Import

func (f *Excel[T]) Import(r io.Reader, opts ...excelize.Options) (datas []*T, err error)

type Handle

type Handle[T comparable] interface {
	ExcelHandle([]*T) error
}

Jump to

Keyboard shortcuts

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