Documentation ¶
Index ¶
- func AddFileSuffix(filename, suffix string) string
- func CopyFile(src string, dest string) (int64, error)
- func DeleteFiles(files []string)
- func DownloadFile(ctx context.Context, url string) (filename, mediaType string, data []byte, err error)
- func FileExists(path string) bool
- func FindLogFiles(path string) ([]string, []string, error)
- func GetFieldNameByTag(s interface{}, tag, value string) string
- func GetMapWithoutPrefix(set map[string]string, prefix string) map[string]string
- func GetOrElse(s string, def string) string
- func GetSystemDnsServer() string
- func IsDirectory(path string) (bool, error)
- func Map2String(m map[string]string) string
- func Partition(s string, sep string) (string, string, string)
- func PruneByTag(in interface{}, value string, tag string) (interface{}, error)
- func ReadFileLines(path string) ([]string, error)
- func RenameFiles(old []string, new []string)
- func ResolveSVCB(ctx context.Context, host string, server string) (string, uint16, error)
- func RuneSizeInString(s string) []int
- func SplitExt(path string) (string, string)
- func String2Map(s string) map[string]string
- func ZipFiles(filename string, files []string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFileSuffix ¶ added in v1.9.0
AddFileSuffix adds a suffix between the file name and the file extension
func DeleteFiles ¶
func DeleteFiles(files []string)
DeleteFiles removes the given file list ignoring errors
func DownloadFile ¶ added in v1.9.0
func DownloadFile(ctx context.Context, url string) (filename, mediaType string, data []byte, err error)
DownloadFile downloads a file from the given url
func FileExists ¶
FileExists checks whether the given path is a file
func FindLogFiles ¶
FindLogFiles returns the files and dates archived by date
func GetFieldNameByTag ¶
GetFieldNameByTag returns the field name of struct that match the given tag and value
func GetMapWithoutPrefix ¶ added in v1.16.0
func GetOrElse ¶ added in v1.7.1
GetOrElse returns the given string if it's non-empty, or returns the default string.
func GetSystemDnsServer ¶ added in v1.7.1
func GetSystemDnsServer() string
GetSystemDnsServer returns the dns server used by local system
func IsDirectory ¶ added in v1.8.0
IsDirectory determines if a file represented by `path` is a directory or not
func Map2String ¶
Map2String turns the map into string. The key value pairs are separated by equal sign. Each pair is separated by new line character.
func Partition ¶
Partition returns the left side of the separator, the separator and the right side of the separator.
func PruneByTag ¶
PruneByTag returns a copy of "in" that only contains fields with the given tag and value
func ReadFileLines ¶
ReadFileLines reads all lines in a file and returns a slice of string
func RenameFiles ¶
RenameFiles renames the given file list with new file list ignoring errors
func ResolveSVCB ¶ added in v1.15.0
ResolveSVCB resolves the SVCB resource record of a given host. SVCB RR provides the information needed to connect to a service. The function returns a string for the target IP or domain name, an uint16 for the port, and an error.
func RuneSizeInString ¶ added in v1.9.0
RuneSizeInString returns a slice of each character's size in the given string
func String2Map ¶
String2Map splits the string by new line character. Each line is partitioned by equal sign. The left side is the key while the right side is the value.
Types ¶
This section is empty.