req

package
v0.0.0-...-db88944 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindJSON

func BindJSON(w http.ResponseWriter, r *http.Request, dst interface{}) error

func BindJSONObject

func BindJSONObject(w http.ResponseWriter, r *http.Request) (gjson.Result, error)

func Body

func Body(w http.ResponseWriter, r *http.Request) ([]byte, error)

func DefaultQuery

func DefaultQuery(r *http.Request, key, defaultValue string) string

func DefaultQueryFloat

func DefaultQueryFloat(r *http.Request, key string, defaultValue float64) float64

func DefaultQueryInt

func DefaultQueryInt(r *http.Request, key string, defaultValue int) int

func Param

func Param(r *http.Request, key string) string

func ParamFloat

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

func ParamInt

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

func Query

func Query(r *http.Request, key string) string

func QueryAll

func QueryAll(r *http.Request, key string) []string

func QueryFloat

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

func QueryHas

func QueryHas(r *http.Request, key string) bool

func QueryInt

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

Types

type PageRequest

type PageRequest struct {
	Page   int `json:"page"`
	Size   int `json:"size"`
	Offset int `json:"offset"`
}

Based on: https://jsonapi.org/profiles/ethanresnick/cursor-pagination https://github.com/emicklei/go-restful/blob/master/request.go#L55

func NewPage

func NewPage(r *http.Request) *PageRequest

type SortRequest

type SortRequest struct {
	Property  string `json:"property"`
	Direction string `json:"direction"`
}

func NewSort

func NewSort(r *http.Request) []*SortRequest

Jump to

Keyboard shortcuts

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