utils

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FIBER_SERVER  = "fiber_server"
	FIBER_CACHE   = "fiber_cache"
	FIBER_STORAGE = "fiber_storage"
	SESSIONS      = "sessions"

	CACHE_CONTROL = "Cache-Control"
	NO_CACHE      = "no-cache"

	UA             = "USER-AGENT"
	PLATFORM       = "Sec-CH-UA-Platform"
	X_RECV_WINDOW  = "X-RECV-WINDOW"
	X_KAPI_SIGN    = "X-KAPI-SIGN"
	X_TIMESTAMP    = "X-TIMESTAMP"
	X_AUTH_EXPIRE  = "X-AUTH-EXPIRE"
	X_AUTH_USER    = "X-AUTH-USER" //username
	X_AUTH_KEY     = "X-AUTH-KEY"
	X_USER_SESSION = "x_user_session"
	WEEK_IN_MILLI  = int64(604800000)

	METHOD_GET  = "GET"
	METHOD_POST = "POST"
	DEV_ENV     = true
)

Variables

This section is empty.

Functions

func BoolToString

func BoolToString(value bool) string

func CheckError

func CheckError(err error)

func DeSerialize

func DeSerialize(data []byte) any

func Float64ToString

func Float64ToString(value float64) string

func GenerateRandomToken

func GenerateRandomToken(x int) string

func GenerateRandomTokenPlus

func GenerateRandomTokenPlus(x int, c string) string

func GetEnv

func GetEnv(key string) string

func GetTimeFromUnixTime

func GetTimeFromUnixTime(i int64) time.Time

func Hash

func Hash(data string) string

func Hmac256Signature

func Hmac256Signature(secret, data string) string

sign data with secrect key

func Int32ToString

func Int32ToString(value int32) string

func Int64ToString

func Int64ToString(value int64) string

func NewFromFiber

func NewFromFiber(a any, c *fiber.Ctx) int

func Recast

func Recast(a, b any) error

recast a to b

func Serialize

func Serialize(s any) []byte

func ServerErrorHandler

func ServerErrorHandler(ctx *fiber.Ctx, err error) error

func SetNoCacheControl

func SetNoCacheControl(c *fiber.Ctx)

func SlugToKeyword

func SlugToKeyword(slug string) string

func StringToBool

func StringToBool(value string) bool

func StringToFloat64

func StringToFloat64(value string) float64

func StringToInt32

func StringToInt32(value string) int32

func StringToInt64

func StringToInt64(value string) int64

Types

This section is empty.

Jump to

Keyboard shortcuts

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