Documentation
¶
Index ¶
- Variables
- func Read(c *ExcelReadContext, fun func(index int, row []string, err []CellErr) error) error
- func ReadModel[T any](c *ExcelReadContext, ...) error
- func Write(c *ExcelWriteContext, col []string) error
- func WriteModel[T any](t T) error
- type CellErr
- type ExcelReadContext
- func (c *ExcelReadContext) Close() error
- func (c *ExcelReadContext) ColNum(num int) *ExcelReadContext
- func (c *ExcelReadContext) Convert(fun func(index int, col []string) ([]string, error)) *ExcelReadContext
- func (c *ExcelReadContext) ConvertCell(col string, fun func(col string) (string, error)) *ExcelReadContext
- func (c *ExcelReadContext) DateCol(col ...string) *ExcelReadContext
- func (c *ExcelReadContext) DateTimeCol(col ...string) *ExcelReadContext
- func (c *ExcelReadContext) EnableAsync(maxWorkers int, queueSize int, rejectPolicy lcore.RejectPolicy) *ExcelReadContext
- func (c *ExcelReadContext) Panic() *ExcelReadContext
- func (c *ExcelReadContext) Sheet(sheet string) *ExcelReadContext
- func (c *ExcelReadContext) Skip(num int) *ExcelReadContext
- func (c *ExcelReadContext) SkipEmpty() *ExcelReadContext
- func (c *ExcelReadContext) TimeCol(col ...string) *ExcelReadContext
- func (c *ExcelReadContext) Url(url string) *ExcelReadContext
- type ExcelWriteContext
- type Field
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Write ¶
func Write(c *ExcelWriteContext, col []string) error
func WriteModel ¶
Types ¶
type CellErr ¶
type CellErr struct { Err string // 错误信息 Col string // 列 Row int // 行 Value string // excel cell 值 }
func (CellErr) IsRequiredErr ¶
func (CellErr) ToExcelCellName ¶
type ExcelReadContext ¶
type ExcelReadContext struct {
// contains filtered or unexported fields
}
func ExcelRead ¶
func ExcelRead() *ExcelReadContext
func (*ExcelReadContext) ColNum ¶
func (c *ExcelReadContext) ColNum(num int) *ExcelReadContext
ColNum 设置 列数,当列数不足,会填充空字符串
func (*ExcelReadContext) Convert ¶
func (c *ExcelReadContext) Convert(fun func(index int, col []string) ([]string, error)) *ExcelReadContext
Convert 行转换函数
func (*ExcelReadContext) ConvertCell ¶
func (c *ExcelReadContext) ConvertCell(col string, fun func(col string) (string, error)) *ExcelReadContext
col 列名,列转化函数
func (*ExcelReadContext) DateCol ¶
func (c *ExcelReadContext) DateCol(col ...string) *ExcelReadContext
DateCol 设置为时间格式 yyyy-MM-dd
func (*ExcelReadContext) DateTimeCol ¶
func (c *ExcelReadContext) DateTimeCol(col ...string) *ExcelReadContext
DateTimeCol 设置为时间格式 yyyy-MM-dd HH:mm:ss
func (*ExcelReadContext) EnableAsync ¶
func (c *ExcelReadContext) EnableAsync(maxWorkers int, queueSize int, rejectPolicy lcore.RejectPolicy) *ExcelReadContext
EnableAsync 启用异步
func (*ExcelReadContext) Panic ¶
func (c *ExcelReadContext) Panic() *ExcelReadContext
func (*ExcelReadContext) Sheet ¶
func (c *ExcelReadContext) Sheet(sheet string) *ExcelReadContext
func (*ExcelReadContext) Skip ¶
func (c *ExcelReadContext) Skip(num int) *ExcelReadContext
Skip 跳过几行
func (*ExcelReadContext) SkipEmpty ¶
func (c *ExcelReadContext) SkipEmpty() *ExcelReadContext
SkipEmpty 跳过空行
func (*ExcelReadContext) TimeCol ¶
func (c *ExcelReadContext) TimeCol(col ...string) *ExcelReadContext
TimeCol 设置为时间格式 yyyy-MM-dd HH:mm:ss
func (*ExcelReadContext) Url ¶
func (c *ExcelReadContext) Url(url string) *ExcelReadContext
type ExcelWriteContext ¶
type ExcelWriteContext struct {
// contains filtered or unexported fields
}
func ExcelWrite ¶
func ExcelWrite() *ExcelWriteContext
func (*ExcelWriteContext) Save ¶
func (c *ExcelWriteContext) Save() (string, error)
Save 关闭文件,返回文件路径
func (*ExcelWriteContext) Sheet ¶
func (c *ExcelWriteContext) Sheet(sheet string) *ExcelWriteContext
func (*ExcelWriteContext) Skip ¶
func (c *ExcelWriteContext) Skip(num int) *ExcelWriteContext
Skip 跳过几行
func (*ExcelWriteContext) Template ¶
func (c *ExcelWriteContext) Template(path string) *ExcelWriteContext
Source Files
¶
Click to show internal directories.
Click to hide internal directories.