utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountTotalPage

func CountTotalPage(totalData int, limit *Pagination) int

func GenerateUuid

func GenerateUuid() string

func ValidateUuid

func ValidateUuid(data string) bool

Types

type BaseModel

type BaseModel struct {
	UUID      string         `gorm:"type:varchar(36);primaryKey;not null" json:"uuid"`
	CreatedAt time.Time      `json:"created_at"`
	CreatedBy sql.NullString `gorm:"type:varchar(36);null;default:NULL" json:"created_by"`
	UpdatedAt time.Time      `json:"updated_at" gorm:"not null;default:CURRENT_TIMESTAMP"`
	UpdatedBy sql.NullString `gorm:"type:varchar(36);null;default:NULL" json:"updated_by"`
	DeletedAt gorm.DeletedAt `json:"deleted_at"`
	DeletedBy sql.NullString `gorm:"type:varchar(36);null;default:NULL" json:"deleted_by"`
}

type ErrorValidateResponse

type ErrorValidateResponse struct {
	FailedField string
	Tag         string
	Value       string
}

type Pagination

type Pagination struct {
	Limit int `json:"limit"`
	Page  int `json:"page"`
}

func GeneratePaginator

func GeneratePaginator(getQLimit, getQPage string) (Pagination, error)

type Response

type Response struct {
	C *fiber.Ctx
}

func NewResponse

func NewResponse(ctx *fiber.Ctx) Response

func (Response) ResponseFormatter

func (res Response) ResponseFormatter(code int, message string, err error, result map[string]interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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