pagination

package
v0.7.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PaginatedResponse

type PaginatedResponse[T any] struct {
	TotalCount int `json:"totalCount"` // Total results count
	Offset     int `json:"offset"`     // Current page number
	Size       int `json:"size"`       // Current page size
	Data       []T `json:"data"`
}

func NewPaginatedResponse

func NewPaginatedResponse[T any]() PaginatedResponse[T]

NewPaginatedResponse will initialise the PaginatedResponse; making sure that PaginatedResponse.Data will not be Null

func (*PaginatedResponse[T]) PushData

func (m *PaginatedResponse[T]) PushData(item ...T)

PushData will append item to the PaginatedResponse.Data

func (*PaginatedResponse[_]) UpdateOffset

func (m *PaginatedResponse[_]) UpdateOffset(offset int)

UpdateOffset will update the Offset in PaginatedResponse

func (*PaginatedResponse[_]) UpdateSize

func (m *PaginatedResponse[_]) UpdateSize(size int)

UpdateSize will update the Size in PaginatedResponse

func (*PaginatedResponse[_]) UpdateTotalCount

func (m *PaginatedResponse[_]) UpdateTotalCount(totalCount int)

UpdateTotalCount will update the TotalCount in PaginatedResponse

type QueryParams

type QueryParams struct {
	SortOrder SortOrder `json:"sortOrder"`
	SortBy    SortBy    `json:"sortBy"`
	Offset    int       `json:"offset"`
	Size      int       `json:"size"`
	SearchKey string    `json:"searchKey"`
}

type RepositoryRequest

type RepositoryRequest struct {
	Order         SortOrder
	SortBy        SortBy
	Limit, Offset int
}

type SortBy

type SortBy string
const (
	AppName SortBy = "app_name"
)

type SortOrder

type SortOrder string
const (
	Asc  SortOrder = "ASC"
	Desc SortOrder = "DESC"
)

Jump to

Keyboard shortcuts

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