MCPcopy Create free account
hub / github.com/kataras/iris / URLParamFloat64

Method URLParamFloat64

context/context.go:1664–1674  ·  view source on GitHub ↗

URLParamFloat64 returns the url query parameter as float64 value from a request, returns an error and -1 if parse failed.

(name string)

Source from the content-addressed store, hash-verified

1662// URLParamFloat64 returns the url query parameter as float64 value from a request,
1663// returns an error and -1 if parse failed.
1664func (ctx *Context) URLParamFloat64(name string) (float64, error) {
1665 if v := ctx.URLParam(name); v != "" {
1666 n, err := strconv.ParseFloat(v, 64)
1667 if err != nil {
1668 return -1, err
1669 }
1670 return n, nil
1671 }
1672
1673 return -1, ErrNotFound
1674}
1675
1676// URLParamFloat64Default returns the url query parameter as float64 value from a request,
1677// if not found or parse failed then "def" is returned.

Callers 1

Calls 1

URLParamMethod · 0.95

Tested by

no test coverage detected