helpers

package
v0.0.0-...-976a174 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateToken

func CreateToken(userId string, secretKey string) (string, error)

func DecodeJSONBody

func DecodeJSONBody(w http.ResponseWriter, r *http.Request, dst interface{}) error

func FloatToString

func FloatToString(value float64) string

func FormatTimeToHHMMAMOrPM

func FormatTimeToHHMMAMOrPM(t time.Time) string

func FormatTimeToYYYYMMDD

func FormatTimeToYYYYMMDD(t time.Time) string

func GeneratePDF

func GeneratePDF(travelExpense *db.TravelExpense, fuel *db.Fuel) ([]byte, error)

func GeneratePassword

func GeneratePassword(password string) (string, error)

func IntToString

func IntToString(value int) string

func IsAdmin

func IsAdmin(role string) bool

func IsArrayEmpty

func IsArrayEmpty[T any](arr []T) bool

func IsDiesel

func IsDiesel(fuelType string) bool

func IsEmpty

func IsEmpty(s string) bool

func IsGasoline

func IsGasoline(fuelType string) bool

func IsGeneral

func IsGeneral(role string) bool

func IsManager

func IsManager(role string) bool

func IsProduction

func IsProduction(cfg *config.Config) bool

func IsValidFuelType

func IsValidFuelType(fuelType string) bool

func IsValidRole

func IsValidRole(role string) bool

func NewErrorResponse

func NewErrorResponse(w http.ResponseWriter, statusCode int, message string)

func ParseJSON

func ParseJSON(w http.ResponseWriter, data interface{}) error

func ParseToken

func ParseToken(token *jwt.Token, secretKey string) (string, error)

func ResponseHandler

func ResponseHandler[T any](w http.ResponseWriter, statusCode int, response T)

func VerifyPassword

func VerifyPassword(password string, hash string) bool

func VerifyToken

func VerifyToken(tokenString string, secretKey string) (*jwt.Token, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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