func (c *Context) QueryFloatDef(key string, def float64) float64 {
	if value, ok := c.QueryFloat(key); ok {
		return value
	}
	return def
}
Get float query param by key with default value.
package just
import (
	"errors"
	"fmt"
	"io/ioutil"
	"mime/multipart"
	"net"
	"net/http"
	"net/url"
	"strconv"
	"strings"
	"time"
)
var (
	ErrEmptyRequest          = errors.New("empty request")
	ErrEmptyRequestBody      = errors.New("empty request body")
	ErrNotFoundSerializer    = errors.New("not find serializer for content type in your request")
	ErrNotFoundUrlSerializer = errors.New("not find serializer for url query (application/x-www-form-urlencoded)")
)
type Context struct {
	app            IApplication       
	routeInfo      IRouteInfo         
	routeParams    map[string]string  
	handleIndex    int                
	isLocalRequest bool
	Meta                map[string]interface{}  
	Request             *http.Request           
	IsFrozenRequestBody bool                    
}
func (c *Context) reset() *Context {
	c.Request, c.routeInfo, c.routeParams, c.Meta, c.handleIndex = nil, nil, nil, nil, -1
	c.IsFrozenRequestBody = true
	return c
}
func (c *Context) resetRoute(info IRouteInfo, params map[string]string) *Context {
	c.routeInfo, c.routeParams, c.handleIndex = info, params, -1
	return c
}
func (c *Context) RouteBasePath() string {
	if c.routeInfo != nil {
		return c.routeInfo.BasePath()
	}
	return ""
}
func (c *Context) Trans(message string, vars ...interface{}) string {
	if translator := c.app.Translator(); translator != nil {
		if i, ok := c.Get("locale"); ok {
			if locale, valid := i.(string); valid {
				return translator.Trans(locale, message, vars...)
			}
		}
	}
	if len(vars) > 0 {
		return fmt.Sprintf(message, vars...)
	}
	return message
}
func (c *Context) Tr(message string, vars ...interface{}) string {
	return c.Trans(message, vars...)
}
func (c *Context) Renderer(name string) IRenderer {
	return c.app.TemplatingManager().Renderer(name)
}
func (c *Context) R(name string) IRenderer {
	return c.Renderer(name)
}
func (c *Context) DetectedSerializerName() string {
	var name string
	if v, ok := c.Query("_format"); ok {
		name = v
	} else if v, ok := c.RequestHeader("FORMAT"); ok {
		name = v
	} else if v, ok := c.PostForm("_format"); ok {
		name = v
	}
	if len(name) > 1 {
		if s := c.app.SerializerManager().Serializer(name, false); s != nil {
			return name
		}
	}
	if defName, ok := c.app.SerializerManager().DefaultName(); ok {
		return defName
	}
	return "json"
}
func (c *Context) Serializer(names ...string) ISerializer {
	m := c.app.SerializerManager()
	if len(names) > 0 {
		for _, n := range names {
			if n == "default" {
				if def, ok := m.DefaultName(); ok {
					return m.Serializer(def, false)
				}
			}
			if strings.IndexByte(n, '/') > 0 {
				if s := m.Serializer(n, true); s != nil {
					return s
				}
			} else if s := m.Serializer(n, false); s != nil {
				return s
			}
		}
	}
	return m.Serializer(c.DetectedSerializerName(), false)
}
func (c *Context) S(names ...string) ISerializer {
	return c.Serializer(names...)
}
func (c *Context) Bind(ptr interface{}) error {
	if c.Request == nil {
		return ErrEmptyRequest
	}
	if (c.Request.Method == "GET" || c.Request.Method == "DELETE") && c.Request.URL != nil {
		s := c.app.SerializerManager().Serializer("application/x-www-form-urlencoded", true)
		if s == nil {
			return ErrNotFoundUrlSerializer
		}
		return s.Deserialize([]byte(c.Request.URL.RawQuery), ptr)
	}
	if c.Request.Body == nil {
		return ErrEmptyRequestBody
	}
	s := c.app.SerializerManager().Serializer(c.ContentType(), true)
	if s == nil {
		return ErrNotFoundSerializer
	}
	b, err := ioutil.ReadAll(c.Request.Body)
	defer c.ResetBodyReaderPosition()
	if err != nil {
		return err
	}
	return s.Deserialize(b, ptr)
}
func (c *Context) IsValid() bool {
	return c.app != nil && c.Request != nil
}
func (c *Context) nextHandler() (IResponse, bool) {
	if c.routeInfo != nil {
		c.handleIndex++
		if handler, ok := c.routeInfo.HandlerByIndex(c.handleIndex); ok {
			if handler != nil {
				return handler(c), true
			}
			return c.nextHandler()
		}
	}
	return nil, false
}
func (c *Context) Next() IResponse {
	if res, ok := c.nextHandler(); ok {
		return res
	}
	return nil
}
func (c *Context) Param(name string) (value string, ok bool) {
	if c.routeParams != nil {
		value, ok = c.routeParams[name]
	}
	return
}
func (c *Context) ParamBool(name string) (value bool, ok bool) {
	if str, exist := c.Param(name); exist {
		var err error
		value, err = strconv.ParseBool(strings.ToLower(str))
		ok = err == nil
	}
	return
}
func (c *Context) ParamInt(name string) (value int64, ok bool) {
	if str, exist := c.Param(name); exist {
		var err error
		value, err = strconv.ParseInt(str, 10, 64)
		ok = err == nil
	}
	return
}
func (c *Context) ParamFloat(name string) (value float64, ok bool) {
	if str, exist := c.Param(name); exist {
		var err error
		value, err = strconv.ParseFloat(str, 64)
		ok = err == nil
	}
	return
}
func (c *Context) ParamDef(name string, def string) string {
	if value, ok := c.Param(name); ok {
		return value
	}
	return def
}
func (c *Context) ParamBoolDef(name string, def bool) bool {
	if value, ok := c.ParamBool(name); ok {
		return value
	}
	return def
}
func (c *Context) ParamIntDef(name string, def int64) int64 {
	if value, ok := c.ParamInt(name); ok {
		return value
	}
	return def
}
func (c *Context) ParamFloatDef(name string, def float64) float64 {
	if value, ok := c.ParamFloat(name); ok {
		return value
	}
	return def
}
func (c *Context) MustParam(name string) string {
	return c.ParamDef(name, "")
}
func (c *Context) MustParamBool(name string) bool {
	return c.ParamBoolDef(name, false)
}
func (c *Context) MustParamInt(name string) int64 {
	return c.ParamIntDef(name, 0)
}
func (c *Context) MustParamFloat(name string) float64 {
	return c.ParamFloatDef(name, 0)
}
func (c *Context) Set(key string, value interface{}) *Context {
	if c.Meta == nil {
		c.Meta = make(map[string]interface{})
	}
	c.Meta[key] = value
	return c
}
func (c *Context) Get(key string) (value interface{}, ok bool) {
	if c.Meta != nil {
		value, ok = c.Meta[key]
	}
	return
}
func (c *Context) GetDef(key string, def interface{}) interface{} {
	if value, ok := c.Get(key); ok {
		return value
	}
	return def
}
func (c *Context) GetBool(key string) (value bool, ok bool) {
	if c.Meta != nil {
		if i, has := c.Meta[key]; has && i != nil {
			value, ok = i.(bool)
		}
	}
	return
}
func (c *Context) GetBoolDef(key string, def bool) bool {
	if value, ok := c.GetBool(key); ok {
		return value
	}
	return def
}
func (c *Context) GetStr(key string) (value string, ok bool) {
	if c.Meta != nil {
		if i, has := c.Meta[key]; has && i != nil {
			value, ok = i.(string)
		}
	}
	return
}
func (c *Context) GetStrDef(key string, def string) string {
	if value, ok := c.GetStr(key); ok {
		return value
	}
	return def
}
func (c *Context) GetDuration(key string) (value time.Duration, ok bool) {
	if c.Meta != nil {
		if i, has := c.Meta[key]; has && i != nil {
			value, ok = i.(time.Duration)
		}
	}
	return
}
func (c *Context) GetDurationDef(key string, def time.Duration) time.Duration {
	if value, ok := c.GetDuration(key); ok {
		return value
	}
	return def
}
func (c *Context) GetInt(key string) (value int64, ok bool) {
	if c.Meta != nil {
		if i, has := c.Meta[key]; has && i != nil {
			value, ok = i.(int64)
		}
	}
	return
}
func (c *Context) GetUint(key string) (value uint64, ok bool) {
	if c.Meta != nil {
		if i, has := c.Meta[key]; has && i != nil {
			value, ok = i.(uint64)
		}
	}
	return
}
func (c *Context) GetIntDef(key string, def int64) int64 {
	if value, ok := c.GetInt(key); ok {
		return value
	}
	return def
}
func (c *Context) GetUintDef(key string, def uint64) uint64 {
	if value, ok := c.GetUint(key); ok {
		return value
	}
	return def
}
func (c *Context) GetFloat(key string) (value float64, ok bool) {
	if c.Meta != nil {
		if i, has := c.Meta[key]; has && i != nil {
			value, ok = i.(float64)
		}
	}
	return
}
func (c *Context) GetFloatDef(key string, def float64) float64 {
	if value, ok := c.GetFloat(key); ok {
		return value
	}
	return def
}
func (c *Context) MustGet(key string) interface{} {
	return c.GetDef(key, nil)
}
func (c *Context) Query(key string) (string, bool) {
	if values, ok := c.QueryArray(key); ok && len(values) > 0 {
		return values[0], true
	}
	return "", false
}
func (c *Context) QueryDef(key, def string) string {
	if value, ok := c.Query(key); ok {
		return value
	}
	return def
}
func (c *Context) MustQuery(key string) string {
	return c.QueryDef(key, "")
}
func (c *Context) QueryBool(key string) (bool, bool) {
	if str, ok := c.Query(key); ok {
		if b, err := strconv.ParseBool(strings.ToLower(str)); err == nil {
			return b, true
		}
	}
	return false, false
}
func (c *Context) QueryBoolDef(key string, def bool) bool {
	if value, ok := c.QueryBool(key); ok {
		return value
	}
	return def
}
func (c *Context) MustQueryBool(key string) bool {
	return c.QueryBoolDef(key, false)
}
func (c *Context) QueryInt(key string) (int64, bool) {
	if str, ok := c.Query(key); ok {
		if i, err := strconv.ParseInt(str, 10, 64); err == nil {
			return i, true
		}
	}
	return 0, false
}
func (c *Context) QueryIntDef(key string, def int64) int64 {
	if value, ok := c.QueryInt(key); ok {
		return value
	}
	return def
}
func (c *Context) MustQueryInt(key string) int64 {
	return c.QueryIntDef(key, 0)
}
func (c *Context) QueryFloat(key string) (float64, bool) {
	if str, ok := c.Query(key); ok {
		if f, err := strconv.ParseFloat(str, 64); err == nil {
			return f, true
		}
	}
	return 0, false
}