utl

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func Command

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

func Contains

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

func CopyFile

func CopyFile(srcFilePath, dstFilePath string) error

func Decrypt

func Decrypt(data string) (string, error)

func DifferenceFunc added in v1.0.3

func DifferenceFunc[T any](s1, s2 []T, key func(e T) string) ([]T, []T)

func Digest

func Digest(data string) string

func ElapsedTime

func ElapsedTime(method string, begin time.Time)

func Encrypt

func Encrypt(data string) (string, error)

func Eval added in v1.0.3

func Eval(expression string, args ...map[string]any) (any, error)

func Exist

func Exist(name string) bool

func ForParallel

func ForParallel[T any](s []T, iterate func(e T) error, callback func(i int), size int)

func GetIp

func GetIp() (string, error)

func GetMac

func GetMac() (string, error)

func GetPort

func GetPort(min, max int) int

func GlobDir added in v1.0.3

func GlobDir(name string, patterns ...string) []string

func HasPrefix

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

func HasSuffix

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

func HashFile added in v1.0.3

func HashFile(filePath string) (string, error)

func HashImage added in v1.0.3

func HashImage(filePath string) (uint64, error)

func HmacSha256

func HmacSha256(data string, secret string) string

func InsertAfter

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

func InsertBefore

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

func IntId

func IntId() int64

func MakeDir

func MakeDir(dirs ...string) error

func Md5

func Md5(data string) string

func ReadMetadata

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

func Remove

func Remove(names ...string) error

func RenameFile

func RenameFile(srcFilePath, dstFilePath string) error

func Replace

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

func Split

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

func TakeStream

func TakeStream(dstNames map[string]map[string]any, srcName string, srcArgs ...map[string]any) error

func TimeId

func TimeId() string

func Trim

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

func UnzipFile

func UnzipFile(srcFilePath string, dstFilePath ...string) error

func WriteMetadata

func WriteMetadata(srcFilePath, dstFilePath string, data map[string]any) error

func ZipFile

func ZipFile(srcFilePath string, dstFilePath ...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