utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClickhouseDsnConvert

func ClickhouseDsnConvert(req string) (res string)

ClickhouseDsnConvert convert clickhouse-go v1.5 to v2.0

func DeepCopy

func DeepCopy(dst, src interface{}) error

深度拷贝

func Diff

func Diff(a map[string]interface{}, b map[string]interface{}) map[string]interface{}

Diff ..

func DiffList

func DiffList(source, dest interface{}, cmp func(a, b interface{}) bool) (res []interface{})

DiffList 求 source 和 dest 的 交/差集 此函数效率较低(O(n^2)),请在列表长度较小时使用

func DiffListToSlice

func DiffListToSlice(source, dest interface{}, cmp func(a, b interface{}) bool) (res interface{})

DiffListToSlice 求 source 和 dest 的 交/差集,返回类型和 source 相同

func FindIndex

func FindIndex(arr interface{}, item interface{}, cmp func(a, b interface{}) bool) (index int)

FindIndex 查找 item 在 arr 里的下标,通过 cmp 函数进行列表项相等判断 如果不存在则返回 -1

func GenerateFieldOrderRules

func GenerateFieldOrderRules(sql string) ([]string, bool)

func GetFilterK8SContainerdWrapLog

func GetFilterK8SContainerdWrapLog(s string) string

getFilterK8SContainerdWrapLog 过滤k8s containerd 包起来日志 containerd 日志有一些数据前缀,导致不是json,需要过滤一些数据 2023-10-12T16:27:56.359684537+08:00 stderr F {"lv":"info","ts":1697099276,"caller":"egorm@v1.0.6/interceptor.go:125","msg":"access","lname":"ego.sys","comp":"component.egorm","compName":"mysql.file","addr":"mysql-master:3306","method":"gorm:row","name":"svc_file.","cost":0.223,"tid":"","event":"normal"}

func Index

func Index(s, substr string) (string, int)

Index 根据数据匹配,获得后面的时间数据,"ts":"(.*)" "ts":"

func IndexParseTime

func IndexParseTime(line string) (string, int)

func IsSliceEqual

func IsSliceEqual(a, b interface{}) bool

func MD5Encode32

func MD5Encode32(str string) string

func ParseAppUrlAndSubUrl

func ParseAppUrlAndSubUrl(appUrl string) (string, string, error)

func PathExist

func PathExist(path string) (bool, error)

func PhoneSensitiveInfoRemove

func PhoneSensitiveInfoRemove(phone string) string

PhoneSensitiveInfoRemove ...

func RandomString

func RandomString(length int) string

func StringSliceWithoutRepeat

func StringSliceWithoutRepeat(source []string, notContainEmpty bool) []string

StringSliceWithoutRepeat 去除[]string 中的重复元素 source 源切片 notContainEmpty 是否不包含空字符串

func SundaySearch

func SundaySearch(s, p string, keys map[uint8]int) int

func TimeParse

func TimeParse(value string) *time.Time

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