pagination

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine[T Setter[D], D any] struct {
	// contains filtered or unexported fields
}

func (*Engine[T, D]) Paginate

func (x *Engine[T, D]) Paginate(db *gorm.DB, options ...Options) (value T, err error)

func (*Engine[T, D]) SetClauses added in v1.0.1

func (x *Engine[T, D]) SetClauses(clauseList ...clause.Expression)

type Getter

type Getter[T any] interface {
	GetCurrentPage() uint64
	GetFrom() uint64
	GetTo() uint64
	GetPerPage() int
	GetLastPage() uint64
	GetTotal() uint64
	GetData() []T
}

type Options

type Options struct {
	Page  int
	Limit int
}

type Pagination

type Pagination[T any] struct {
	CurrentPage uint64 `json:"current_page"`
	From        uint64 `json:"from"`
	LastPage    uint64 `json:"last_page"`
	PerPage     int    `json:"per_page"`
	To          uint64 `json:"to"`
	Total       uint64 `json:"total"`
	Data        []T    `json:"data"`
}

func (*Pagination[T]) GetCurrentPage

func (x *Pagination[T]) GetCurrentPage() uint64

func (*Pagination[T]) GetData

func (x *Pagination[T]) GetData() []T

func (*Pagination[T]) GetFrom

func (x *Pagination[T]) GetFrom() uint64

func (*Pagination[T]) GetLastPage

func (x *Pagination[T]) GetLastPage() uint64

func (*Pagination[T]) GetPerPage

func (x *Pagination[T]) GetPerPage() int

func (*Pagination[T]) GetTo

func (x *Pagination[T]) GetTo() uint64

func (*Pagination[T]) GetTotal

func (x *Pagination[T]) GetTotal() uint64

func (*Pagination[T]) SetCurrentPage

func (x *Pagination[T]) SetCurrentPage(page uint64)

func (*Pagination[T]) SetData

func (x *Pagination[T]) SetData(data []T)

func (*Pagination[T]) SetFrom

func (x *Pagination[T]) SetFrom(page uint64)

func (*Pagination[T]) SetLastPage

func (x *Pagination[T]) SetLastPage(page uint64)

func (*Pagination[T]) SetPerPage

func (x *Pagination[T]) SetPerPage(page int)

func (*Pagination[T]) SetTo

func (x *Pagination[T]) SetTo(page uint64)

func (*Pagination[T]) SetTotal

func (x *Pagination[T]) SetTotal(page uint64)

type Setter

type Setter[T any] interface {
	SetCurrentPage(page uint64)
	SetFrom(page uint64)
	SetTo(page uint64)
	SetPerPage(page int)
	SetLastPage(page uint64)
	SetTotal(page uint64)
	SetData(data []T)
}

Jump to

Keyboard shortcuts

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