appUtil

package
v0.0.0-...-e9ec6a3 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculatePercentVariation

func CalculatePercentVariation(currentValue, lastValue float64) float64

func Controller

func Controller(handler func(*fiber.Ctx) (PaginateResponse, error)) func(*fiber.Ctx) error

func GenerateEnumErrorDetail

func GenerateEnumErrorDetail(fieldName string, validValues []interface{}) string

func GetLastMonth

func GetLastMonth() (time.Month, int)

func RegisterBirthDateFormatValidation

func RegisterBirthDateFormatValidation(validate *validator.Validate) error

func RegisterCPFValidation

func RegisterCPFValidation(validate *validator.Validate) error

func RegisterNotFutureDateValidation

func RegisterNotFutureDateValidation(validate *validator.Validate) error

func UpdateModelFromDTO

func UpdateModelFromDTO(model interface{}, dto interface{})

func ValidateBirthDateFormat

func ValidateBirthDateFormat(fl validator.FieldLevel) bool

func ValidateCPF

func ValidateCPF(fl validator.FieldLevel) bool

func ValidateNotFutureDate

func ValidateNotFutureDate(fl validator.FieldLevel) bool

Types

type PaginateErrorResponse

type PaginateErrorResponse struct {
	Meta   appDto.MetaDTO          `json:"meta"`
	Errors []appDto.CustomErrorDTO `json:"errors"`
}

func PaginateError

func PaginateError(errors []appDto.CustomErrorDTO) PaginateErrorResponse

type PaginateResponse

type PaginateResponse struct {
	Meta   appDto.MetaDTO `json:"meta"`
	Result interface{}    `json:"result"`
}

func Paginate

func Paginate(data interface{}, totalCount int64, page int, limit int) PaginateResponse

func PaginateSingle

func PaginateSingle(data interface{}) PaginateResponse

type TQueryBuilder

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

func QueryBuilder

func QueryBuilder(dto interface{}, query *gorm.DB) *TQueryBuilder

func (*TQueryBuilder) ApplyOrder

func (qb *TQueryBuilder) ApplyOrder() *gorm.DB

func (*TQueryBuilder) BuildQuery

func (qb *TQueryBuilder) BuildQuery() *gorm.DB

func (*TQueryBuilder) GetPagination

func (qb *TQueryBuilder) GetPagination() (int, int)

Jump to

Keyboard shortcuts

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