paging

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataPageOpsImpl

type DataPageOpsImpl[T any] struct {
	// contains filtered or unexported fields
}

func DataPaging

func DataPaging[T any](pageData *[]T) *DataPageOpsImpl[T]

func (*DataPageOpsImpl[T]) CurrentPage

func (paging *DataPageOpsImpl[T]) CurrentPage(currentPage int) *DataPageOpsImpl[T]

func (*DataPageOpsImpl[T]) Fetch

func (paging *DataPageOpsImpl[T]) Fetch() *PageEntityRes[T]

func (*DataPageOpsImpl[T]) Limit

func (paging *DataPageOpsImpl[T]) Limit() int

func (*DataPageOpsImpl[T]) Offset

func (paging *DataPageOpsImpl[T]) Offset() int

func (*DataPageOpsImpl[T]) PerPageItems

func (paging *DataPageOpsImpl[T]) PerPageItems(perPageItems int) *DataPageOpsImpl[T]

type PageEntityRes

type PageEntityRes[T any] struct {
	CurrentPage  int  `json:"currentPage"`
	PrevPage     int  `json:"prevPage"`
	NextPage     int  `json:"nextPage"`
	TotalPages   int  `json:"totalPages"`
	PerPageItems int  `json:"perPageItems"`
	TotalItems   int  `json:"totalItems"`
	PageData     *[]T `json:"pageData"`
}

type PageOpsImpl

type PageOpsImpl[T any, V any, Z any] struct {
	// contains filtered or unexported fields
}

func Paging

func Paging[T any, V any, Z any]() *PageOpsImpl[T, V, Z]

func (*PageOpsImpl[T, V, Z]) Converter

func (paging *PageOpsImpl[T, V, Z]) Converter(f func(ctx context.Context, source *[]Z, target *[]T)) *PageOpsImpl[T, V, Z]

func (*PageOpsImpl[T, V, Z]) Ctx

func (paging *PageOpsImpl[T, V, Z]) Ctx(ctx context.Context) *PageOpsImpl[T, V, Z]

func (*PageOpsImpl[T, V, Z]) CurrentPage

func (paging *PageOpsImpl[T, V, Z]) CurrentPage(currentPage int) *PageOpsImpl[T, V, Z]

func (*PageOpsImpl[T, V, Z]) Fetch

func (paging *PageOpsImpl[T, V, Z]) Fetch() (*PageEntityRes[T], error)

func (*PageOpsImpl[T, V, Z]) Limit

func (paging *PageOpsImpl[T, V, Z]) Limit() int

func (*PageOpsImpl[T, V, Z]) Offset

func (paging *PageOpsImpl[T, V, Z]) Offset() int

func (*PageOpsImpl[T, V, Z]) Params

func (paging *PageOpsImpl[T, V, Z]) Params(params *V) *PageOpsImpl[T, V, Z]

func (*PageOpsImpl[T, V, Z]) PerPageItems

func (paging *PageOpsImpl[T, V, Z]) PerPageItems(perPageItems int) *PageOpsImpl[T, V, Z]

func (*PageOpsImpl[T, V, Z]) Query

func (paging *PageOpsImpl[T, V, Z]) Query(f func(ctx context.Context, offset int, limit int, params *V) (*[]Z, *int, error)) *PageOpsImpl[T, V, Z]

type SimplePageOpsImpl

type SimplePageOpsImpl[T any] struct {
	// contains filtered or unexported fields
}

func SimplePaging

func SimplePaging[T any](currentPage int, perPageItems int) *SimplePageOpsImpl[T]

func (*SimplePageOpsImpl[T]) Fetch

func (paging *SimplePageOpsImpl[T]) Fetch() *PageEntityRes[T]

func (*SimplePageOpsImpl[T]) Limit

func (paging *SimplePageOpsImpl[T]) Limit() int

func (*SimplePageOpsImpl[T]) Offset

func (paging *SimplePageOpsImpl[T]) Offset() int

func (*SimplePageOpsImpl[T]) PageData

func (paging *SimplePageOpsImpl[T]) PageData(totalItems int, pageData *[]T) *SimplePageOpsImpl[T]

func (*SimplePageOpsImpl[T]) PageModels added in v0.0.4

func (paging *SimplePageOpsImpl[T]) PageModels(totalItems int, modelsPtr any) *SimplePageOpsImpl[T]

Jump to

Keyboard shortcuts

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