Documentation ¶
Index ¶
- Constants
- func ExtractBody(request *Request, unmarshaler types.Unmarshaler, pointer interface{}, ...) *response.AsObject
- func ExtractParam(key string, paramPlacing placing.Placing, request *Request, configs []Option, ...) *response.AsObject
- func GetUnmarshaler(request *Request) (types.Unmarshaler, error)
- type Middleware
- type Option
- type Parameter
- type ParamsValidator
- type Request
- func (r *Request) AddInPathParameter(key string, value string)
- func (r *Request) All() map[placing.Placing]map[string]string
- func (r *Request) Body() interface{}
- func (r *Request) Bool(key string, paramPlacing placing.Placing) bool
- func (r *Request) Float(key string, paramPlacing placing.Placing) float64
- func (r *Request) GetParameter(key string, paramPlacing placing.Placing) string
- func (r *Request) GetRequest() *http.Request
- func (r *Request) Headers() map[string][]string
- func (r *Request) Integer(key string, paramPlacing placing.Placing) int64
- func (r *Request) String(key string, paramPlacing placing.Placing) string
- func (r *Request) Time(key, layout string, paramPlacing placing.Placing) time.Time
- type Requester
Constants ¶
View Source
const ( IntBase int = 10 BitSize int = 64 )
Variables ¶
This section is empty.
Functions ¶
func ExtractBody ¶
func ExtractParam ¶
func ExtractParam( key string, paramPlacing placing.Placing, request *Request, configs []Option, convert func(string) (interface{}, error), ) *response.AsObject
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 Middleware ¶
type Middleware func(r *Request, w http.ResponseWriter) *response.AsObject
type ParamsValidator ¶
type Request ¶
type Request struct { Description string // contains filtered or unexported fields }
Request - provide methods for extracting r parameters from context.
func (*Request) AddInPathParameter ¶
func (*Request) GetParameter ¶
func (*Request) GetRequest ¶
type Requester ¶
type Requester interface { // Headers - returns request headers. Headers() map[string][]string // All - returns all parsed parameters. All() map[placing.Placing]map[string]string // GetParameter - returns parameter value from defined place. GetParameter(value string, place placing.Placing) string // GetRequest - return http.Request object associated with request. GetRequest() *http.Request // Body - returns request body. // Body must be requested by 'api.Body(pointer)' or 'api.CustomBody(unmarshaler, pointer)'. Body() interface{} // Bool - returns boolean parameter. // Mandatory parameter should be requested by 'api.Bool'. // Otherwise, parameter will be obtained by key and its value will be checked for truth. Bool(value string, place placing.Placing) bool // Integer - returns integer parameter. // Mandatory parameter should be requested by 'api.Integer'. // Otherwise, parameter will be obtained by key and its value will be converted. to int64. Integer(value string, place placing.Placing) int64 // Float - returns floating point number parameter. // Mandatory parameter should be requested by 'api.Float'. // Otherwise, parameter will be obtained by key and its value will be converted to float64. Float(value string, place placing.Placing) float64 // String - returns String parameter. // Mandatory parameter should be requested by 'api.String'. // Otherwise, parameter will be obtained by key. String(value string, place placing.Placing) string // Time - returns date-time parameter. // Mandatory parameter should be requested by 'api.Time'. // Otherwise, parameter will be obtained by key and its value will be converted to time using 'layout'. Time(key string, layout string, paramPlacing placing.Placing) time.Time }
Click to show internal directories.
Click to hide internal directories.