request

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormField

func FormField(r *http.Request, key string) (string, error)

func NumberParam

func NumberParam[T Number](r *http.Request, key string) (T, error)

NumberParam from request query string

func Payload

func Payload[T any](r *http.Request) (T, error)

func PayloadMap

func PayloadMap(r *http.Request) (map[string]any, error)

func PayloadWithValidate

func PayloadWithValidate[T any](r *http.Request) (T, error)

Types

type Number

type Number interface {
	int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64 | float32 | float64
}

type Pager

type Pager struct {
	Search      string
	OrderBy     *string `json:"orderBy"`
	OrderAsc    *bool   `json:"orderAsc"`
	Page        int     `json:"page"`
	Size        int     `json:"size"`
	Total       int     `json:"total"`
	TotalNeeded bool    `json:"-"`
}

func GetPager

func GetPager(r *http.Request) Pager

GetPager info from request's query parameters

func (*Pager) HasSearch

func (i *Pager) HasSearch() bool

func (*Pager) Limit

func (i *Pager) Limit() int

func (*Pager) Offset

func (i *Pager) Offset() int

Jump to

Keyboard shortcuts

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