attachment

package
v0.0.0-...-2b20d3d Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2022 License: MIT Imports: 7 Imported by: 0

README

Attachment

gin attachment middleware

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateExcel

func GenerateExcel(sheetName string, data interface{}) (buf bytes.Buffer, err error)

GenerateExcel 根据data数据结构生成Excel表格 data 是一个用户自定义结构的 slice 需要导出的字段拥有 header tag

type excelData struct {
	Username string `header:"username"`
	Sex      string `header:"sex"`
	Age      string `header:"age"`
}

func GenerateTable

func GenerateTable(slice interface{}) (data [][]string)

GenerateTable 根据用户自定义的 slice 生成表格类型数据

func GinExportExcel

func GinExportExcel(c *gin.Context, fileName string, data interface{})

GinExportExcel gin 附件导出中间件,根据 data 生成表格

Types

This section is empty.

Jump to

Keyboard shortcuts

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