util

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const INT32_MAX int32 = 1<<31 - 1
View Source
const INT32_MIN int32 = int32(0)
View Source
const INT64_MAX int64 = 1<<63 - 1
View Source
const INT64_MIN int64 = int64(0)
View Source
const INT_MAX = 1<<63 - 1
View Source
const INT_MIN int = 0
View Source
const UINT32_MAX uint32 = 1<<32 - 1
View Source
const UINT32_MIN uint32 = uint32(0)
View Source
const UINT64_MAX uint64 = 1<<64 - 1
View Source
const UINT64_MIN uint64 = uint64(0)
View Source
const UINT_MAX uint = ^uint(0)
View Source
const UINT_MIN uint = 0

Variables

This section is empty.

Functions

func CheckErr

func CheckErr(err error)

CheckErr error

func DisableThroughLogFilter

func DisableThroughLogFilter(ctx context.Context) context.Context

DisableThroughLogFilter 将LogFilterTag设置到context中,用于跨服务传递

func ExtractCallThroughMethod

func ExtractCallThroughMethod(ctx context.Context) string

ExtractCallThroughMethod ctx获取到上游接口名

func ExtractRequestAttr

func ExtractRequestAttr(ctx context.Context, key string) (value string, ok bool)

ExtractRequestAttr 将context中的metadata中的key-value提取出来

func ExtractServiceMethod

func ExtractServiceMethod(ctx context.Context) string

ExtractServiceMethod ctx获取到上游接口名

func FlatMap2Array

func FlatMap2Array(params map[string]interface{}) []interface{}

FlatMap2Array 将map转化为key-value数组

func InjectCallThroughMethod

func InjectCallThroughMethod(ctx context.Context, serviceMethod string) context.Context

InjectCallThroughMethod 将接口名注入到ctx,方面从下游能从ctx获取到上游接口名

func InjectRequestAttr

func InjectRequestAttr(ctx context.Context, key string, value string) context.Context

InjectRequestAttr 将key-value注入到context中的metadata中,一般用于请求链路上下文传递

func InjectServiceMethod

func InjectServiceMethod(ctx context.Context, serviceMethod string) context.Context

InjectServiceMethod 将接口名注入到ctx,方便从下游能从ctx获取到上游接口名

func List2Markdown

func List2Markdown(list []interface{}, ignoreTableHeaders ...bool) string

func NewContext

func NewContext(ctx context.Context) context.Context

NewContext 将context中的metadata中的key-value提取出来

func PrintPanicStack

func PrintPanicStack()

func RandomInt

func RandomInt() int

func RandomInt32

func RandomInt32() int32

func RandomInt64

func RandomInt64() int64

func RandomUint

func RandomUint() uint

func RandomUint32

func RandomUint32() uint32

func RandomUint64

func RandomUint64() uint64

Types

This section is empty.

Jump to

Keyboard shortcuts

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