utils

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSign

func BuildSign(params map[string]interface{}, secretKey string) string

func CheckIPv4Valid

func CheckIPv4Valid(ip string) bool

CheckIPv4Valid 判断字符串是否是有效的 IPv4 地址

func CheckPortValid

func CheckPortValid(port uint) bool

CheckPortValid 判断端口是否有效 (1 - 65535)

func CheckSign

func CheckSign(params map[string]interface{}, secretKey string) bool

func ConvertTimeByTimezone

func ConvertTimeByTimezone(timeStr string, targetLocation *time.Location) (string, error)

ConvertTimeByTimezone timeStr 支持格式 time.RFC3339 / ISO 8601 targetTZ 支持格式 GMT+08:00 / UTC+08:00

func MD5String

func MD5String(plaintext string) string

func Masked

func Masked(s string, maskedStr string) string

func ParseFile

func ParseFile(filePath string, resPtr interface{}) (err error)

func ParseOffsetToLocation

func ParseOffsetToLocation(targetZone string) (*time.Location, error)

ParseOffsetToLocation targetTZ 支持格式 GMT+08:00 / UTC+08:00

func RandFloat64

func RandFloat64() float64

func RandIntN

func RandIntN(n int) int

func RandIntStr

func RandIntStr(n int) string

func RandStr

func RandStr(n int) string

func RemoveDuplicates

func RemoveDuplicates[T comparable](list []T) []T

func RootPath

func RootPath() string

func SHA265String

func SHA265String(plaintext string) string

func ShowDurationString

func ShowDurationString(duration time.Duration) string

func Shuffle

func Shuffle[T any](list []T)

func TimeCostLog

func TimeCostLog(ctx context.Context, logField string) func()

func ToString

func ToString(val any) string

func UniqueID

func UniqueID() string

Types

This section is empty.

Jump to

Keyboard shortcuts

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