util

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const SHOW_CONTENT_SIZE = 100

Variables

This section is empty.

Functions

func CurrentMillis

func CurrentMillis() int64

func DeepCopyMap

func DeepCopyMap(params map[string]string) map[string]string

func GetConfigCacheKey

func GetConfigCacheKey(dataId string, group string, tenant string) string

func GetDurationWithDefault

func GetDurationWithDefault(metadata map[string]string, key string, defaultDuration time.Duration) time.Duration

func GetGroupName

func GetGroupName(serviceName string, groupName string) string

func GetServiceCacheKey

func GetServiceCacheKey(serviceName string, clusters string) string

func GetStatusCode

func GetStatusCode(response *http.Response) string

get status code by response,default is NA

func GetUrlFormedMap

func GetUrlFormedMap(source map[string]string) (urlEncoded string)

func JsonToService

func JsonToService(result string) *model2.Service

func LocalIP

func LocalIP() string

func Md5

func Md5(content string) (md string)

func ToJsonString

func ToJsonString(object interface{}) string

func TransformObject2Param

func TransformObject2Param(object interface{}) (params map[string]string)

func TruncateContent

func TruncateContent(content string) string

Types

type Semaphore

type Semaphore struct {
	// contains filtered or unexported fields
}

func NewSemaphore

func NewSemaphore(concurrencyNum int) *Semaphore

func (*Semaphore) Acquire

func (this *Semaphore) Acquire()

func (*Semaphore) AvailablePermits

func (this *Semaphore) AvailablePermits() int

func (*Semaphore) Release

func (this *Semaphore) Release()

func (*Semaphore) TryAcquire

func (this *Semaphore) TryAcquire() bool

Jump to

Keyboard shortcuts

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