util

package
v0.0.0-...-09831c6 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendExcelFileByFunction

func AppendExcelFileByFunction(excelFile string, columns []string, f func() [][]string)

AppendExcelFileByFunction 覆盖写数据到excel文件中

func CheckFileExists

func CheckFileExists(filePath string) bool

func CheckInput

func CheckInput(tip string, choices ...string) (string, error)

func GetAllFileNames

func GetAllFileNames(directoryPath string, deepIntoSubDirOrNot bool) ([]string, error)

func GetNumbersFromString

func GetNumbersFromString(str string) (string, error)

func IsAllCharacterDigit

func IsAllCharacterDigit(str string) bool

func IsDirEmpty

func IsDirEmpty(name string) (bool, error)

func LongestCommonSubstr

func LongestCommonSubstr(s1, s2 string) string

LongestCommonSubstr 最长公共子串

func ReadExcelColumnNames

func ReadExcelColumnNames(excelFile string, sheetName string, headerIndex int) ([]string, error)

ReadExcelColumnNames 获取excel文件指定sheetName的列标题,headerIndex是列标题所在行(从0开始)

func ReadExcelFile

func ReadExcelFile(excelFile string, f func(int, []string) error, ignoreHeader bool) error

ReadExcelFile 读取电子表格的第一个sheet内容

func ReadExcelFileBySheetName

func ReadExcelFileBySheetName(excelFile string, sheetName string, startFrom int, f func(int, []string) error) error

func WriteExcelFile

func WriteExcelFile(excelFile string, headers []string, rows [][]string) error

WriteExcelFile 覆盖写数据到excel文件中

func WriteOrAppendExcelFile

func WriteOrAppendExcelFile(excelFile string, headers []string, rows [][]string, append bool) error

Types

type LoggerWriter

type LoggerWriter struct {
	// contains filtered or unexported fields
}

LoggerWriter 是一个实现了 io.Writer 接口的类型,它能够同时输出到终端和日志文件

func NewLoggerWriter

func NewLoggerWriter(filename string) *LoggerWriter

NewLoggerWriter 创建并返回一个 LoggerWriter 对象

func (*LoggerWriter) Close

func (lw *LoggerWriter) Close()

func (*LoggerWriter) Write

func (lw *LoggerWriter) Write(p []byte) (n int, err error)

Write 方法实现 io.Writer 接口,用于同时输出到终端和日志文件

Jump to

Keyboard shortcuts

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