utils

package
v2.1.49 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2025 License: MIT Imports: 19 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 CheckSign

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

func ConvertTimeByTimezone added in v2.1.32

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 added in v2.1.21

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

func ParseOffsetToLocation added in v2.1.32

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 added in v2.1.25

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

func RootPath

func RootPath() string

func SHA265String added in v2.0.3

func SHA265String(plaintext string) string

func ShowDurationString

func ShowDurationString(duration time.Duration) string

func Shuffle added in v2.1.8

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

func TimeCostLog

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

func ToString added in v2.1.9

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