pagination

package
v1.23.2 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResourceSortBy

func ResourceSortBy(by string) func(a, b SortAndSearchAble) bool

func SearchName

func SearchName(search string) func(item Named) bool

func SortByFunc

func SortByFunc(datas []SortAndSearchAble, by string)

Types

type Named

type Named interface {
	GetName() string
}

type PageData

type PageData struct {
	Total       int64
	List        interface{}
	CurrentPage int64
	CurrentSize int64
}

func NewPageDataFromContext deprecated

func NewPageDataFromContext(c *gin.Context, metaAccessor func(i int) SortAndSearchAble, length int, _ interface{}) PageData

Deprecated: use pagination.NewTypedSearchSortPageResourceFromContext instead

func NewPageDataFromContextReflect

func NewPageDataFromContextReflect(c *gin.Context, list interface{}) PageData

NewPageDataFromContextReflect data 必须为一个实现 SortAndSearchAble 接口的list,其内部会自动进行 搜索 排序 分页

type SortAndSearchAble

type SortAndSearchAble interface {
	GetName() string
	GetCreationTimestamp() metav1.Time
}

type TypedFilterFun

type TypedFilterFun[T any] func(item T) bool

type TypedPageData

type TypedPageData[T any] struct {
	Total       int64
	List        []T
	CurrentPage int64
	CurrentSize int64
}

func NewTypedSearchSortPage

func NewTypedSearchSortPage[T any](list []T, page, size int, pickfun func(item T) bool, sortfun func(a, b T) bool) TypedPageData[T]

func NewTypedSearchSortPageResourceFromContext

func NewTypedSearchSortPageResourceFromContext[T any](c *gin.Context, list []T) TypedPageData[T]

type TypedSortFun

type TypedSortFun[T any] func(a, b T) bool

Jump to

Keyboard shortcuts

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