httpresponse

package
v0.0.0-...-c846bbc Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 3 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 struct {
	Pagination PaginationInfo  `json:"pagination"`
	Data       json.RawMessage `json:"data"`
}

PaginatedResponse is a response that contains pagination information.

func NewEmptyPaginatedResponse

func NewEmptyPaginatedResponse() PaginatedResponse

NewEmptyPaginatedResponse returns a PaginatedResponse with an empty data and 0 pages.

This is useful for returning an empty list.

func NewPaginatedResponse

func NewPaginatedResponse(r *http.Request, data interface{}, currentPage, pageLimit, totalItems int) (PaginatedResponse, error)

NewPaginatedResponse returns a PaginatedResponse with pagination information.

type PaginationInfo

type PaginationInfo struct {
	Next  string `json:"next,omitempty"`
	Prev  string `json:"prev,omitempty"`
	Pages int    `json:"pages"`
	Total int    `json:"total"`
}

Jump to

Keyboard shortcuts

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