helper

package
v0.0.0-...-26336ce Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const Iso8601 = "2006-01-02"
View Source
const Rfc2822 = "Mon Jan 02 15:04:05 -0700 2006"
View Source
const Yyyymmddhhmmss = "2006/01/02 15:04:05"

Variables

View Source
var (
	RootPath = filepath.Join(filepath.Dir(b), "../..")
)

Functions

func CalcTimeRange

func CalcTimeRange(fromDate string, toDate string) int64

func CheckDirectoryExists

func CheckDirectoryExists(dir string) bool

func CheckHash

func CheckHash(hash string, secret string) error

func ConvertInterfaceToIntMap

func ConvertInterfaceToIntMap(i []interface{}) []int

func ConvertToBool

func ConvertToBool(any interface{}) bool

func ConvertToFloat64

func ConvertToFloat64(any interface{}) float64

func ConvertToInt

func ConvertToInt(any interface{}) int

func ConvertToInt64

func ConvertToInt64(any interface{}) int64

func ConvertToString

func ConvertToString(any interface{}) string

func ConvertToUint

func ConvertToUint(any interface{}) uint

func CreateHash

func CreateHash(secret string) string

func CreateMD5

func CreateMD5(secret interface{}) string

func CreateSHA1

func CreateSHA1(secret interface{}) string

func CreateUuid

func CreateUuid() string

func GetBytes

func GetBytes(key interface{}) ([]byte, error)

func GetFileContentType

func GetFileContentType(extension string) string

func GetFileExtensionByContentType

func GetFileExtensionByContentType(contentType string) string

func GetGinRequest

func GetGinRequest(c *gin.Context)

func GetJSON

func GetJSON(value interface{})

func GetOS

func GetOS() string

func GetPathSeparator

func GetPathSeparator() string

func GetPostJSON

func GetPostJSON(ctx *gin.Context)

func GetStructName

func GetStructName(s interface{}) string

func GetType

func GetType(value interface{})

func IsRunnigTest

func IsRunnigTest() bool

func IsValidUUID

func IsValidUUID(u string) bool

func MergeStringInterfaceMap

func MergeStringInterfaceMap(map1 map[string]interface{}, map2 map[string]interface{}) map[string]interface{}

func Pluck

func Pluck(any interface{}, key string) interface{}

func SliceToSet

func SliceToSet(any interface{}) interface{}

func ValidJSONWebToken

func ValidJSONWebToken(requestToken string) bool

Types

type Token

type Token struct {
	Token string `json:"token"`
	Exp   int64  `json:"exp"`
}

func CreateJWT

func CreateJWT(sercrt []byte, exp int64) *Token

Jump to

Keyboard shortcuts

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