utils

package
v0.0.0-...-ecdb9b8 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const SECRET_KEY = "some_secret_key_val_123123"

Variables

This section is empty.

Functions

func CreateMap

func CreateMap(updateFields []string, updateValues ...interface{}) map[string]interface{}

func CtxToAuth

func CtxToAuth(c *fiber.Ctx) (string, string, error)

func GenerateJwtAdmin

func GenerateJwtAdmin(userId int, username string, password string) (string, int64, error)

func GenerateJwtStaff

func GenerateJwtStaff(userId int, username string, dutyLocationId int) (string, int64, error)

func GetTimeNowString

func GetTimeNowString() string

func JsonToMap

func JsonToMap(j interface{}) (map[string]interface{}, error)

func Max

func Max(a, b int) int

func Min

func Min(a, b int) int

func TimeInt64ToString

func TimeInt64ToString(timeInt int64) string

func ValidateJwtToken

func ValidateJwtToken(token string) (bool, error)

Types

type Claims

type Claims struct {
	Username       string `json:"username"`
	UserId         int    `json:"userId"`
	DutyLocationId int    `json:"dutyLocationId"`
	Password       string `json:"password"`
	UserType       string `json:"userType"`
	jwt.StandardClaims
}

func CtxToClaim

func CtxToClaim(c *fiber.Ctx) (*Claims, string, error)

Jump to

Keyboard shortcuts

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