utils

package
v2.0.9 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: Apache-2.0 Imports: 13 Imported by: 5

Documentation

Index

Constants

View Source
const (
	XRequestId      = "x-request-id"
	XB3TraceId      = "x-b3-traceid"
	XB3SpanId       = "x-b3-spanid"
	XB3ParentSpanId = "x-b3-parentspanid"
	XB3Sampled      = "x-b3-sampled"
	XB3Flags        = "x-b3-flags"
	B3              = "b3"
	XOtSpanContext  = "x-ot-span-context"
)
View Source
const (
	ReleaseEnv = "onl"
)

Variables

This section is empty.

Functions

func Cmd added in v2.0.9

func Cmd(commandName string, params []string) (string, error)

Cmd 执行命令

func CmdDir added in v2.0.9

func CmdDir(dir string, commandName string, params []string) (string, error)

CmdDir 指定目录执行命令

func CmdDirToShow added in v2.0.9

func CmdDirToShow(dir string, commandName string, params []string, f func(string)) error

CmdDirToShow 指定目录执行命令,并且处理每一条返回

func Either added in v2.0.9

func Either(list ...string) string

Either 返回一个存在的字符串

func GetDate

func GetDate() string

GetDate 返回当前时间

func GetRunTime

func GetRunTime() string

GetRunTime 获取当前系统环境

func IsRelease added in v2.0.3

func IsRelease() bool

func PrintBanner added in v2.0.2

func PrintBanner(name string)

func Random added in v2.0.2

func Random(l int, randomRange string) string

Random 随机字符串指定范围

func Random09 added in v2.0.2

func Random09(l int) string

Random09 随机字符串 0-9

func Random0Z added in v2.0.2

func Random0Z(l int) string

Random0Z 随机字符串 0~Z

func RandomI added in v2.0.2

func RandomI(min int, max int) int

RandomI 随机数

func RandomI64 added in v2.0.2

func RandomI64(min int, max int) int64

RandomI64 随机数

func Retry added in v2.0.2

func Retry(fc func() error, maxRetries int, interval time.Duration) error

Retry 重试 func 最大次数,间隔

Types

type TraceHeader added in v2.0.2

type TraceHeader struct {
	HttpHeader http.Header
	GrpcMd     metadata.MD
}

func SetGrpc added in v2.0.2

func SetGrpc(ctx context.Context) *TraceHeader

func SetHeader added in v2.0.2

func SetHeader(header interface{}) *TraceHeader

func SetHttp added in v2.0.2

func SetHttp(header http.Header) *TraceHeader

type TypeTransform added in v2.0.2

type TypeTransform struct {
	Value interface{}
}

func Transform added in v2.0.2

func Transform(v interface{}) *TypeTransform

func (*TypeTransform) Bool added in v2.0.2

func (t *TypeTransform) Bool() bool

func (*TypeTransform) Float64 added in v2.0.2

func (t *TypeTransform) Float64() float64

func (*TypeTransform) Int added in v2.0.2

func (t *TypeTransform) Int() int

func (*TypeTransform) Int64 added in v2.0.2

func (t *TypeTransform) Int64() int64

func (*TypeTransform) Slice added in v2.0.2

func (t *TypeTransform) Slice() []interface{}

func (*TypeTransform) SliceString added in v2.0.2

func (t *TypeTransform) SliceString() []string

func (*TypeTransform) String added in v2.0.2

func (t *TypeTransform) String() string

Directories

Path Synopsis
cryption
aes
des

Jump to

Keyboard shortcuts

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