util

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abbreviate

func Abbreviate(str string) string

func Filter

func Filter(filter *binder.FilterRequest) func(db *gorm.DB) *gorm.DB

func Paginate

func Paginate(page, limit int) func(db *gorm.DB) *gorm.DB

func RandomStringGenerator

func RandomStringGenerator(length int) (code string)

func Sort

func Sort(sort *binder.SortRequest) func(db *gorm.DB) *gorm.DB

Types

type Pagination

type Pagination struct {
	Limit      int         `json:"limit"`
	Page       int         `json:"page"`
	TotalItems int         `json:"total_items"`
	TotalPages int         `json:"total_pages"`
	Items      interface{} `json:"items"`
}

func NewPagination

func NewPagination(limit int, page int, totalItems int, totalPages int, items interface{}) *Pagination

NewPagination initializes a new Pagination struct

func (*Pagination) Response

func (p *Pagination) Response() map[string]interface{}

Response returns the pagination response in echo.Map format

Jump to

Keyboard shortcuts

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