utils

package
v0.0.0-...-474b416 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: 0BSD Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttachCookiesToResponse

func AttachCookiesToResponse(env *core.Env, accessTokenJWT, refreshTokenJWT string, c *gin.Context)

func CalculateDistance

func CalculateDistance(lon1, lat1, lon2, lat2 float64) float64

CalculateDistance calculate the distance between 2 coordinates.

func CalculateMatchPercentage

func CalculateMatchPercentage(
	wg *sync.WaitGroup,
	resultChan chan models.MatchCalculationResult,
	userAnswers map[int]*models.Answer,
	otherAnswers map[int]*models.Answer,
	otherProfile models.Profile,
)

func ConvertImageToBase64

func ConvertImageToBase64(input multipart.File) (string, error)

func CoordinatesStringToPairFloat64

func CoordinatesStringToPairFloat64(coordinates string) (float64, float64, error)

CoordinatesStringToPairFloat64 convert coordinates (longitude, latitude) string to pair float64.

func EmploymentIDToOrgIDUserEmail

func EmploymentIDToOrgIDUserEmail(empID string) (uint, string, error)

func GetUserID

func GetUserID(ctx *gin.Context) (string, error)

func HashPassword

func HashPassword(password string) (string, error)

func NullUintToUint

func NullUintToUint(u null.Uint) uint

func PascalToSnake

func PascalToSnake(input string) string

PascalToSnake eg: given input as "UserID", output will be "user_id"

func PlainAuth

func PlainAuth(username, password, host string) smtp.Auth

func RemoveProfileImageAsync

func RemoveProfileImageAsync(
	wg *sync.WaitGroup,
	ctx context.Context,
	ik *imagekit.ImageKit,
	imageId string,
)

func ResizeBase64ImageTo50x50

func ResizeBase64ImageTo50x50(input string) (string, error)

ResizeBase64ImageTo50x50 input format: "data:image/png;base64,iVBORw0KGg....="

func SendVerificationEmailAsync

func SendVerificationEmailAsync(wg *sync.WaitGroup, ch chan error, env *core.Env, verificationToken string, email []string)

func StringArrayContains

func StringArrayContains(stringArr []string, s string) bool

func UploadProfileImageAsync

func UploadProfileImageAsync(
	wg *sync.WaitGroup,
	ctx context.Context,
	ch chan models.ImageUploadResult,
	ik *imagekit.ImageKit,
	src multipart.File,
	imageSlotId int,
	imageName string,
	folderName string,
)

func VerifyPassword

func VerifyPassword(hashedPassword string, candidatePassword 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