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 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
Click to show internal directories.
Click to hide internal directories.