URLParamInt64 returns the url query parameter as int64 value from a request, returns -1 and an error if parse failed or not found.
(name string)
| 1623 | // URLParamInt64 returns the url query parameter as int64 value from a request, |
| 1624 | // returns -1 and an error if parse failed or not found. |
| 1625 | func (ctx *Context) URLParamInt64(name string) (int64, error) { |
| 1626 | if v := ctx.URLParam(name); v != "" { |
| 1627 | n, err := strconv.ParseInt(v, 10, 64) |
| 1628 | if err != nil { |
| 1629 | return -1, err |
| 1630 | } |
| 1631 | return n, nil |
| 1632 | } |
| 1633 | |
| 1634 | return -1, ErrNotFound |
| 1635 | } |
| 1636 | |
| 1637 | // URLParamInt64Default returns the url query parameter as int64 value from a request, |
| 1638 | // if not found or parse failed then "def" is returned. |
no test coverage detected