web

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorResponse

func ErrorResponse(c *gin.Context, code int, message string, causes ...Cause)

func SuccessResponse

func SuccessResponse(c *gin.Context, message string)

Types

type Cause

type Cause = map[string]string

type GenericResponse

type GenericResponse struct {
	Status  string  `json:"status"`
	Message string  `json:"message"`
	Causes  []Cause `json:"causes,omitempty"`
}

type Page

type Page struct {
	PageNumber int `json:"pageNumber"`
	PageSize   int `json:"pageSize"`
	TotalPages int `json:"totalPages"`
}

type SearchParams

type SearchParams struct {
	PageNumber  int
	PageSize    int
	SortBy      string
	ReverseSort bool
	Filters     map[string]string
}

func ApplySearchParams

func ApplySearchParams(opts ...SearchParamsOpt) *SearchParams

func (SearchParams) Limit

func (opts SearchParams) Limit() int

func (SearchParams) NumberOfPages

func (opts SearchParams) NumberOfPages(recordsCount int64) int

func (SearchParams) Offset

func (opts SearchParams) Offset() int

type SearchParamsOpt

type SearchParamsOpt = func(*SearchParams)

func Filters

func Filters(filters map[string]string) SearchParamsOpt

func Pagination

func Pagination(pageNumber int, pageSize int) SearchParamsOpt

func Sorting

func Sorting(sortBy string, reverse bool) SearchParamsOpt

Jump to

Keyboard shortcuts

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