utils

package
v0.0.0-...-7f5f5d0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrContains

func ArrContains(a, b []string) bool

func CalculatePercentageInt32

func CalculatePercentageInt32(part, total int32) int32

func DecodeString

func DecodeString(content string, keyVal map[string]string) string

func GetFromContext

func GetFromContext(ctx context.Context) map[string]string

func GetFromContextByKey

func GetFromContextByKey(ctx context.Context, key MatedataKey) string

func GetLogFilePath

func GetLogFilePath() string

func GetServerStoragePathByNames

func GetServerStoragePathByNames(packageNames ...string) string

func IsValidKubernetesName

func IsValidKubernetesName(name string) bool

check string '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'

func MapToString

func MapToString(m map[string]string) string

MapToString converts a map[string]string to a comma-separated string

func Md5

func Md5(str string) string

func NewLog

func NewLog(conf *conf.Bootstrap) *logtool

func RemoveDuplicatesInt64

func RemoveDuplicatesInt64(slice []int64) []int64

func StringToMap

func StringToMap(s string) map[string]string

StringToMap converts a comma-separated string back to map[string]string

func StructTransform

func StructTransform(a, b proto.Message) error

Types

type GrpcConn

type GrpcConn struct {
	Conn *grpcConnect.ClientConn
	Ctx  context.Context
}

func (*GrpcConn) Close

func (g *GrpcConn) Close()

func (*GrpcConn) OpenGrpcConn

func (g *GrpcConn) OpenGrpcConn(ctx context.Context, addr string, port int32, timeoutsecond int64) (*GrpcConn, error)

type MatedataKey

type MatedataKey string
const (
	ServiceNameKey    MatedataKey = "service"
	ServiceVersionKey MatedataKey = "version"
	RuntimeKey        MatedataKey = "runtime"
	OSKey             MatedataKey = "os"
	ArchKey           MatedataKey = "arch"
	ConfKey           MatedataKey = "conf"
	ConfDirKey        MatedataKey = "confdir"
)

func (MatedataKey) String

func (m MatedataKey) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳