utils

package
v0.0.0-...-eb1b356 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: GPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsFileSize

func AbsFileSize(path string) (int64, string)

func AppendStrFile

func AppendStrFile(content, filePath string) (n int, err error)

* 追加文件内容

func ContainsNum

func ContainsNum(str string) bool

func ContainsStr

func ContainsStr(str string, strArr []string) bool

func CopyFile

func CopyFile(dstName, srcName string) (written int64, err error)

* Copyfile

func ExecCommand

func ExecCommand(command string) ([]byte, error)

func Exist

func Exist(path string) error

func FileSize

func FileSize(path string) (int64, string)

func FilterEmoji

func FilterEmoji(str string) string

过滤 emoji 表情

func GetAbsDir

func GetAbsDir(path string) string

func GetCurrentDir

func GetCurrentDir(path string) string

func GetGuid

func GetGuid() (string, error)

func GetLocalAdder

func GetLocalAdder() string

func GetParentDir

func GetParentDir(dirctory string) string

func GetRandomName

func GetRandomName() string

func GetRandomString

func GetRandomString(lens int) string

生成随机字符串

func HTMLEncode

func HTMLEncode(rs string) string

func IsEmail

func IsEmail(b []byte) bool

func ListDir

func ListDir(dirPath string) (files []string, err error)

func ListFiles

func ListFiles(params ...string) (files []string, err error)

func Md5

func Md5(buf []byte) string

func Md5ToStr

func Md5ToStr(s string) string

func MergeString

func MergeString(args ...string) string

* * @des 拼接字符串 * @param args ...string 要被拼接的字符串序列 * @return string

func Password

func Password(len int, pwdO string) (pwd string, salt string)

func RandomCreateBytes

func RandomCreateBytes(n int, alphabets ...byte) []byte

RandomCreateBytes generate random []byte by specify chars.

func ReadAll

func ReadAll(filePath string) ([]byte, error)

func ShowNum

func ShowNum(str string) string

func SizeFormat

func SizeFormat(size float64) string

func StrFirstToLower

func StrFirstToLower(s string) string

*

  • 字符串首字母转化为小写

func StrFirstToUpper

func StrFirstToUpper(s string) string

*

  • 字符串首字母转化为大写

func StrTime

func StrTime(atime int64) string

* * @des 时间转换函数 * @param atime string 要转换的时间戳(秒) * @return string

func StringExtractNum

func StringExtractNum(str string) string

func Substr

func Substr(s string, pos, length int) string

func TarGz

func TarGz(srcDirPath, destFilePath string) error

func TimeStamp

func TimeStamp(str string) int64

func Token

func Token(m map[string]interface{}, name string, time int64) (token string, err error)

func UnGzip

func UnGzip(zipPath, destFolderPath string) (absolutePath string, err error)

func UnTarGz

func UnTarGz(srcFilePath, destDirPath string)

* Ungzip and untar from source file to destination directory you need check file exist before you call this function

func UnToken

func UnToken(tokenStr, name string) (m map[string]interface{}, errs error)

func Unicode

func Unicode(rs string) string

func Unzip

func Unzip(zipPath, destPath string) (err error)

func WalkDir

func WalkDir(dirPath, suffix string) (files []string, err error)

func WriterFile

func WriterFile(sourceFile, destFile string, isDeleteSourceFile bool) (errs error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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