util

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildMysqlDSN

func BuildMysqlDSN(dbMap map[string]any) string

拼接mysqlDSN

func Contains

func Contains(arr []string, str string) bool

判断字符串是否在数组中

func GetClient

func GetClient() *resty.Client

GetClient 获取单例的 HTTP 客户端 使用resty.New()创建新的客户端

func GetClientIP

func GetClientIP(c *gin.Context) string

获取客户端IP

func ParseMap

func ParseMap(valueMap map[string]any, prefix string, result map[string]any)

递归解析 map[string]any,并返回一个 map 参数: valueMap: 需要解析的 map prefix: 前缀 result: 结果 map

func PrintFormat

func PrintFormat(obj any)

格式化打印

func PrintReqParams

func PrintReqParams(c *gin.Context)

打印请求体

func RandomTTL

func RandomTTL(seconds int) time.Duration

随机TTL,需要传入秒,在秒的基础上随机增加一些

func TimeToTimestamp

func TimeToTimestamp(fromDatetime string, fromTimezone string) (int64, error)

TimeToTimestamp 将事件字符串转换为 UTC 时间戳

Types

This section is empty.

Jump to

Keyboard shortcuts

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