utils

package
v3.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: MIT Imports: 4 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CurrentResultInfos

type CurrentResultInfos struct {
	ActivePage int
	TotalHits  int
	PageSize   int
	LastPage   int
}

CurrentResultInfos page information

type Page

type Page struct {
	Page     int
	URL      string
	IsActive bool
	IsSpacer bool
}

Page page data

type PaginationConfig

type PaginationConfig struct {
	ShowFirstPage bool `inject:"config:commerce.pagination.showFirstPage"`
	ShowLastPage  bool `inject:"config:commerce.pagination.showLastPage"`
	//ShowAroundActivePageAmount - amount of pages to show before and after the current page (so a value of2 would show 2 pages before and 2 pages after)
	ShowAroundActivePageAmount float64 `inject:"config:commerce.pagination.showAroundActivePageAmount"`
	NameSpace                  string
}

PaginationConfig - represents configuration Options used by the PaginationInfo Build method

type PaginationInfo

type PaginationInfo struct {
	NextPage       *Page
	PreviousPage   *Page
	TotalHits      int
	PageNavigation []Page
}

PaginationInfo meta information

func BuildWith

func BuildWith(currentResult CurrentResultInfos, paginationConfig PaginationConfig, urlBase *url.URL) PaginationInfo

BuildWith builds a paginationInfo based on the given infos and config

type PaginationInfoFactory

type PaginationInfoFactory struct {
	DefaultConfig *PaginationConfig `inject:""`
}

PaginationInfoFactory - used to build a configuration based on configured defaults

func (*PaginationInfoFactory) Build

func (f *PaginationInfoFactory) Build(activePage int, totalHits int, pageSize int, lastPage int, urlBase *url.URL) PaginationInfo

Build Pagination with the default configuration

Jump to

Keyboard shortcuts

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