response

package
v0.0.0-...-f0b9b21 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewData

func NewData[T any](c echo.Context, code int, data T) error

func NewError

func NewError(c echo.Context, err error) error

func NewErrorCode

func NewErrorCode(c echo.Context, err error, code int) error

func NewPageData

func NewPageData[T any](
	c echo.Context, code int, pageSet *pager.PageSet[T],
) error

Types

type DataResponse

type DataResponse[T any] struct {
	Data       T           `json:"data"`
	Pagination *Pagination `json:"page,omitempty"`
}

type ErrorResponse

type ErrorResponse struct {
	Error any `json:"error,omitempty"`
}

type Pagination

type Pagination struct {
	Current     int64 `json:"current"`
	Total       int64 `json:"total"`
	Elements    int64 `json:"elements"`
	Remaining   int64 `json:"remaining"`
	HasNextPage bool  `json:"hasNextPage"`
}

func NewPagination

func NewPagination[T any](pageSet *pager.PageSet[T]) Pagination

Jump to

Keyboard shortcuts

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