utils

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendLine

func AppendLine(path string, line string) error

func CurrentPath added in v1.0.3

func CurrentPath() (string, error)

func DownloadUrl

func DownloadUrl(url string) string

func FileExist

func FileExist(path string) bool

func GetExeDir

func GetExeDir() string

GetExeDir 获取当前exe所在文件夹

func GetExeFullPath

func GetExeFullPath() string

GetExeFullPath 获取当前exe文件路径

func GetExeName

func GetExeName() string

GetExeName 获取当前exe文件名(包含后缀名)

func InitLog added in v1.0.3

func InitLog() (string, error)

func IsDir

func IsDir(path string) bool

func LoadProp

func LoadProp(path string) *properties.Properties

func LoadYaml added in v1.0.3

func LoadYaml(yamlPath string, config interface{}) error

func ReadLine

func ReadLine(filename string, lineHandler func(line string, lineno int) bool)

ReadLine 按行读取

func ReadLines

func ReadLines(filename string, sep string) []string

ReadLines 读取所有行 filename 文件名 sep 行分隔符

func ResolvePath

func ResolvePath(path string) string

ResolvePath 转换window路径分隔符为Unix路径分隔符

func SetLogPath

func SetLogPath(logPath string)

SetLogPath 设置日志路径

func SetLogPathAndPrefix

func SetLogPathAndPrefix(logPath string, prefix string) *os.File

SetLogPathAndPrefix 设置日志路径与前缀

func Shuffle added in v1.0.3

func Shuffle(ss []string)

func WriteLine

func WriteLine(path string, line string, append bool) error

func WriteLines

func WriteLines(path string, lines []string) error

Types

type FileFilter added in v1.0.3

type FileFilter func(path string, info fs.FileInfo) bool

type Pair added in v1.0.3

type Pair struct {
	K interface{} `yaml:"k" json:"k"`
	V interface{} `yaml:"v" json:"v"`
}

func WalkFileList added in v1.0.3

func WalkFileList(fpath string, filter FileFilter) ([]Pair, error)

Jump to

Keyboard shortcuts

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