utils

package
v0.0.0-...-365054f Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: GPL-3.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForwardError

func ForwardError(c *gin.Context, err error, fallback *apierror.APIError)

ForwardError writes err to the response if it's in `apierror.APIError` format. Otherwise, appends it to the fallback APIError's message.

func WriteAsJSON

func WriteAsJSON(v interface{}, writer http.ResponseWriter, httpCode ...int)

WriteAsJSON writes a given value `v` to a given http.ResponseWritter forcing `content-type application/json`. Optional httpCode parameter can be given to also write a specific status code.

Types

type Paginator

type Paginator struct {
	paginator.Paginator
	// contains filtered or unexported fields
}

Paginator structure.

func NewPaginator

func NewPaginator(adapter paginator.Adapter, pageSize, page int) *Paginator

NewPaginator creates new instance of Paginator

func (*Paginator) PageSize

func (p *Paginator) PageSize() int

PageSize returns number of records per page.

Jump to

Keyboard shortcuts

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