paginator

package
v0.0.0-...-0bce360 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	TotalRecords int64       `json:"total_records"`
	Records      interface{} `json:"records"`
	CurrentPage  int         `json:"current_page"`
	TotalPages   int         `json:"total_pages"`
}

type Filter

type Filter struct {
	Key   string `json:"key"`
	Value any    `json:"value"`
}

type Paginator

type Paginator struct {
	DB      *gorm.DB
	OrderBy []string
	Page    int
	PerPage int
	Filter  []Filter
}

func New

func New(tx *gorm.DB, c *fiber.Ctx) *Paginator

func (*Paginator) Paginate

func (p *Paginator) Paginate(dataSource interface{}) (*Data, error)

Jump to

Keyboard shortcuts

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