utils

package
v0.0.0-...-23e8201 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: MIT Imports: 19 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Config cfg
View Source
var Queries *db.Queries
View Source
var RedisClient *redis.Client

Functions

func FormatValidationErrors

func FormatValidationErrors(err error) string

func GenerateOTP

func GenerateOTP(ctx context.Context, email string) error

func GenerateRandomString

func GenerateRandomString(length int) string

func GenerateToken

func GenerateToken(userId *uuid.UUID, isRefresh bool) (string, error)

func InitCache

func InitCache()

func InitDB

func InitDB()

func InitMailer

func InitMailer()

func InitValidator

func InitValidator()

func Ping

func Ping(pool *pgxpool.Pool)

func SendEmail

func SendEmail(to, subject, body string, attachments ...string) error

func SendTeamEmail

func SendTeamEmail(ctx context.Context, emails []string) error

func ValidateAlphaNum

func ValidateAlphaNum(str string) bool

func WriteError

func WriteError(c echo.Context, status int, err error) error

func WriteJSON

func WriteJSON(c echo.Context, status int, message interface{}) error

Types

type JWTClaims

type JWTClaims struct {
	UserID uuid.UUID `json:"user_id"`
	jwt.RegisteredClaims
}

func ValidateRefreshToken

func ValidateRefreshToken(tokenString string) (*JWTClaims, error)

type StandardResponse

type StandardResponse struct {
	Status  int         `json:"status"`
	Message interface{} `json:"message,omitempty"`
	Error   string      `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

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