Documentation
¶
Index ¶
- func Address(col int, row int) string
- func ClearRows(wb *excelize.File, sheet string, start int, end int)
- func ColToInt(colName string) int
- func CopyRowsBetween(wb *excelize.File, sheet string, start int, end int)
- func Decode(input interface{}, result interface{}) error
- func Dir(names ...string) *paths.Path
- func GetIPs(includeLocalhost bool) []string
- func HeaderIndexByKeywords(rows [][]string, keywords []string) (int, []string, error)
- func IntToCol(index int) string
- func LogServer(https bool, port int)
- func MultipleFiles(c *gin.Context) []string
- func MultipleFilesWithTimestamp(c *gin.Context) []string
- func Percentage(value float32, min float32, max float32) (raw float32, safe float32)
- func ReadFirstSheetRaw(path string) ([][]string, error)
- func ToTimeHookFunc() mapstructure.DecodeHookFunc
- func TryFindMatch(pattern string, stringToMatch string) (*re.Match, error)
- func Write1[DataType any](wb *excelize.File, sheet string, colIndex int, rowIndex int, ...) []error
- func Write2[DataType any](wb *excelize.File, sheet string, colName string, rowIndex int, ...) []error
- type StringDict
- func ReadFirstSheet1(path string, headerIndex int, dataIndex int) ([](StringDict), error)
- func ReadFirstSheet2(path string, colNameExamples []string, dataIndexOffset int) ([](StringDict), error)
- func RowsToDict1(rows [][]string, headerIndex int, dataIndex int) [](StringDict)
- func RowsToDict2(rows [][]string, colNameExamples []string, dataIndexOffset int) ([](StringDict), error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dir ¶
func Dir(names ...string) *paths.Path
Dir 根据传入的目录名称依次在当前工作目录下创建目录,并返回最终目录的路径。 参数 names 为要创建的目录名称列表(可变参数)。 返回值为最终创建的目录的 *paths.Path 对象。
func GetIPs ¶
GetIPs returns a slice of IP addresses of the local machine. If includeLocalhost is true, it also includes "localhost" in the result. It filters out loopback addresses and only includes IPv4 addresses. Note: This function does not handle errors from net.InterfaceAddrs(). It is assumed that the caller will handle any potential errors. The function is useful for logging or displaying server addresses.
func HeaderIndexByKeywords ¶
*
- @param rows 二维字符串数组,每一行表示Excel中的一行数据
- @param keywords 关键词数组,用于确定标题行的位置
- @return 标题行索引、标题行数据、错误信息
func LogServer ¶
LogServer prints the server address in a formatted way. It takes a boolean indicating whether to use HTTPS and an integer for the port.
func MultipleFiles ¶
func Percentage ¶
获取百分比, 结果为0-100之间的值
func ToTimeHookFunc ¶
func ToTimeHookFunc() mapstructure.DecodeHookFunc
Types ¶
type StringDict ¶
func ReadFirstSheet1 ¶
func ReadFirstSheet1(path string, headerIndex int, dataIndex int) ([](StringDict), error)
*
- @param path Excel文件路径
- @param headerIndex 标题行索引
- @param dataIndex 数据行索引
- @return 转换后的字符串字典数组
func ReadFirstSheet2 ¶
func ReadFirstSheet2(path string, colNameExamples []string, dataIndexOffset int) ([](StringDict), error)
*
- @param path Excel文件路径
- @param colNameExamples 列名示例,用于确定标题行的位置
- @param dataIndexOffset 数据行索引的偏移量,用于确定数据行的位置
- @return 转换后的字符串字典数组
func RowsToDict1 ¶
func RowsToDict1(rows [][]string, headerIndex int, dataIndex int) [](StringDict)
*
- @param rows 二维字符串数组,每一行表示Excel中的一行数据
- @param headerIndex 标题行索引
- @param dataIndex 数据行索引
- @return 转换后的字符串字典数组
func RowsToDict2 ¶
func RowsToDict2(rows [][]string, colNameExamples []string, dataIndexOffset int) ([](StringDict), error)
*
@param rows 二维字符串数组,每一行表示Excel中的一行数据 @param colNameExamples 列名示例,用于确定标题行的位置 @param dataIndexOffset 数据行索引的偏移量,用于确定数据行的位置 @return 转换后的字符串字典数组