request

package
v0.0.0-...-fb1cdef Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IntBase int = 10
	BitSize int = 64
)

Variables

This section is empty.

Functions

func ExtractBody

func ExtractBody(request *Request, unmarshaler types.Unmarshaler, pointer interface{}, configs []Option) error

func ExtractParam

func ExtractParam(
	key string,
	paramPlacing placing.Placing,
	request *Request,
	configs []Option,
	convert func(string) (interface{}, error),
) error

ExtractParam - extracting parameter from context, calls middleware and saves to 'context.parameters[from][key]'. After this parameter can be retrieved from context using 'context.Query' methods.

func GetUnmarshaler

func GetUnmarshaler(request *Request) (types.Unmarshaler, error)

Types

type HandlerParams

type HandlerParams func(*Request, http.ResponseWriter) error

type Option

type Option func(*Parameter) error

type Parameter

type Parameter struct {
	Parsed interface{}

	Name        string
	Description string
	// contains filtered or unexported fields
}

type Request

type Request struct {
	Description string
	// contains filtered or unexported fields
}

Request - provide methods for extracting r parameters from context.

func New

func New(request *http.Request) *Request

func (*Request) AddInPathParameter

func (r *Request) AddInPathParameter(key string, value string)

func (*Request) All

func (r *Request) All() map[placing.Placing]map[string]string

func (*Request) Body

func (r *Request) Body() interface{}

func (*Request) Bool

func (r *Request) Bool(key string, paramPlacing placing.Placing) bool

func (*Request) Float

func (r *Request) Float(key string, paramPlacing placing.Placing) float64

func (*Request) GetParameter

func (r *Request) GetParameter(key string, paramPlacing placing.Placing) string

func (*Request) GetRequest

func (r *Request) GetRequest() *http.Request

func (*Request) Headers

func (r *Request) Headers() map[string][]string

func (*Request) Integer

func (r *Request) Integer(key string, paramPlacing placing.Placing) int64

func (*Request) String

func (r *Request) String(key string, paramPlacing placing.Placing) string

func (*Request) Time

func (r *Request) Time(key, layout string, paramPlacing placing.Placing) time.Time

Jump to

Keyboard shortcuts

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