Documentation
¶
Index ¶
- Constants
- func Contains[T comparable](slice []T, value T) bool
- func ConvertTypeToString[T any](value T) string
- func GenerateRandomNumber(lower, upper int64) (int64, error)
- func GetFunctionInfo(f interface{}, getInfoFn func() string) string
- func GetFunctionName(f interface{}) string
- func GetFunctionPath(f interface{}) string
- func GetGRPCAddress(address string) string
- func IsStringInSlice(list []string, item string) bool
- func RandomID(randomIDLenth int) string
- func SortKeys[K constraints.Ordered, V any](mapObj map[K]V) ([]K, error)
- func UUID() string
Constants ¶
const (
GRPCServiceTimeout = 3 * time.Minute
)
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
func Contains[T comparable](slice []T, value T) bool
Contains checks if the given slice contains the given value.
func ConvertTypeToString ¶
ConvertTypeToString converts the given value to string.
func GenerateRandomNumber ¶
GenerateRandomNumber generates a random positive number between lower and upper. The return value should be between [lower, upper), and error is nil when success. If the error is not nil, the return value is 0.
func GetFunctionInfo ¶
GetFunctionInfo take a function as interface{} and a function for getting the info.
func GetFunctionName ¶
func GetFunctionName(f interface{}) string
GetFunctionName returns the <package>.<function name> of the given function.
func GetFunctionPath ¶
func GetFunctionPath(f interface{}) string
GetFunctionPath returns the full path of the given function.
func GetGRPCAddress ¶
func IsStringInSlice ¶
IsStringInSlice checks if the given string 'item' is present in the 'list' of strings.
func RandomID ¶
RandomID returns a random string with the specified length. If the specified length is less than or equal to 0, the default length will be used.
Types ¶
This section is empty.