utils

package
v0.0.0-...-f382dc8 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package util provides common utils.

Package util provides common utils.

Package util provides common utils.

Package util provides common utils.

Index

Constants

View Source
const (
	// DefaultLength is default length of generated password.
	DefaultLength = 8

	ConstRoundFloat float64 = 0.50000000001
)

Variables

This section is empty.

Functions

func DeleteItemInList

func DeleteItemInList(target string, input []string) []string

DeleteItemInList ...

func EncodeMD5

func EncodeMD5(value string) (string, error)

EncodeMD5 md5 encryption

func GenPass

func GenPass() string

GenPass generate a random password.

func GenPassWithLength

func GenPassWithLength(length int) string

GenPassWithLength generate a random password with length.

func GenUUID

func GenUUID() string

GenUUID generate an unique id string

func GenerateRandString

func GenerateRandString(l int) string

GenerateRandString returns a random string with given length.

func GetPhysicalNode

func GetPhysicalNode(instanceName string) string

GetPhysicalNode get maxq@adca-arch-q-1.vm return adca-arch-q-1.vm

func IsExistIntersection

func IsExistIntersection(s1 []string, s2 []string) bool

IsExistIntersection 检查 s1 字符串列表是否在 s2 字符串列表中存在

func IsExistStrings

func IsExistStrings(content string, ls []string) bool

IsExistStrings 检查 content 字符串是否在 ls 字符串列表中存在

func IsNilInterface

func IsNilInterface(i interface{}) bool

IsNilInterface returns if an interface contains nil type or value. See https://dev.to/pauljlucas/go-tcha-when-nil--nil-hic for detailed information.

func MapToList

func MapToList(input map[string]string) []string

MapToList ...

func MapToStr

func MapToStr(input map[string]string) string

MapToStr ...

func ParseRequest

func ParseRequest(req *http.Request, v interface{}) error

func ParseResponse

func ParseResponse(resp *http.Response, v interface{}) error

func RandBytes

func RandBytes(size int) ([]byte, error)

RandBytes generates a random, fixed-length byte array

func Random

func Random(min, max int) int

func RemoveRepeat

func RemoveRepeat(input []string) []string

RemoveRepeat ...

func Round

func Round(val float64, places int) float64

Round return float64 with places length after point

func StringListToUintList

func StringListToUintList(v []string) ([]uint, error)

StringListToUintList 字符串列表转换成 uint 列表

func TimeCost

func TimeCost() func() time.Duration

TimeCost 耗时统计

func ToMap

func ToMap(obj interface{}) map[string]interface{}

Types

This section is empty.

Directories

Path Synopsis
Package lock wraps the sync.Mutex and sync.RWMutex to log messages on deadlocks.
Package lock wraps the sync.Mutex and sync.RWMutex to log messages on deadlocks.

Jump to

Keyboard shortcuts

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