Documentation ¶
Index ¶
- func CheckDirExists(path string) (exist bool, err error)
- func CheckFileExists(path string) (exist bool, err error)
- func CheckPathExists(path string) (exist bool, err error)
- func CopyDir(src string, dest string) error
- func CopyFile(src string, dest string) error
- func CopyStruct(src, dst interface{}) error
- func Download(url, filepath string) (err error)
- func EncodeURI(rawURL string) (string, error)
- func GetFileMd5(path string) (md5Val string, err error)
- func GetFilenameFromHeader(header http.Header) (string, error)
- func GetFuncName(fn interface{}) string
- func GetFuncNameWithPath(fn interface{}) string
- func Go(cb func())
- func LookupHost(dns, host string) (addrs []string, err error)
- func PrettyPrint(v interface{})
- func RandInt64(min, max int64) (num int64, err error)
- func RandomStr(n int) string
- func Retry(attempts int, sleep time.Duration, fn func() error) (err error)
- func Reverse[V any](s []V)
- func TailFile(path string, n int) (data []string, err error)
- func TailFileBySystemCommand(path string, n int) (data []string, err error)
- func TrimStruct(src interface{}) error
- type DownloadFileOption
- type DownloadFileResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckDirExists ¶ added in v0.1.4
CheckDirExists check if a directory exists
func CheckFileExists ¶
CheckFileExists check if a file exists
func CheckPathExists ¶ added in v0.1.4
CheckPathExists check if a path exists
func GetFileMd5 ¶
GetFileMd5 get file md5 string
func GetFilenameFromHeader ¶ added in v0.2.1
GetFilenameFromHeader get filename from header
func GetFuncNameWithPath ¶
func GetFuncNameWithPath(fn interface{}) string
GetFuncNameWithPath get function name with filepath
func LookupHost ¶ added in v0.2.0
LookupHost looks up the given host using the local resolver. It returns a slice of that host's addresses.
func TailFileBySystemCommand ¶ added in v0.1.9
TailFileBySystemCommand get last n line from a file use system command
func TrimStruct ¶
func TrimStruct(src interface{}) error
TrimStruct Remove spaces from both sides of a string in a struct
Types ¶
type DownloadFileOption ¶ added in v0.1.7
type DownloadFileOption struct { Headers map[string]string Timeout time.Duration IsReturnMD5 bool IsWithCancel bool }
DownloadFileOption download file option
type DownloadFileResult ¶ added in v0.1.7
type DownloadFileResult struct { Err error Md5 string Cancel context.CancelFunc }
DownloadFileResult dowload file result
func DownloadWithOptions ¶ added in v0.1.7
func DownloadWithOptions(url, filepath string, option DownloadFileOption) (result DownloadFileResult)
DownloadWithOptions download file with headers and return md5 string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.