utl

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Key = []byte("0123456789ABCDEFFEDCBA9876543210")
)

Functions

func Command

func Command(nameArgs ...string) (string, error)

命令

func Contains added in v1.0.20

func Contains(s string, substrs ...string) bool

包含

func CopyFile

func CopyFile(inFilePath, outFilePath string) error

拷贝文件

func Decrypt

func Decrypt(data string) (string, error)

解密

func Difference added in v1.0.20

func Difference[T any](s1, s2 []T, equal func(t1, t2 T) bool) ([]T, []T)

差异

func Digest

func Digest(data string) string

摘要

func Encrypt

func Encrypt(data string) (string, error)

加密

func Exist

func Exist(name string) bool

存在

func GetIp

func GetIp() (string, error)

获取Ip地址

func GetPort

func GetPort(min, max int) int

获取端口

func Glob added in v1.0.14

func Glob(patterns ...string) []string

查找

func HasPrefix added in v1.0.20

func HasPrefix(s string, prefixs ...string) bool

有否前缀

func HasSuffix added in v1.0.20

func HasSuffix(s string, suffixs ...string) bool

有否后缀

func HmacSha256

func HmacSha256(data string, secret string) string

HmacSha256

func InsertAfter added in v1.0.20

func InsertAfter(s string, findinserts ...string) string

插入之后

func InsertBefore added in v1.0.20

func InsertBefore(s string, findinserts ...string) string

插入之前

func IntId

func IntId() int64

整型编码

func MakeDir

func MakeDir(names ...string) error

制作目录

func Md5

func Md5(data string) string

Md5

func ReadMetadata added in v1.0.20

func ReadMetadata(filePath string) (map[string]any, error)

读取元数据

func Remove

func Remove(names ...string) error

删除

func RenameFile added in v1.0.6

func RenameFile(inFilePath, outFilePath string) error

重命名文件

func Replace

func Replace(s string, oldnews ...string) string

替换

func Split

func Split(s string, seps ...rune) []string

分割

func TakeStream

func TakeStream(outs map[string]map[string]any, in string, inArgs ...map[string]any) error

抓取流

func TimeId

func TimeId() string

时间编码

func Trim added in v1.0.20

func Trim(s string, cutsets ...string) string

删除

func UnzipFile

func UnzipFile(inFilePath string, outFilePath ...string) error

解压缩文件

func WriteMetadata added in v1.0.20

func WriteMetadata(inFilePath, outFilePath string, data map[string]any) error

写入元数据

func ZipFile

func ZipFile(inFilePath string, outFilePath ...string) error

压缩文件

Types

This section is empty.

Jump to

Keyboard shortcuts

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