Documentation
¶
Overview ¶
Package exl
Excel binding to struct written in Go.(Only supports Go1.18+)
Index ¶
- Variables
- func Read[T ReadBind](reader io.Reader, filterFunc ...func(t T) (add bool)) ([]T, error)
- func ReadBinary[T ReadBind](bytes []byte, filterFunc ...func(t T) (add bool)) ([]T, error)
- func ReadExcel(file string, sheetIndex int, walk func(index int, rows *xlsx.Row)) error
- func ReadFile[T ReadBind](file string, filterFunc ...func(t T) (add bool)) ([]T, error)
- func Write[T WriteBind](file string, ts []T) error
- func WriteExcel(file string, data [][]string) error
- type ReadBind
- type ReadMetadata
- type WriteBind
- type WriteMetadata
- type Writer
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ReadBinary ¶
ReadBinary each row bind to `T`
func Write ¶
Write defines write []T to excel file
params: file,excel file full path
params: typed parameter T, must be implements exl.Bind
func WriteExcel ¶
WriteExcel defines write [][]string to excel
params: file, excel file pull path
params: data, write data to excel
Types ¶
type ReadBind ¶
type ReadBind interface{ ConfigureRM(rm *ReadMetadata) }
ReadBind defines read bind metadata
type ReadMetadata ¶
type ReadMetadata struct { TagName string // TagName: tag name SheetIndex int // SheetIndex: read sheet index HeaderRowIndex int // HeaderRowIndex: sheet header row index DataStartRowIndex int // DataStartRowIndex: sheet data start row index TrimSpace bool // TrimSpace: trim space left and right only on `string` type }
ReadMetadata defines read metadata
type WriteBind ¶
type WriteBind interface{ ConfigureWM(wm *WriteMetadata) }
WriteBind defines write bind metadata
type WriteMetadata ¶
type WriteMetadata struct { SheetName string // SheetName: default sheet name TagName string // TagName: tag name }
WriteMetadata defines write metadata
type Writer ¶ added in v1.2.0
type Writer struct {
// contains filtered or unexported fields
}
Writer define a writer for exl
func NewWriter ¶ added in v1.2.0
func NewWriter(options ...xlsx.FileOption) *Writer
NewWriter returns new exl writer
Click to show internal directories.
Click to hide internal directories.