helpers

package
v0.0.0-...-04b7820 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INVALID_REQUEST_BODY     = "invalid request body"
	REQUEST_BODY_PARSE_ERROR = "request body parse error"
)

Variables

This section is empty.

Functions

func BaseURL

func BaseURL(c *gin.Context) string

func CalculatePercentageChange

func CalculatePercentageChange(current, previous int) float64

func GenerateRandomNumber

func GenerateRandomNumber(length int) (int, error)

func GenerateRandomString

func GenerateRandomString(length int) (string, error)

func GenerateToken

func GenerateToken(JWTSecretKey, email, name, userid string) (signedToken string, err error)

GenerateToken generates a jwt token

func GetBaseURL

func GetBaseURL(c *gin.Context) string

func GetFile

func GetFile(assetParam admin.AssetParams) (*admin.AssetResult, error)

func HashPassword

func HashPassword(password string) (string, error)

func ParseTemplateFile

func ParseTemplateFile(filename string, mapping interface{}) (string, error)

func RandRange

func RandRange(min, max int) int

func ReturnError

func ReturnError(c *gin.Context, message string, err error, status int)

func ReturnJSON

func ReturnJSON(c *gin.Context, message string, data interface{}, statusCode int)

func SendEmail

func SendEmail(subject, fromName, template, name, email string, templateData interface{})

func TimeNow

func TimeNow(timezone string) (string, error)

func UploadFile

func UploadFile(file io.Reader, filename string) (*uploader.UploadResult, error)

Types

type AccountReset

type AccountReset struct {
	Email string `json:"email" validate:"required,email"`
}

type AccountStatus

type AccountStatus int

type AppError

type AppError struct {
	// contains filtered or unexported fields
}

func NewError

func NewError(message string) *AppError

func (AppError) Error

func (e AppError) Error() string

type AuthTokenJwtClaim

type AuthTokenJwtClaim struct {
	Email  string
	Name   string
	UserId string
	jwt.StandardClaims
}

func GetAuthenticatedUser

func GetAuthenticatedUser(c *gin.Context) (*AuthTokenJwtClaim, error)

type IError

type IError struct {
	Field string
	Tag   string
	Value string
}

type ListProjectOffsets

type ListProjectOffsets struct {
	Projects []string `json:"projects" validate:"required"`
}

type OtpVerify

type OtpVerify struct {
	Token string `json:"token" validate:"required,len=5"`
	Email string `json:"email" validate:"required,email"`
}

type ProjectType

type ProjectType string

type UpdateAccountInformation

type UpdateAccountInformation struct {
	Country        string `json:"country" validate:"required"`
	Manager        string `json:"manager" validate:"required"`
	PhoneNumber    string `json:"phone_number" validate:"required,numeric"`
	CompanyWebsite string `json:"company_website" validate:"required,url"`
}

type UserRepositoryInterface

type UserRepositoryInterface interface {
	Where(condition, value string) ([]*models.User, error)
	FindByCondition(condition, value string) (*models.User, bool, error)
	FindByAccountType(value string) ([]*models.User, bool, error)
	Find(id uuid.UUID) (*models.User, error)
	Exists(id uuid.UUID) (bool, error)
	Create(item *models.User) error
	Save(u *models.User) (*models.User, error)
	RawCount(q string, count *int64) error
	QueryWithArgs(q string, args ...interface{}) ([]*models.User, error)
	RawSmartSelect(q string, res interface{}, args ...interface{}) error
}

Jump to

Keyboard shortcuts

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