helpers

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Copyright The RAI Inc. The RAI Authors

Copyright The RAI Inc. The RAI Authors

Copyright The RAI Inc. The RAI Authors

Copyright The RAI Inc. The RAI Authors

Copyright The RAI Inc. The RAI Authors

Copyright The RAI Inc. The RAI Authors

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrFuncName

func CurrFuncName() string

Returns the name of the current running function.

func CurrVersion

func CurrVersion() string

Returns the current version, only support module mode binaries.

func DecodeJWT

func DecodeJWT(c echo.Context, claims jwt.Claims, secret string) error

ExtractUserInfoFromJWT extracts user info from JWT. It is faster than calling redis to get those info.

func EncodeJWT

func EncodeJWT(claims jwt.Claims, secret string) (string, error)

func ExtractJWTFromHeader

func ExtractJWTFromHeader(c echo.Context) string

ExtractJWTFromHeader returns the JWT token string from authorization header.

func FloatInRange

func FloatInRange(i, min, max float64) float64

TODO: Change to generic after go1.18 release

func GetRandomNumberFromRange

func GetRandomNumberFromRange(min, max int) int

func InterfaceStripTags

func InterfaceStripTags(data interface{}, trimSpace bool) interface{}

func IsFilesExistInDirectory

func IsFilesExistInDirectory(path string, filesToCheck []string) (bool, error)

`IsFilesExistInDirectory` function will check the files (filesToCheck) exist in a specific diretory or not.

func ParseBeanSystemFilesAndDirectorires

func ParseBeanSystemFilesAndDirectorires()

func PostDataStripTags

func PostDataStripTags(c echo.Context, trimSpace bool) (map[string]interface{}, error)

func StructStripTags

func StructStripTags(data interface{}, trimSpace bool) error

c.Logger().Info(test.Lastname)

Types

type CopyableMap

type CopyableMap map[string]interface{}

func (CopyableMap) DeepCopy

func (m CopyableMap) DeepCopy() map[string]interface{}

DeepCopy will create a deep copy of this map. The depth of this copy is all inclusive. Both maps and slices will be considered when making the copy. Keep in mind that the slices in the resulting map will be of type []interface{}, so when using them, you will need to use type assertion to retrieve the value in the expected type. Reference: https://stackoverflow.com/questions/23057785/how-to-copy-a-map/23058707

type CopyableSlice

type CopyableSlice []interface{}

func (CopyableSlice) DeepCopy

func (s CopyableSlice) DeepCopy() []interface{}

DeepCopy will create a deep copy of this slice. The depth of this copy is all inclusive. Both maps and slices will be considered when making the copy. Reference: https://stackoverflow.com/questions/23057785/how-to-copy-a-map/23058707

Jump to

Keyboard shortcuts

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