mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-11-14 05:03:49 +08:00
1、泛型化参数,预留泛型约束,方便以后代码扩展的类型安全校验
2、升级goframe至v2.7.3
This commit is contained in:
@@ -30,7 +30,7 @@ var (
|
||||
)
|
||||
|
||||
// ExportByStructs 导出切片结构体到excel表格
|
||||
func ExportByStructs(ctx context.Context, tags []string, list interface{}, fileName string, sheetName string) (err error) {
|
||||
func ExportByStructs[T any](ctx context.Context, tags []string, list interface{}, fileName string, sheetName string) (err error) {
|
||||
f := excelize.NewFile()
|
||||
f.SetSheetName("Sheet1", sheetName)
|
||||
_ = f.SetRowHeight("Sheet1", 1, 30)
|
||||
@@ -94,7 +94,7 @@ func ExportByStructs(ctx context.Context, tags []string, list interface{}, fileN
|
||||
}
|
||||
|
||||
// 加入到上下文
|
||||
contexts.SetResponse(ctx, &model.Response{
|
||||
contexts.SetResponse(ctx, &model.Response[T]{
|
||||
Code: gcode.CodeOK.Code(),
|
||||
Message: "export successfully!",
|
||||
Timestamp: time.Now().Unix(),
|
||||
|
||||
Reference in New Issue
Block a user