util

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteCountBinary

func ByteCountBinary(b uint64) string

ByteCountBinary 把 Length 转换为文件大小, 自适应单位

func CheckStringInSlice

func CheckStringInSlice(item string, slice []string) bool

CheckStringInSlice 检查字符串是否在切片中

func ClearTempFile

func ClearTempFile(tempPath ...string) error

ClearTempFile 清理临时文件

func DeepCopyMap

func DeepCopyMap(original map[string]any) (map[string]any, error)

DeepCopyMap 深拷贝 map[string]any 类型的字典

func GenerateClipEncodedKey

func GenerateClipEncodedKey(k string, i int) string

func GenerateClipKey

func GenerateClipKey(k string, i int) string

func GenerateMergedKey

func GenerateMergedKey(k string) string

func GetFileSize

func GetFileSize(filePath string) int64

GetFileSize 获取文件大小

func HighlightString

func HighlightString(color Color, str string) string

HighlightString 高亮字符串

func KillProcessByName

func KillProcessByName(processName string) error

KillProcessByName 根据进程名杀死进程

func StringToStruct

func StringToStruct(str string, s interface{}) error

StringToStruct 字符串转结构体

func StructToMap

func StructToMap(s interface{}) (map[string]interface{}, error)

StructToMap 结构体转 map[string]interface{},请勿在有数字情况下使用,请使用反射

func StructToString

func StructToString(s interface{}) string

StructToString 结构体转字符串

Types

type Color

type Color string
const (
	GREEN   Color = "green"
	WHITE   Color = "white"
	YELLOW  Color = "yellow"
	RED     Color = "red"
	BLUE    Color = "blue"
	MAGENTA Color = "magenta"
	CYAN    Color = "cyan"
	RESET   Color = "reset"
)

Jump to

Keyboard shortcuts

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