pagination

package
v0.0.0-...-e0b5030 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const COMBINED_FILTER = "combinedFilter" // deprecated
View Source
const FILTER = "filter"
View Source
const FILTER_ARRAY = "filter[]"
View Source
const OR = "or"
View Source
const OR_ARRAY = "or[]"
View Source
const PAGE_NUMBER = "pageNumber"
View Source
const PAGE_SIZE = "pageSize"
View Source
const SORT_COLUMN = "sortColumn"
View Source
const SORT_ORDER = "sortOrder"

Variables

View Source
var DEFAULT_LIMIT = 10000

Functions

This section is empty.

Types

type CombinedFilter

type CombinedFilter struct {
	Columns []string
	Value   string
}

type Filter

type Filter struct {
	Or       bool
	Relation string
	Column   string
	Operator string
	Values   []string
}

type Pagination

type Pagination struct {
	Limit          int
	Page           int
	SortColumn     string
	SortOrder      string
	Filters        []Filter
	CombinedFilter CombinedFilter // deprecated
	TotalRows      int64
	TotalPages     int

	PaginationRequest *goyave.Request
	Paginator         *database.Paginator
}

func NewPagination

func NewPagination(urlParams *url.Values) *Pagination

func NewPaginationWithFilter

func NewPaginationWithFilter(column string, releation string, op string, values []string) *Pagination

func (*Pagination) AddFilter

func (p *Pagination) AddFilter(f Filter)

func (*Pagination) Fetch

func (p *Pagination) Fetch(db *gorm.DB, dest interface{}) (*database.Paginator, *gorm.DB)

func (*Pagination) GetFilter

func (p *Pagination) GetFilter(key string) *Filter

func (*Pagination) GetFilters

func (p *Pagination) GetFilters() []Filter

func (*Pagination) GetLimit

func (p *Pagination) GetLimit() int

func (*Pagination) GetOffset

func (p *Pagination) GetOffset() int

func (*Pagination) GetPage

func (p *Pagination) GetPage() int

func (*Pagination) GetSortColumn

func (p *Pagination) GetSortColumn() string

func (*Pagination) GetSortOrder

func (p *Pagination) GetSortOrder() string

func (*Pagination) MakePaginationRequest

func (p *Pagination) MakePaginationRequest()

func (*Pagination) Response

func (p *Pagination) Response(ctx context.Context) (out domain.PaginationResponse, err error)

Jump to

Keyboard shortcuts

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