utils

package
v0.0.0-...-83acdd3 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyDynamicPreloading

func ApplyDynamicPreloading(db *gorm.DB, ctx *gin.Context, allowedEntities PreloadEntities) *gorm.DB

func Decode

func Decode(s string) (string, error)

func Encode

func Encode(s string) string

func GenerateToken

func GenerateToken(ttl time.Duration, payload interface{}, secretJWTKey string) (string, error)

func HashPassword

func HashPassword(password string) (string, error)

func MapPaymentCardToPaymentCardResponse

func MapPaymentCardToPaymentCardResponse(card *models.PaymentCard) models.PaymentCardResponse

func MapPaymentCardsToPaymentCardsResponse

func MapPaymentCardsToPaymentCardsResponse(cards *[]models.PaymentCard) []models.PaymentCardResponse

func MapPaymentDetailToPaymentDetailResponse

func MapPaymentDetailToPaymentDetailResponse(detail *models.PaymentDetail) models.PaymentDetailResponse

func MapPaymentToPaymentResponse

func MapPaymentToPaymentResponse(payment *models.Payment) models.PaymentResponse

func MapPaymentsToPaymentsResponse

func MapPaymentsToPaymentsResponse(payments *[]models.Payment) []models.PaymentResponse

func MapRentalHistoryToRentalHistoryResponse

func MapRentalHistoryToRentalHistoryResponse(history *models.RentPaymentHistory) models.RentPaymentHistoryResponse

func MapRentalsHistoryToRentalsHistoryResponse

func MapRentalsHistoryToRentalsHistoryResponse(history *[]models.RentPaymentHistory) []models.RentPaymentHistoryResponse

func MapUserToUserResponse

func MapUserToUserResponse(user *models.User) models.UserResponse

func MapUsersToUsersResponse

func MapUsersToUsersResponse(users *[]models.User) []models.UserResponse

func MapVehicleToVehicleResponse

func MapVehicleToVehicleResponse(vehicle *models.Vehicle) models.VehicleResponse

func MapVehiclesToVehicleResponses

func MapVehiclesToVehicleResponses(vehicles *[]models.Vehicle) []models.VehicleResponse

func ParseTemplateDir

func ParseTemplateDir(dir string) (*template.Template, error)

func SendEmail

func SendEmail(user *models.User, data *EmailData, emailTemp string)

func ValidateToken

func ValidateToken(token string, signedJWTKey string) (interface{}, error)

func VerifyPassword

func VerifyPassword(hashedPassword string, candidatePassword string) error

Types

type EmailData

type EmailData struct {
	URL       string
	FirstName string
	Subject   string
}

type Pagination

type Pagination struct {
	Page   int
	Limit  int
	Offset int
}

func NewPaginationFromQuery

func NewPaginationFromQuery(ctx *gin.Context) (*Pagination, error)

type PreloadEntities

type PreloadEntities map[string]bool

Jump to

Keyboard shortcuts

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