utils

package
v0.0.0-...-84b6340 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BsonSanitize

func BsonSanitize(data *bson.M)

func ComparePassword

func ComparePassword(hashedPassword string, password string) bool

ComparePassword compares a hashed password with a plaintext password

func CreateTokenString

func CreateTokenString(userID primitive.ObjectID, username string, role string) (string, error)

func GenerateHTMLTemplate

func GenerateHTMLTemplate(code, p1, p2, p3 string) string

func GenerateRandomString

func GenerateRandomString(length int) (string, error)

GenerateRandomString generates a random string of the given length

func GetIntQueryParam

func GetIntQueryParam(param string) (int, error)

func HashPassword

func HashPassword(password string) string

HashPassword hashes a password using bcrypt

func PetSanitize

func PetSanitize(pet *models.Pet)

func SanitizeString

func SanitizeString(data string) string

func UnescapeString

func UnescapeString(data string) string

func UserSaniatize

func UserSaniatize(user *models.User)

func ValidateArrayQueryParam

func ValidateArrayQueryParam(param []string) ([]string, error)

func ValidateBase64Image

func ValidateBase64Image(base64Image string) (*[]string, error)

func ValidateEmail

func ValidateEmail(email string) bool

ValidateEmail checks if a string is a valid email address

func ValidateStringQueryParam

func ValidateStringQueryParam(param string) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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