util

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildClickhouseDSN added in v1.1.9

func BuildClickhouseDSN(dbMap map[string]any) string

BuildClickhouseDSN 拼接 ClickHouse DSN,自动处理特殊字符

func BuildMysqlDSN

func BuildMysqlDSN(dbMap map[string]any) string

BuildMysqlDSN 拼接 MySQL DSN,自动处理特殊字符

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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