util

package
v0.1.38 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const RFC3339FullDate = "2006-01-02"

RFC3339FullDate for rfc full date

Variables

This section is empty.

Functions

func AddExtraSpaceIfExist

func AddExtraSpaceIfExist(str string) string

AddExtraSpaceIfExist adds a separator

func CheckFileIsExist

func CheckFileIsExist(filename string) bool

CheckFileIsExist : check file if exist ,exist -> true , not exist -> false , *

  • @param filename string ,the file name need to check
  • @return boolean string

func DeleteExtraSpace

func DeleteExtraSpace(s string) string

DeleteExtraSpace remove extra space

func GRPCErrIsUnknownWrapper

func GRPCErrIsUnknownWrapper(err error) error

GRPCErrIsUnknownWrapper unknown err wrapper only will wrapper the error which is not be encoded P.S :this wrapper is used in grpc

func GenerateFiglet added in v0.1.3

func GenerateFiglet(word string) string

GenerateFiglet generate figlet

func GenerateSnowFlakeID

func GenerateSnowFlakeID(nodenumber int64) int64

GenerateSnowFlakeID generate snowflake id

func GetCurrentTime

func GetCurrentTime() time.Time

GetCurrentTime get current time

func GetCurrentTimeString

func GetCurrentTimeString(timeType string) string

GetCurrentTimeString get current time with string

func GetCurrentTimeUnix

func GetCurrentTimeUnix() int64

GetCurrentTimeUnix get current time with unix time

func GetFreePort

func GetFreePort() (int, error)

GetFreePort get one free port

func GetServiceID

func GetServiceID(projectName string, projectVersion string, ServiceIP string, ServicePort int) string

GetServiceID get service name which will register to service mesh

func GetServiceName

func GetServiceName(projectName string) string

GetServiceName get service name which will register to service mesh

func GetTypeName

func GetTypeName(myvar interface{}, isToLowerCase bool) string

GetTypeName to get struct type name

func Getparentdirectory

func Getparentdirectory(path string, level int) string

Getparentdirectory : get parent directory of the path ,

  • @param path string ,the path you want to get parent directory
  • @return string , the parent directory you need

func HTTPErrDecoder

func HTTPErrDecoder(err error) (bool, map[string]string)

HTTPErrDecoder decode

func HTTPErrEncoder

func HTTPErrEncoder(err error) error

HTTPErrEncoder encode http err only will wrapper the error which is not be encoded P.S :this wrapper is used in grpc

func RecordErrorLevelTwo

func RecordErrorLevelTwo() (uintptr, string, int)

RecordErrorLevelTwo login error and print line , func , and error to gin context

func SliceInSlice

func SliceInSlice(sliceToCheck []string, slice []string) bool

SliceInSlice if slice in slice

func StringContainsInSlice added in v0.1.2

func StringContainsInSlice(value string, stringSlice []string) bool

StringContainsInSlice if value in stringlist

func StringInSlice

func StringInSlice(value string, stringSlice []string) bool

StringInSlice if value in stringlist

Types

type RandomGenerater added in v0.0.50

type RandomGenerater interface {
	RandomString() string
}

RandomGenerater random generater interface{}

func NewRandomGenerater added in v0.0.50

func NewRandomGenerater(r *rand.Rand, len int) RandomGenerater

NewRandomGenerater new generater

type ValueStrategy added in v0.0.37

type ValueStrategy interface {
	Load(args ...interface{})
	HasValue() bool
	ZeroIndex() int
}

ValueStrategy interface

type ValueValidationImpl added in v0.0.37

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

ValueValidationImpl value validation imple

func (*ValueValidationImpl) IfHasNilValue added in v0.0.37

func (v *ValueValidationImpl) IfHasNilValue() bool

IfHasNilValue check all args if has value , if all has value , return true , elase return flase

func (*ValueValidationImpl) Load added in v0.0.37

func (v *ValueValidationImpl) Load(args ...interface{})

Load load args

func (*ValueValidationImpl) ZeroIndex added in v0.0.37

func (v *ValueValidationImpl) ZeroIndex() int

ZeroIndex return first zero index

Jump to

Keyboard shortcuts

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