common

package
v0.0.0-...-cca27e0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

IP 本地IP地址

Functions

func GenId

func GenId(id ...string) string

GenId gen id

func GenId2

func GenId2() string

func GetLocIp

func GetLocIp() (net.IP, error)

GetLocIp get Local ip

func GetRequestId

func GetRequestId(ctx context.Context) string

GetRequestId GetTaskId

func GetSpanId

func GetSpanId(ctx context.Context) string

GetSpanId GetSpanId

func GroupList

func GroupList(max, batch int) <-chan [2]int

GroupList 将长度为max的数据切分开来,每部分batch个,最后不够batch有多少算多少 var tt = []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10} ch := GroupList(len(tt), 3)

for k := range ch {
    fmt.Println(k, tt[k[0]:k[1]])
}

func HumanDuration

func HumanDuration(t time.Duration) string

HumanDuration xx

func ParseId

func ParseId(id string) int64

func WithRequestId

func WithRequestId(ctx context.Context, requestId string) context.Context

WithRequestId append taskId to context

func WithSpanId

func WithSpanId(ctx context.Context, spanId string) context.Context

WithSpanId append SpanId to context

Types

This section is empty.

Jump to

Keyboard shortcuts

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