gt_loader

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadCSV

func LoadCSV(ctx context.Context, path string, skipRows int, callback LoadCSVCallback) (err error)

LoadCSV 加载CSV文件 @param ctx 上下文 @param path 文件路径 @param skipRows 跳过的行数, 如果需要跳过1行, 则传入1 @param callback 回调函数

func LoadConfig

func LoadConfig(ctx context.Context, configFile string, callback LoadConfigCallback) (err error)

LoadConfig 使用viper加载配置文件 @param configFile string 配置文件路径 @param callback LoadConfigCallback 回调函数

func LoadExcel

func LoadExcel(ctx context.Context, path string, callback LoadExcelCallback) (err error)

LoadExcel @param ctx 上下文 @param path 文件路径 @param callback 回调函数

func LoadExcelSheet

func LoadExcelSheet(ctx context.Context, f *excelize.File, sheet string, skipRows int, callback LoadExcelSheetCallback) (err error)

LoadExcelSheet @param ctx 上下文 @param f 文件对象 @param sheet 表名 @param skipRows 跳过的行数, 如果需要跳过1行, 则传入1 @param callback 回调函数

Types

type LoadCSVCallback

type LoadCSVCallback func(index int, row []string) (err error)

LoadCSVCallback 加载CSV回调函数 @param index 行索引, 从0开始 @param row 行数据

type LoadConfigCallback

type LoadConfigCallback func(ctx context.Context, v *viper.Viper)

LoadConfigCallback 加载配置文件回调函数 @param v *viper.Viper

type LoadExcelCallback

type LoadExcelCallback func(f *excelize.File) (err error)

LoadExcelCallback @param f 文件对象

type LoadExcelSheetCallback

type LoadExcelSheetCallback func(index int, row []string) (err error)

LoadExcelSheetCallback @param index 行索引, 从0开始 @param row 行数据

Jump to

Keyboard shortcuts

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